File tree Expand file tree Collapse file tree 3 files changed +29
-25
lines changed
Expand file tree Collapse file tree 3 files changed +29
-25
lines changed Original file line number Diff line number Diff line change @@ -26,11 +26,11 @@ final class ClassMetadata extends Metadata
2626 * @throws \Exception
2727 */
2828 public function __construct (
29- string $ name ,
29+ private readonly string $ name ,
3030 iterable $ properties = [],
3131 ?int $ createdAt = null ,
3232 ) {
33- parent ::__construct ($ name , $ createdAt );
33+ parent ::__construct ($ createdAt );
3434
3535 foreach ($ properties as $ property ) {
3636 $ this ->addProperty ($ property );
@@ -66,13 +66,13 @@ public function getTypeStatement(LocalContext $context): TypeStatement
6666 }
6767
6868 /**
69+ * Returns class name.
70+ *
6971 * @return class-string<T>
7072 */
71- #[\Override]
7273 public function getName (): string
7374 {
74- /** @var class-string<T> */
75- return parent ::getName ();
75+ return $ this ->name ;
7676 }
7777
7878 /**
Original file line number Diff line number Diff line change @@ -8,13 +8,8 @@ abstract class Metadata
88{
99 private readonly int $ timestamp ;
1010
11- /**
12- * @param non-empty-string $name
13- */
14- public function __construct (
15- private readonly string $ name ,
16- ?int $ createdAt = null ,
17- ) {
11+ public function __construct (?int $ createdAt = null )
12+ {
1813 $ this ->timestamp = $ createdAt ?? $ this ->getCurrentTimestamp ();
1914 }
2015
@@ -29,18 +24,6 @@ private function getCurrentTimestamp(): int
2924 }
3025 }
3126
32- /**
33- * Returns entry name.
34- *
35- * @api
36- *
37- * @return non-empty-string
38- */
39- public function getName (): string
40- {
41- return $ this ->name ;
42- }
43-
4427 /**
4528 * Returns the metadata creation timestamp in seconds.
4629 *
Original file line number Diff line number Diff line change 1111
1212final class PropertyMetadata extends Metadata
1313{
14+ /**
15+ * @var non-empty-string
16+ */
17+ private readonly string $ name ;
18+
1419 private mixed $ defaultValue = null ;
1520
1621 private bool $ hasDefaultValue = false ;
@@ -25,7 +30,9 @@ public function __construct(
2530 private ?TypeInterface $ type = null ,
2631 ?int $ createdAt = null ,
2732 ) {
28- parent ::__construct ($ this ->export , $ createdAt );
33+ $ this ->name = $ this ->export ;
34+
35+ parent ::__construct ($ createdAt );
2936 }
3037
3138 /**
@@ -66,6 +73,18 @@ public function getFieldNode(LocalContext $context): ?NamedFieldNode
6673 );
6774 }
6875
76+ /**
77+ * Returns property real name.
78+ *
79+ * @api
80+ *
81+ * @return non-empty-string
82+ */
83+ public function getName (): string
84+ {
85+ return $ this ->name ;
86+ }
87+
6988 /**
7089 * @api
7190 *
@@ -77,6 +96,8 @@ public function setExportName(string $name): void
7796 }
7897
7998 /**
99+ * Returns property public name.
100+ *
80101 * @api
81102 *
82103 * @return non-empty-string
You can’t perform that action at this time.
0 commit comments