Always-used class constants
PHPStan is able to detect unused private class constants. There might be some cases where PHPStan thinks a class constant is unused, but the code might actually be correct. For example custom enum implementations like Consistence enums might take advantage of reflection to write and read private constants which static analysis cannot understand, but fortunately you can write a custom extension to make PHPStan understand what’s going on and avoid false-positives.
This is the interface your extension needs to implement:
public function isAlwaysUsed(ConstantReflection $constant): bool;
The implementation needs to be registered in your configuration file: