DeprecationComparator
final class DeprecationComparator (View source)
Resolves deprecation state at a given PHP version, and compares the two sides.
Reflection reports deprecation for the single version it was captured under, so its flag is
already version-specific. Stubs describe every version at once, so a stub flag alone says
nothing about when deprecation starts — #[Deprecated(since: '8.4')] has to read as "not
deprecated" on 8.3 and "deprecated" on 8.4. That version lives in
{\StubTests\Framework\Model\StubsMetadata::getDeprecatedSinceVersion()}; without it,
deprecation applies to every version, which is also how reflection-side elements behave
(they carry no stub metadata at all).
Methods
Is the element deprecated as of $phpVersion?
Is the callable deprecated in reflection for $phpVersion but not in stubs?
Details
static bool
isDeprecatedIn(PHPFunction|PHPParameter $element, string $phpVersion)
Is the element deprecated as of $phpVersion?
static bool
isMismatch(PHPFunction $reflCallable, PHPFunction $stubCallable, string $phpVersion)
Is the callable deprecated in reflection for $phpVersion but not in stubs?
One-directional: reflection-deprecated -> stub must be deprecated. The reverse is not enforced here.