website/errors/constant.value.md
<?php declare(strict_types = 1);
// phpstan.neon:
// parameters:
// dynamicConstantNames:
// DATABASE_ENGINE: string|null
const DATABASE_ENGINE = false;
When a global constant is listed in the dynamicConstantNames configuration with an explicit type, PHPStan checks that values assigned via the const statement are compatible with that type. In the example above, DATABASE_ENGINE is configured to accept string|null, but false is being assigned.
This prevents the configured type from becoming inaccurate, which would lead to incorrect analysis results elsewhere in the codebase.
Change the value to match the configured type:
-const DATABASE_ENGINE = false;
+const DATABASE_ENGINE = null;
Or update the configured type in phpstan.neon to accept the value:
parameters:
dynamicConstantNames:
- DATABASE_ENGINE: string|null
+ DATABASE_ENGINE: string|false|null