Is it possible to use #PHP_CodeSniffer to find errors in #PSR-4 namespace declarations? Like, a mismatch between class namespace and file system location?
#php

Note to self: the rule to detect #PHP short open tags with #PHP_CodeSniffer is:

Generic.PHP.DisallowShortOpenTag.Found

And the command needs to be invoked as:

php -d short_open_tag=on vendor/bin/phpcs

The magic trailing ".Found" in the rule name is what allows the <?= variant.

Hey, #OpenSource and #PHP friends!

@jrf_nl, maintainer of #PHP_CodeSniffer is live-streaming the upgrade to the 4.0 branch of #PHPCS this week!

Such a fun idea! Come along and watch #FOSS in action!

https://github.com/PHPCSStandards/PHP_CodeSniffer/issues/924

PHPCS 4.0: Open invitation to join live stream April 14, 15, 17 and 18, 2025 · Issue #924 · PHPCSStandards/PHP_CodeSniffer

As previously announced in #120, to have confidence in the PHPCS 4.0 release, I have been working behind the scenes to recreate the 4.0 branch as a fresh, improved branch with atomic and comprehens...

GitHub
I found a #PHP file incorrectly indented (occurrences of 5 spaces rather than 4). Neither #PhpStorm nor #PHP_CodeSniffer would report or fix it. I had to use Visual Studio Code to reformat the file. Afterwards, I tried to replicate it with a fresh file and I couldn't. I recovered old file from history and I still couldn't reproduce the problem.

I'm hoping to get most of the syntax support for PHP 8.3 ready over the next few days, which means that if all goes well, it will be included in #PHP_CodeSniffer 3.9.0 release.

The PR to add Tokenizer support for PHP 8.3 readonly anonymous classes to PHPCS is already open.

https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/309

#phpcs

PHP 8.3 | Tokenizer/PHP: add support for readonly anonymous classes by jrfnl · Pull Request #309 · PHPCSStandards/PHP_CodeSniffer

Description PHP 8.3 introduced readonly anonymous classes, fixing an oversight in the PHP 8.2 introduction of readonly classes. As things were, for PHP 8.1+, the tokenizer would change the token co...

GitHub

The Future of #PHP_CodeSniffer

TL;DR: This repo is being abandoned. The project continues in the PHPCSStandards organisation => https://github.com/PHPCSStandards/PHP_CodeSniffer

https://github.com/squizlabs/PHP_CodeSniffer/issues/3932

GitHub - PHPCSStandards/PHP_CodeSniffer: PHP_CodeSniffer tokenizes PHP files and detects violations of a defined set of coding standards.

PHP_CodeSniffer tokenizes PHP files and detects violations of a defined set of coding standards. - PHPCSStandards/PHP_CodeSniffer

GitHub