Repository navigation
Description
I'm just creating an issue, because I'm not sure what your plans are for this repo, or regarding PRs.
For anyone that's interested, I have a local copy of this repo (the config-repos branch) that I (and Copilot) fixed to use on PHP >= 8.2, with lots of bug fixes, and dependency updates.
The packages changed:
roave/better-reflectionto use the latest version, and changed all old API usages to use the new API that was breaking changes.nikic/php-parserto use the latest version.phpunit/phpunitto use the latest version.- Removed
danielstjules/stringywhich is not compatible with PHP 8.1 (has outstanding issues). Addedvoku/stringyas a drop-in replacement.
The test suit (with lots of code fixes) now passes, and the generator also completely works for different external standards packages as well as PHPCS built-in standards.
I also have the Copilot chat history to help with a changelog if needed.
Now that the generator works, I'm hoping to add functionality to get all sniff error/violation codes (not just public customisable ones), as set by addError(..., 'SingleLine'); etc. I know there is the ViolationParser class, but that seems to only parse the docs xml files. In particular the getErrorCode method has from what can I only assume is a no-longer supported path of the error/violation code docs. At least no current internal or external standards use this path. I will probably change this class to parse the actual *Sniff.php instead to find and retrieve the specific violation codes of the sniff, and possibly the error message as a description.
phpcs-docs/src/Parser/ViolationParser.php
Lines 29 to 39 in 8ac1181
| private function getErrorCode(string $xmlFilePath): string | |
| { | |
| $xmlFilePath = Functions::normalizeSlashes($xmlFilePath); | |
| $part = '([^/]*)'; | |
| preg_match("`$part/Docs/$part/{$part}Standard/$part\.xml$`", $xmlFilePath, $matches); | |
| if ($matches === []) { | |
| throw NotAViolationPath::fromPath($xmlFilePath); | |
| } | |
| return sprintf('%s.%s.%s.%s', $matches[1], $matches[2], $matches[3], $matches[4]); | |
| } |
Activity
jrfnl commentedon Jun 20, 2025
As per the contributing guide of the main PHP_CodeSniffer repo: any use of AI is strictly forbidden in the PHPCS projects. You don't know what code the AI is trained on and what license that code was released under. It is basically theft of copyrighted material.
So, sorry, while I appreciate you wanting to contribute, this is not an acceptable way to do it.
yCodeTech commentedon Jun 21, 2025
Ah ok, I didn't realise the usage of AI is unacceptable. I'll go read the contribution terms, but thanks for letting me know. Sorry for violating the contribution terms regarding AI.