1212final class PropertyMetadata extends Metadata
1313{
1414 /**
15+ * Gets property public name.
16+ *
1517 * @var non-empty-string
1618 */
17- private readonly string $ name ;
19+ public string $ alias ;
1820
1921 private mixed $ defaultValue = null ;
2022
@@ -25,15 +27,20 @@ final class PropertyMetadata extends Metadata
2527 */
2628 private array $ skipWhen = [];
2729
28- /**
29- * @param non-empty-string $export
30- */
3130 public function __construct (
32- private string $ export ,
33- private ?TypeMetadata $ type = null ,
31+ /**
32+ * Gets property real name.
33+ *
34+ * @var non-empty-string
35+ */
36+ public readonly string $ name ,
37+ /**
38+ * Gets property type info.
39+ */
40+ public ?TypeMetadata $ type = null ,
3441 ?int $ createdAt = null ,
3542 ) {
36- $ this ->name = $ this ->export ;
43+ $ this ->alias = $ this ->name ;
3744
3845 parent ::__construct ($ createdAt );
3946 }
@@ -45,7 +52,7 @@ public function __construct(
4552 */
4653 public function getTypeStatement (Context $ context ): ?TypeStatement
4754 {
48- $ info = $ this ->findTypeInfo () ;
55+ $ info = $ this ->type ;
4956
5057 if ($ info === null ) {
5158 return null ;
@@ -73,10 +80,10 @@ public function getFieldNode(Context $context): ?NamedFieldNode
7380 return null ;
7481 }
7582
76- $ name = $ this ->getName () ;
83+ $ name = $ this ->name ;
7784
7885 if ($ context ->isDenormalization ()) {
79- $ name = $ this ->getExportName () ;
86+ $ name = $ this ->alias ;
8087 }
8188
8289 return new NamedFieldNode (
@@ -86,77 +93,6 @@ public function getFieldNode(Context $context): ?NamedFieldNode
8693 );
8794 }
8895
89- /**
90- * Returns property real name.
91- *
92- * @api
93- *
94- * @return non-empty-string
95- */
96- public function getName (): string
97- {
98- return $ this ->name ;
99- }
100-
101- /**
102- * @api
103- *
104- * @param non-empty-string $name
105- */
106- public function setExportName (string $ name ): void
107- {
108- $ this ->export = $ name ;
109- }
110-
111- /**
112- * Returns property public name.
113- *
114- * @api
115- *
116- * @return non-empty-string
117- */
118- public function getExportName (): string
119- {
120- return $ this ->export ;
121- }
122-
123- /**
124- * @api
125- */
126- public function setTypeInfo (TypeMetadata $ type ): void
127- {
128- $ this ->type = $ type ;
129- }
130-
131- /**
132- * @api
133- */
134- public function removeTypeInfo (): void
135- {
136- $ this ->type = null ;
137- }
138-
139- /**
140- * @api
141- */
142- public function hasTypeInfo (): bool
143- {
144- return $ this ->type !== null ;
145- }
146-
147- /**
148- * Note: The prefix "find" is used to indicate that the {@see TypeMetadata}
149- * definition may be optional and method may return {@see null}.
150- * The prefix "get" is used when the value is forced to be obtained
151- * and should throw an exception if the type definition is missing.
152- *
153- * @api
154- */
155- public function findTypeInfo (): ?TypeMetadata
156- {
157- return $ this ->type ;
158- }
159-
16096 /**
16197 * Adds new skip condition.
16298 *
0 commit comments