1 | <?php |
||
23 | class SchemaDefinition extends AbstractTypeDefinition implements SchemaDefinitionInterface |
||
24 | { |
||
25 | /** |
||
26 | * @var string |
||
27 | */ |
||
28 | protected $query; |
||
29 | |||
30 | /** |
||
31 | * @var string|null |
||
32 | */ |
||
33 | protected $mutation; |
||
34 | |||
35 | /** |
||
36 | * @var string|null |
||
37 | */ |
||
38 | protected $subscription; |
||
39 | |||
40 | /** |
||
41 | * SchemaDefinition constructor. |
||
42 | * @param Document $document |
||
43 | * @param string $queryType |
||
44 | * @param string|null $name |
||
45 | */ |
||
46 | public function __construct(Document $document, string $queryType, string $name = null) |
||
52 | |||
53 | /** |
||
54 | * @return TypeInterface |
||
55 | */ |
||
56 | 8 | public static function getType(): TypeInterface |
|
60 | |||
61 | /** |
||
62 | * @param ObjectDefinition $query |
||
63 | * @return SchemaDefinition |
||
64 | */ |
||
65 | public function withQuery(ObjectDefinition $query): SchemaDefinition |
||
71 | |||
72 | /** |
||
73 | * @return ObjectDefinition|TypeDefinition |
||
74 | */ |
||
75 | public function getQuery(): ObjectDefinition |
||
79 | |||
80 | /** |
||
81 | * @param ObjectDefinition|null $mutation |
||
82 | * @return SchemaDefinition |
||
83 | */ |
||
84 | public function withMutation(?ObjectDefinition $mutation): SchemaDefinition |
||
90 | |||
91 | /** |
||
92 | * @return null|ObjectDefinition|TypeDefinition |
||
93 | * @throws \Railt\Io\Exception\ExternalFileException |
||
94 | */ |
||
95 | public function getMutation(): ?ObjectDefinition |
||
99 | |||
100 | /** |
||
101 | * @return bool |
||
102 | */ |
||
103 | public function hasMutation(): bool |
||
107 | |||
108 | /** |
||
109 | * @param ObjectDefinition|null $subscription |
||
110 | * @return SchemaDefinition |
||
111 | */ |
||
112 | public function withSubscription(?ObjectDefinition $subscription): SchemaDefinition |
||
118 | |||
119 | /** |
||
120 | * @return null|ObjectDefinition|TypeDefinition |
||
121 | * @throws \Railt\Io\Exception\ExternalFileException |
||
122 | */ |
||
123 | public function getSubscription(): ?ObjectDefinition |
||
127 | |||
128 | /** |
||
129 | * @return bool |
||
130 | */ |
||
131 | public function hasSubscription(): bool |
||
135 | } |
||
136 |
Let’s assume that you have a directory layout like this:
and let’s assume the following content of
Bar.php
:If both files
OtherDir/Foo.php
andSomeDir/Foo.php
are loaded in the same runtime, you will see a PHP error such as the following:PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php
However, as
OtherDir/Foo.php
does not necessarily have to be loaded and the error is only triggered if it is loaded beforeOtherDir/Bar.php
, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias: