You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Loader/FileLoader.php
+7-3Lines changed: 7 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -224,10 +224,14 @@ public function registerClasses(Definition $prototype, string $namespace, string
224
224
if (null === $alias) {
225
225
thrownewLogicException(\sprintf('Alias cannot be automatically determined for class "%s". If you have used the #[AsAlias] attribute with a class implementing multiple interfaces, add the interface you want to alias to the first parameter of #[AsAlias].', $class));
226
226
}
227
-
if (isset($this->aliases[$alias])) {
228
-
thrownewLogicException(\sprintf('The "%s" alias has already been defined with the #[AsAlias] attribute in "%s".', $alias, $this->aliases[$alias]));
227
+
228
+
if (!$attribute->when || \in_array($this->env, $attribute->when, true)) {
229
+
if (isset($this->aliases[$alias])) {
230
+
thrownewLogicException(\sprintf('The "%s" alias has already been defined with the #[AsAlias] attribute in "%s".', $alias, $this->aliases[$alias]));
0 commit comments