composer install
# test full standard
vendor/bin/phpcs --standard=php54to55/ /path/to/code
# test a single sniff only
vendor/bin/phpcs --standard=php54to55 --sniffs=Php54to55.Deprecated.Functions /path/to/code
Versioning
The major version reflects PHP_Codesniffer version while minor version reflects the standard revision.
As we opted for composer dependency with implicit autoloading this project no longer defines a PHP_CodeSniffer Standard and can no longer be directly executed using the phpcs binary.
Den Stand dokumentieren und gegen das Changelog abgleichen. Auch habe ich bisher aus dem Changelog nahezu keine Bugfixes angesehen, was nicht 100% ausschließt, dass wir alle neuen Funktionen/ Konstanten/ Klassen haben. Ebenfalls nicht abgeglichen ist, ob tatsächlich alle Funktionen und Konstanten der MySQL-Erweiterung erfasst wurden. Das ist wahrscheinlich, aber nicht garantiert.
You set a >= 5.5 for PHP dependency. But it does work with composer dependency (5.3.x) with the only issue being unsupported trait, callable, instanceof and finally keywords.
I would rather have a E_NOTICE or E_USER_WARNING issued by the ReservedKeywordSniff or a notice/ message issued by the binary.
The trouble arising with a high requirement is the increase with each new PHP release.
We never talked about this but may want to now:
do we support only the most recent PHP tokenizer
or do we skip a subset for older tokenizers
This may effect handling of distinct PHP interpreters like HHVM if we decide to test against those (as codesniffer itself does).
Targeting an installable, easy to use standard that executes the current features set bug-free as far as covered by unit tests.
Current state:
must drop namespaces
utilise phpcs 2 (for better reporting, compatibility; current feature was developed for early phpcs 1.4)
have a look at the test suite and fix issues
Quiet some work needed to get it executable and some more to ensure it does cover enough issues and does proper reporting.
@Ephigenia@reneoelke is there any immediate need of better reporting? Newest phpcs allows to adjust reporting a great deal. Maybe you could provide some requirements on this issue?
all deprecated function sniffs test class namespace for function names which is not needed as they can not collide (temporarily disabled tests for this edge case)
RegexpEModifierSniff does not test multiple modifiers
RegexpEModifierSniff does not test heredoc (maybe only tests quoted strings)
ForbiddenClassNamesSniff buggy (for alpha dev branch)
ForbiddenFunctionNamesSniff does test case sensitive. Function names are case-insensitive
@reneoelke I would like to opt for /Sniffs to only hold phpcs-integration while we keep a distinct path for abstracted/ common logic.
Otherwise it might get ugly once we start to further abstract sniffs and new developers try to add/ edit those amongst other classes.
Suggest directories:
/Sniffs for sniffs only (minimal, like with minimal MVC controllers)
/src for classes
/test for unit tests
(As we do not use a phpcs-style wrapper the /Tests/ may be misleading.)
An other point would be literal extraction. In order to support minor PHP versions or distinct major versions the actual lists would grow to be a major distraction. As with most localisation approaches I would like to have them in their own files.
This may be a /properties path at top level cloning the full /Sniffs tree or /properties/ /Properties subdirectories for all Sniffs that require them.
With those files we reduce LoC-per-file ratio and may simplify things as you either edit literals within the properties file or logic within the Sniff. The latter would get even more standardized and shortened.
On a side-note: autoloading for /src should suffice and result in cleaner /Sniffs as inheritance is restricted to non-sniff-classes.