Closed szepeviktor closed 4 months ago
A crude tool.
find -type f -name "[A-Z]*.php" | xargs -I% -- bash -c 'grep -q -m1 "^\(class\|abstract class\|final class\|interface\)\? $(basename -s .php %)" "%" || echo "Classname not found: %"'
Nice catch, thanks! I think phpcs may be able to find it as well, of configured, possibly using this rule. I'll look into it. [Update: couldn't get this rule to work, nevermind]
Thanks! (Introduced in #257 by not fully removing the original class name from the copy/pasted file)
Glad to contribute.
For PSR-4 there is composer dump-autoload --dev --optimize --strict-psr
For PSR-4 there is
composer dump-autoload --dev --optimize --strict-psr
Cool, though it doesn't seem to detect the case fixed here:
$ composer dump-autoload --dev --optimize --strict-psr
Generating optimized autoload files
Generated optimized autoload files containing 1920 classes
$ echo $?
0
$ grep extends ./tests/ControlStructures/ForeachControlStructureTest.php
class WhilForeachControlStructureTest extends RuleTestCase
it doesn't seem to detect the case fixed here:
Of course! Tests are not PSR-4 but "classmap".
Ah sorry, I see now what you mean. I thought the "For PSR-4 ..." comment was somehow related to this issue. Turns out, it wasn't, or at least not directly :-)
... so it matched the file name
tests/ControlStructures/ForeachControlStructureTest.php