StubEnumParserTest
class StubEnumParserTest extends TestCase (View source)
Covers StubEnumParser, with emphasis on the PhpDoc/version metadata it used to discard.
parseNode() previously never invoked the PhpDoc or version parser, so enum-level
Methods
No description
Pins both halves of parse()'s type contract. assertInstanceOf alone is weak here: it keeps
passing if the : PHPEnum declaration is dropped or widened, as long as the body still
happens to return the right thing. Asserting the declared return type catches the loosening
itself, which is the change that would silently let a different entity type escape.
No description
No description
No description
No description
The attribute's to: bound is inclusive while removedVersion is exclusive, so
to: '8.4' means the enum is absent from 8.5 onwards.
No description
No description
No description
No description
PHP has no final enum syntax and ReflectionClass::isFinal() reports false for
enums, so stubs must report false too.
No description
A fully qualified interface must keep its root-namespace id. Name::toString() drops the
leading separator, so without the adapters preserving it this became \Dom\BackedEnum
— a namespace-relative id for something the source wrote as global.
An unqualified interface still resolves within the declaring namespace, so a same-namespace interface is not shadowed by a global one of the same name.
No description
No description
Details
protected void
setUp()
No description
testItDeclaresAndReturnsPHPEnum()
Pins both halves of parse()'s type contract. assertInstanceOf alone is weak here: it keeps
passing if the : PHPEnum declaration is dropped or widened, as long as the body still
happens to return the right thing. Asserting the declared return type catches the loosening
itself, which is the change that would silently let a different entity type escape.
Calls the parser directly rather than through parseFixture(), whose own : PHPEnum return
type would coerce-or-TypeError and hide which side actually regressed.
testItParsesNameAndId()
No description
testItParsesSinceVersionFromPhpDoc()
No description
testItParsesRemovedVersionFromPhpDoc()
No description
testItRetainsRawPhpDoc()
No description
testItParsesVersionsFromElementAvailableAttribute()
The attribute's to: bound is inclusive while removedVersion is exclusive, so
to: '8.4' means the enum is absent from 8.5 onwards.
testUndocumentedEnumHasNoVersionConstraints()
No description
testItParsesCases()
No description
testItParsesConstantsAndMethods()
No description
testItParsesImplementedInterfaces()
No description
testEnumIsNotReportedFinal()
PHP has no final enum syntax and ReflectionClass::isFinal() reports false for
enums, so stubs must report false too.
testItParsesNamespacedEnumId()
No description
testFullyQualifiedInterfaceKeepsItsRootNamespaceId()
A fully qualified interface must keep its root-namespace id. Name::toString() drops the
leading separator, so without the adapters preserving it this became \Dom\BackedEnum
— a namespace-relative id for something the source wrote as global.
testUnqualifiedInterfaceResolvesWithinTheDeclaringNamespace()
An unqualified interface still resolves within the declaring namespace, so a same-namespace interface is not shadowed by a global one of the same name.
testImportedInterfaceResolvesToTheImportedNamespace()
No description
testRootNamespaceEnumKeepsGlobalInterfaceIds()
No description