Questions tagged [phpcs]
The phpcs tag has no usage guidance.
Code Sniffer Fails
I am trying to run code sniffing for one of my module and it is giving the below error. **Class 'ArrayObject' is restricted in /usr/share/eqp/PhpCodeSnifferTool/tmp/work/DataObject.php. Suggested ...
Why does PHP_CodeSniffer only allow me to have a Magento copyright at the top of my code?
When I try to use my own copyright I get this warning when running phpcs: "0: line: 3, col: 1, Copyright is missing or has wrong format" But if I use Magento copyright, I get no warning. No ...
Magento2 installation - Failed to set PHP CodeSniffer installed_paths Config
I am trying to install Magento2 using composer. Getting codesniffer error and tried below steps to overcome the error but unfortunately it's not going away STEP 1: Tried to install magento2 $ composer ...
Magento 2 coding standards : phpcs --standard=PHPCompatibility github action to check extension code
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 ...
How to fix Referenced sniff "PHPCompatibility.FunctionUse.RemovedFunctions" does not exist with PHP8.1
For php8.1 and with the latest Magento coding standards we are facing below error while running the static test from CLI and PHPStorm ERROR: Referenced sniff "PHPCompatibility.FunctionUse....
Magento2 | The use of function getallheaders(), base64_decode(), rawurldecode() is discouraged
The use of function getallheaders(), base64_decode(), rawurldecode() is discouraged. What are the alternative for these in Magento2
PHPStorm Xdebug not working
I like to configure and check the code flow using the X-debug break-point, so followed the below tutorial and successfully configured the X-debug in my PHP-storm, I am using php-7.2 https://www....
Magento 2 PHPCS coding standards
I am creating a Magento 2.3 website from scratch. I am having phpcs.xml file on Magento root which contains the rules for PHPCS. These rules get triggered when the build is executed. I am confused ...
Outdated codesniffer in MEQP2 composer.json for Magento 2.2?
How to correctly test against MEQP2 standard? Normally i use vendor/bin/phpcs --standard=PSR2 To supress errors a i use this: //phpcs:ignore or //phpcs:disable PSR2 When using MEQP2 standards ...
Running Magento 2's Provided Code Sniffs
Magento 2 seems to include a set of PHP code sniffs in the source repository. How can I, as a third party developer, use the phpcs tool to run these sniffs against my code?