class DeprecationParserTest extends TestCase (View source)

Covers extraction of the deprecation version — #[Deprecated(since:)] and @_deprecated <version> — into StubsMetadata::getDeprecatedSinceVersion().

Parsing goes through extractAndParseAll() rather than the single-entity parse() convenience method, because only the former supplies the import map. Resolving Deprecated through imports is what distinguishes the JetBrains attribute from the built-in one, and the two order their positional arguments differently.

Methods

void
setUp()

No description

static array
attributeDeprecationProvider()

Attribute forms are single-line variants of one construct, so the code stays next to the version it is expected to yield. The PhpDoc forms need a docblock and live in fixtures — see {phpDocDeprecationProvider}.

testItParsesDeprecationFromAttributes(string $stubCode, bool $expectedDeprecated, string|null $expectedSince)

No description

static array
phpDocDeprecationProvider()

No description

testItParsesDeprecationFromPhpDoc(string $fixtureFile, string|null $expectedSince)

No description

testItLeavesTheVersionNullWhenNotDeprecated()

A version is only carried when the element is actually deprecated, so a stale @_deprecated version can never leak onto a non-deprecated element.

static array
testItAcceptsOnlyKnownPhpVersionsFromPhpDoc(string $version, string|null $expected)

No description

testItAcceptsTheNewestAndOldestSupportedPhpVersions()

Guards the boundary the filter silently depends on. If the newest supported version ever stopped being recognised, every @_deprecated <newest> would collapse to null — i.e. to "deprecated in every version" — which is the widest possible claim and the opposite of what the tag says. The failure would otherwise be silent.

Details

protected void setUp()

No description

Return Value

void

static array attributeDeprecationProvider()

Attribute forms are single-line variants of one construct, so the code stays next to the version it is expected to yield. The PhpDoc forms need a docblock and live in fixtures — see {phpDocDeprecationProvider}.

Return Value

array

testItParsesDeprecationFromAttributes(string $stubCode, bool $expectedDeprecated, string|null $expectedSince)

No description

Parameters

string $stubCode
bool $expectedDeprecated
string|null $expectedSince

static array phpDocDeprecationProvider()

No description

Return Value

array

testItParsesDeprecationFromPhpDoc(string $fixtureFile, string|null $expectedSince)

No description

Parameters

string $fixtureFile
string|null $expectedSince

testItParsesMethodDeprecationVersion()

No description

testItParsesParameterDeprecationVersion()

No description

testItLeavesTheVersionNullWhenNotDeprecated()

A version is only carried when the element is actually deprecated, so a stale @_deprecated version can never leak onto a non-deprecated element.

static array phpVersionNormalizationProvider()

No description

Return Value

array

testItAcceptsOnlyKnownPhpVersionsFromPhpDoc(string $version, string|null $expected)

No description

Parameters

string $version
string|null $expected

testItAcceptsTheNewestAndOldestSupportedPhpVersions()

Guards the boundary the filter silently depends on. If the newest supported version ever stopped being recognised, every @_deprecated <newest> would collapse to null — i.e. to "deprecated in every version" — which is the widest possible claim and the opposite of what the tag says. The failure would otherwise be silent.