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:

  1. Skips comparison for non-LATEST PHP versions.
  2. Looks up the constant in reflection by ID.
  3. Looks up the constant in stubs by ID.
  4. If not found in either, silently succeeds — ConstantExistsCheck handles existence.
  5. Skips if either value is null (complex/dynamic expressions cannot be compared).
  6. Skips resource values stored as 'PHPSTORM_RESOURCE' by the reflection parser.
  7. 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

__construct(ReflectionProviderInterface|null $reflectionProvider = null, KnownProblemsRegistry|null $knownProblemsRegistry = null, EntityLookupService|null $entityLookup = null)

No description

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.

bool
supports(string $phpVersion)

No description

run(StubDataQueryInterface $stubs, string $entityId, string $phpVersion)

No description

Details

__construct(ReflectionProviderInterface|null $reflectionProvider = null, KnownProblemsRegistry|null $knownProblemsRegistry = null, EntityLookupService|null $entityLookup = null)

No description

Parameters

ReflectionProviderInterface|null $reflectionProvider
KnownProblemsRegistry|null $knownProblemsRegistry
EntityLookupService|null $entityLookup

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.

Parameters

CheckResultSet $results
string $entityType
string $entityId
string $checkName
string $phpVersion

Return Value

bool

bool supports(string $phpVersion)

No description

Parameters

string $phpVersion

Return Value

bool

CheckResultSet run(StubDataQueryInterface $stubs, string $entityId, string $phpVersion)

No description

Parameters

StubDataQueryInterface $stubs

Parsed stubs data

string $entityId

Entity identifier to validate

string $phpVersion

PHP version string

Return Value

CheckResultSet