running name-collision detector on a repository containing a file with PHP 8.5+ only syntax like e.g.
<?php // lint >= 8.5
namespace Bug14565;
class Foo
{
#[\NoDiscard]
public function bar(): int
{
return 1;
}
}
function (Foo $foo): void {
(void) $foo->bar();
};
turns into a fatal error
php vendor/bin/detect-collisions --configuration collision-detector.json
Using config '/Users/staabm/workspace/phpstan-strict-rules/collision-detector.json'
ERROR: Unable to parse /Users/staabm/workspace/phpstan-strict-rules/tests/Rules/Cast/data/bug-14565.php: syntax error, unexpected variable "$foo"
make: *** [name-collision] Error 255
when running on a lower PHP version
php -v
PHP 8.3.30 (cli) (built: Jan 13 2026 22:36:55) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.30, Copyright (c) Zend Technologies
in php-parallel-lint there is a <?php // lint >= 8.5 syntax.
I think it would be great if collision-detector could also utilize this syntax and auto-skip files which do not match against the current used php version.
that way we would not need to maintain another "exlucde" list in collision-detector.json.
running name-collision detector on a repository containing a file with PHP 8.5+ only syntax like e.g.
turns into a fatal error
when running on a lower PHP version
in php-parallel-lint there is a
<?php // lint >= 8.5syntax.I think it would be great if collision-detector could also utilize this syntax and auto-skip files which do not match against the current used php version.
that way we would not need to maintain another "exlucde" list in
collision-detector.json.