As of May 31, 2023, we have updated our Code of Conduct.

Questions tagged [phpcs]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
20 views

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 ...
1 vote
3 answers
312 views

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 ...
6 votes
1 answer
2k views

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 ...
2 votes
4 answers
591 views

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 ...
6 votes
2 answers
2k views

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....
0 votes
1 answer
252 views

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
0 votes
0 answers
215 views

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....
2 votes
2 answers
7k views

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 ...
1 vote
0 answers
140 views

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 ...
6 votes
3 answers
1k views

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?