1 | <?php |
||
28 | final class MetadataBuilder |
||
29 | { |
||
30 | /** |
||
31 | * @var RouterInterface |
||
32 | */ |
||
33 | private $router; |
||
34 | |||
35 | /** |
||
36 | * @var Metadata |
||
37 | */ |
||
38 | private $metadata; |
||
39 | |||
40 | /** |
||
41 | * MetadataBuilder constructor. |
||
42 | * |
||
43 | * @param RouterInterface $router |
||
44 | */ |
||
45 | public function __construct(RouterInterface $router) |
||
50 | |||
51 | /** |
||
52 | * @return Metadata |
||
53 | */ |
||
54 | public function getMetadata(): Metadata |
||
58 | |||
59 | /** |
||
60 | * @param string $name |
||
61 | * @param string $routeName |
||
62 | * @param array $routeParameters |
||
63 | */ |
||
64 | public function setRoute(string $name, string $routeName, array $routeParameters = []) |
||
75 | |||
76 | /** |
||
77 | * @param PKCEMethodManager $PKCEMethodManager |
||
78 | */ |
||
79 | public function setCodeChallengeMethodsSupported(PKCEMethodManager $PKCEMethodManager) |
||
83 | |||
84 | /** |
||
85 | * @param ClientAssertionJwt $clientAssertionJwt |
||
86 | */ |
||
87 | public function setClientAssertionJwt(ClientAssertionJwt $clientAssertionJwt) |
||
93 | |||
94 | /** |
||
95 | * @param GrantTypeManager $grantTypeManager |
||
96 | */ |
||
97 | public function setGrantTypeManager(GrantTypeManager $grantTypeManager) |
||
101 | |||
102 | /** |
||
103 | * @param ResponseTypeManager $responseTypeManager |
||
104 | */ |
||
105 | public function setResponseTypeManager(ResponseTypeManager $responseTypeManager) |
||
109 | |||
110 | /** |
||
111 | * @param ResponseModeManager $responseModeManager |
||
112 | */ |
||
113 | public function setResponseModeManager(ResponseModeManager $responseModeManager) |
||
117 | |||
118 | /** |
||
119 | * @param TokenEndpointAuthMethodManager $tokenEndpointAuthMethodManager |
||
120 | */ |
||
121 | public function setTokenEndpointAuthMethodManager(TokenEndpointAuthMethodManager $tokenEndpointAuthMethodManager) |
||
125 | |||
126 | /** |
||
127 | * @param ScopeRepositoryInterface $scopeRepository |
||
128 | */ |
||
129 | public function setScopeRepository(ScopeRepositoryInterface $scopeRepository) |
||
133 | |||
134 | /** |
||
135 | * @param UserInfo $userInfo |
||
136 | */ |
||
137 | public function setUserinfo(UserInfo $userInfo) |
||
141 | |||
142 | /** |
||
143 | * @param string $name |
||
144 | * @param mixed $value |
||
145 | */ |
||
146 | public function addKeyValuePair(string $name, $value) |
||
157 | |||
158 | /** |
||
159 | * @param AuthorizationRequestLoader $authorizationRequestLoader |
||
160 | */ |
||
161 | public function setAuthorizationRequestLoader(AuthorizationRequestLoader $authorizationRequestLoader) |
||
170 | } |
||
171 |
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: