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: README.md
+36Lines changed: 36 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -83,6 +83,8 @@ class Foo extends Command
83
83
84
84
## Troubleshooting
85
85
86
+
#### Trait included, but nothing happens?
87
+
86
88
Note, that `WithoutOverlapping` trait is overriding `initialize` method:
87
89
```php
88
90
trait WithoutOverlapping
@@ -113,3 +115,37 @@ class Foo extends Command
113
115
// ...
114
116
}
115
117
```
118
+
119
+
#### Several traits conflict?
120
+
121
+
If you're using some other cool `illuminated` packages, well, you can find yourself getting "traits conflict".
122
+
For example, if you're trying to build [loggable command](https://packagist.org/packages/illuminated/console-logger), which is protected against overlapping:
123
+
```php
124
+
class Foo extends Command
125
+
{
126
+
use Loggable;
127
+
use WithoutOverlapping;
128
+
129
+
// ...
130
+
}
131
+
```
132
+
133
+
You'll get fatal error here, the "traits conflict", because both of these traits are overriding `initialize` method:
134
+
>If two traits insert a method with the same name, a fatal error is produced, if the conflict is not explicitly resolved.
135
+
136
+
But don't worry, solution is very simple. Just override `initialize` method by yourself, and initialize traits in required order:
0 commit comments