ConstantValueCheck
class ConstantValueCheck extends AbstractReflectionCheck (View source)
Validates that the values of global constants in stubs match reflection.
Value comparison is intentionally limited to the latest PHP version to avoid false positives from historical value changes across PHP releases.
For each constant identified by $entityId the validator:
- Skips comparison for non-LATEST PHP versions.
- Looks up the constant in reflection by ID.
- Looks up the constant in stubs by ID.
- If not found in either, silently succeeds — ConstantExistsCheck handles existence.
- Skips if either value is null (complex/dynamic expressions cannot be compared).
- Skips resource values stored as 'PHPSTORM_RESOURCE' by the reflection parser.
- Reports a failure if the string representations of the values differ.
Known problems are supported via EntityType::GLOBAL_CONSTANT + constantId + 'ConstantValueCheck'.
Properties
| protected ReflectionProviderInterface | $reflectionProvider | from AbstractReflectionCheck | |
| protected KnownProblemsRegistry | $knownProblemsRegistry | from AbstractReflectionCheck |
Methods
No description
Records a skipped-success result if a known problem covers this entity, and returns true.
No description
Details
__construct(ReflectionProviderInterface|null $reflectionProvider = null, KnownProblemsRegistry|null $knownProblemsRegistry = null, EntityLookupService|null $entityLookup = null)
No description
protected bool
skipWithKnownProblem(CheckResultSet $results, string $entityType, string $entityId, string $checkName, string $phpVersion)
Records a skipped-success result if a known problem covers this entity, and returns true.
Returns false if validation should proceed normally.
bool
supports(string $phpVersion)
No description
CheckResultSet
run(StubDataQueryInterface $stubs, string $entityId, string $phpVersion)
No description