class ReflectionClassConstantParserTest extends TestCase (View source)

Methods

testItCopiesNameAndValueFromTheReflectionConstant()

Replaces two assertions that could not fail: parse() declares a non-nullable PHPClassConstant return type, so both assertNotNull and instanceof were guaranteed by the signature. Asserts the value actually reaches the model instead.

testEachParseReturnsItsOwnClassConstantModel()

Not type-guaranteed: each call must yield its own model, not a memoised one.

testItPropagatesFinalityFromTheReflectionConstant($reflectionSaysFinal, $expected)

isFinal() was exposed by the wrapper but never read, so a final internal constant cached as non-final. Latent today — nothing in core or in the stubs declares a final class constant (final constants are PHP 8.1+) — so only a test can pin it.

static 
finalityProvider()

No description

testArrayFallbackDefaultsToPublicAndNonFinal()

The name => value fallback is reached only on runtimes without getReflectionConstants(), i.e. before PHP 7.1 — where class-constant visibility (7.1) and final constants (8.1) do not exist yet. Its public/non-final defaults are correct by construction, and this pins that so the defaults are not "fixed" into something else.

Details

testItCopiesNameAndValueFromTheReflectionConstant()

Replaces two assertions that could not fail: parse() declares a non-nullable PHPClassConstant return type, so both assertNotNull and instanceof were guaranteed by the signature. Asserts the value actually reaches the model instead.

testEachParseReturnsItsOwnClassConstantModel()

Not type-guaranteed: each call must yield its own model, not a memoised one.

testItSetsDevautNameNullForClassConstants()

No description

testItCanParseClassConstantName()

No description

testItSetsDevautValueNullForClassConstants()

No description

testItCanParseClassConstantValue()

No description

testParsedConstantDoesnNotHaveId()

No description

testItSetsNullAsParentClassIfNoParentClass()

No description

testItCanParseParentClassIdRootNamespace()

No description

testItCanParseParentClassIdCustomNamespace()

No description

testItCanParseConstantPrivateVisibility()

No description

testItCanParseConstantProtectedVisibility()

No description

testItCanParseConstantPublicVisibility()

No description

testItParseVisibilityPublicIfNoVisibilityIsPresent()

No description

testItPropagatesFinalityFromTheReflectionConstant($reflectionSaysFinal, $expected)

isFinal() was exposed by the wrapper but never read, so a final internal constant cached as non-final. Latent today — nothing in core or in the stubs declares a final class constant (final constants are PHP 8.1+) — so only a test can pin it.

Parameters

$reflectionSaysFinal
$expected

static finalityProvider()

No description

testArrayFallbackDefaultsToPublicAndNonFinal()

The name => value fallback is reached only on runtimes without getReflectionConstants(), i.e. before PHP 7.1 — where class-constant visibility (7.1) and final constants (8.1) do not exist yet. Its public/non-final defaults are correct by construction, and this pins that so the defaults are not "fixed" into something else.