Skip to main content

Questions tagged [coding-standards]

0 votes
2 answers
321 views

when I am running the command to check phpcs issues, vendor/bin/phpcs --standard=Magento2 /filepath/ ERROR: Referenced sniff "PHPCompatibility.FunctionUse.RemovedFunctions" does not ...
Smita Kagwade's user avatar
2 votes
0 answers
1k views

As we know Magento latest version 2.4.5 version is compatible with PHP-8.x. When running setup:di: compile, it throws an exception Deprecated Functionality: Optional parameter $data declared before ...
HaFiz Umer's user avatar
  • 1,700
2 votes
4 answers
1k views

Today I came across a really useful set of tools. Magento 2 github actions: https://github.com/extdn/github-actions-m2 Which means you can run a github action workflows to scan your code for Magento ...
Dominic Pixie's user avatar
-4 votes
1 answer
70 views

How to Optimization magento1 & 2 default Products, Order, Customer, Wishlist etc.. collection query?
Bhavesh Godhani's user avatar
0 votes
1 answer
48 views

I am currently working on bringing my extensions to the current coding standard. So, when writing a function, normally I would describe it the following way: protected function exampleFunction(string $...
Mario's user avatar
  • 508
1 vote
2 answers
1k views

We have two approaches to find if the record exists in database or not First $select = $this->bookResource->getConnection()->select() ->distinct() ->from( $this->bookResource-&...
26vivek's user avatar
  • 477
0 votes
1 answer
441 views

While building a multi-dimensional array as shown below, I need to use a loop to retrieve some value from $this_fulfillment_record to be assigned to "amount" =>. Can a if statement be ...
CodeForGood's user avatar
2 votes
1 answer
1k views

I'm using Magento\Newsletter\Model\ResourceModel\Subscriber::loadByCustomerData Code is like this /** @var \Magento\Customer\Api\Data\CustomerInterface $customer */ [...] $subscriber = $this->...
Dominic Pixie's user avatar
2 votes
4 answers
4k views

I am using the base64_decode() and base64_encode() in my code but PHPCS says The use of function base64_decode() is discouraged so what's the equivalence of this core PHP function in Magento2?
Max's user avatar
  • 323
0 votes
1 answer
108 views

After running the code sniffer on Magento 2 extension got several warnings and that includes one warning saying "The use of function session_id() is discouraged". So what is the alternative ...
Mehar's user avatar
  • 205
1 vote
1 answer
493 views

I have an open-source module in Github and I'd like to automatically test it via CI using the Magento Coding Standard and different Magento installations in different PHP versions. For example: ...
Rafael Corrêa Gomes's user avatar
2 votes
1 answer
2k views

I want to override public static function getCorrectFileName method of Magento\Framework\File\Uploader, I have check with Preference and Plugin but it is not working for me. Anyone have idea about ...
Niranjan Gondaliya's user avatar
1 vote
2 answers
1k views

I'm trying to find an example in M2 repo where a proxy is used but not explicitly requested in a constructor. Can anyone point me in the right direction? This is in response to phpcs Magento2 ...
Dominic Pixie's user avatar
0 votes
1 answer
482 views

Can anyone point to some decent github repository where module implements CQRS, SOLID, DRY and testing? I was reading about MSI, but it is kind of complex and huge and I am looking for something ...
niziou's user avatar
  • 1
2 votes
1 answer
3k views

Has anyone got a cheat sheet style list of the common Magento 2 code quality exclusions? // phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis // phpcs:disable Magento2.Files.LineLength....
Dominic Pixie's user avatar

15 30 50 per page
1
2 3 4 5 6