classClassShape
final class ClassShape
Restricted visibility: declared "@visibility root". Code outside that scope must not name this declaration.
One class, interface, trait or enum, reduced to the parts the analyzer reads.
Properties§
public string $namepublic string|null $parentpublic list<string> $interfacespublic list<string> $traitspublic bool $enumpublic array<string, Expr> $constantspublic array<string, Expr|null> $enumCasespublic array<string, TypeShape> $propertyTypespublic array<string, MethodShape> $methodspublic array<string, Expr> $propertyDefaults = []public array<string, true> $assignedProperties = []public bool $hasAttributes = falseMethods§
public function __construct(
public string $name,
public string|null $parent,
public list<string> $interfaces,
public list<string> $traits,
public bool $enum,
public array<string, Expr> $constants,
public array<string, Expr|null> $enumCases,
public array<string, TypeShape> $propertyTypes,
public array<string, MethodShape> $methods,
public array<string, Expr> $propertyDefaults = [],
public array<string, true> $assignedProperties = [],
public bool $hasAttributes = false,
)Parameters
$name | string | The declaration, fully qualified without a leading backslash |
$parent | string|null | The parent class, when one is extended |
$interfaces | list<string> | The implemented interfaces and extended interfaces |
$traits | list<string> | The used traits |
$enum | bool | Whether the declaration is an enum |
$constants | array<string, Expr> | Class constant expressions, keyed by name |
$enumCases | array<string, Expr|null> | Enum case backing expressions, keyed by case name |
$propertyTypes | array<string, TypeShape> | Declared property types, keyed by property name |
$methods | array<string, MethodShape> | Methods, keyed by lower-case name |
$propertyDefaults | array<string, Expr> | Property default expressions, keyed by property name |
$assignedProperties | array<string, true> | Properties the class assigns to somewhere in its body |
$hasAttributes | bool | Whether attributes may customize runtime behavior |
public function settledDefault(string $property): ?ExprThe default expression of a property that nothing in the class overwrites.
A property declared with a default and never assigned again holds that default for the whole life of every instance, which is what lets a table name kept in a property resolve instead of becoming a gap.
Parameters
$property | string |
Returns
?Exprpublic function ancestors(): list<string>The names this declaration inherits from, nearest first.
Returns
list<string>Test cases 2
Calls 1
- function-call
array_mergeline 72
Test cases 22§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 5
ClassShapeTest::testAncestorsListTheParentTheTraitsAndTheInterfacescallsClassShapeTest::testAncestorsOfAClassWithoutAParentcallsClassShapeTest::testSettledDefaultAnswersForAPropertyNothingOverwritescallsClassShapeTest::testSettledDefaultIsNullForAPropertyTheClassAssignsTocallsClassShapeTest::testSettledDefaultIsNullForAPropertyWithoutOnecalls
Other tests reaching this symbol 17
CallEvaluatorTest::testEvaluateMethodFollowsAMethodDeclaredWithoutABodycallsConstantReaderTestcallsCalleeReturnsTestcallsCallersTestcallsDeriverTestcallsEntryBinderTestcallsPropertyWritesTestcallsInterpreterTestcallsReferenceEvaluatorTestcallsSinkMatcherTestcallsProgramIndexBuilderTestcallsProgramIndexTest::testFindClassIgnoresCaseAndLeadingBackslashescallsProgramIndexTest::testLineageVisitsEachDeclarationOncecallsProgramIndexTest::testMergePrefersTheDeclarationsOfThisIndexcallsCallbackModelTestcallsModelMetadataTestcallsAnalyzerTestcalls
Relations§
Instantiated in 1
Type declarations 3
- type SqlCatalog\Core\Php\ProgramIndex packages/sql-catalog/src/Core/Php/ProgramIndex.php:34
- type SqlCatalog\Core\Php\ProgramIndexBuilder packages/sql-catalog/src/Core/Php/ProgramIndexBuilder.php:86
- type SqlCatalog\Extension\Laravel\ModelMetadata packages/sql-catalog/src/Extension/Laravel/ModelMetadata.php:103