Download the PHP package shipmonk/name-collision-detector without Composer
On this page you can find all versions of the php package shipmonk/name-collision-detector. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package name-collision-detector
Name collision detector
Simple tool which allows you to detect if there are no types defined multiple times within the same namespace. This means that any ambiguous class, interface, enum, trait, constant or function is reported. Non-zero exit code is returned when any duplicate is found.
Installation:
Usage:
Check duplicate types:
Example error output:
Example success output:
- Note the performance: 10 000 files takes few seconds!
Configuration:
If file named collision-detector.json
is present within current working directory, its contents are taken as configuration options. Possible config options:
Paths provided by CLI arguments have priority over those in scanDirs
.
You can provide custom path to config file by vendor/bin/detect-collisions --configuration path/to/config.json
Reasoning
Having colliding classes within project can cause crazy headaches while debugging why something works only sometimes. Typically, you have PSR-4 autoloading which often solves this problem for you, but there are cases (like PHPStan rules test files) where you want to write any code (with classmap autoloading). And in such cases, the test may work when executed in standalone run, but fail when running all the tests together (depending on which class was autoloaded first). Therefore, having a collision detector in CI might be useful.
Composer's ambiguous class resolution
Composer can also detect class duplicates and exit with non-zero, but it runs much slower and lacks function and constant detection. Using composer version >= 2.8.1
, you can use:
Supported PHP versions
- PHP 7.2 - PHP 8.4
All versions of name-collision-detector with dependencies
ext-json Version *
ext-tokenizer Version *
nette/schema Version ^1.1.0