File tree Expand file tree Collapse file tree 2 files changed +34
-1
lines changed Expand file tree Collapse file tree 2 files changed +34
-1
lines changed Original file line number Diff line number Diff line change 1+ <?php declare (strict_types=1 );
2+
3+ namespace Toolkit \Stdlib \Obj \Traits ;
4+
5+ use Toolkit \Stdlib \Obj ;
6+
7+ /**
8+ * trait AutoConfigTrait
9+ *
10+ * @author inhere
11+ */
12+ trait AutoConfigTrait
13+ {
14+ /**
15+ * @param array $config
16+ *
17+ * @return static
18+ */
19+ public static function new (array $ config = []): static
20+ {
21+ return new static ($ config );
22+ }
23+
24+ /**
25+ * Class constructor.
26+ *
27+ * @param array $config
28+ */
29+ public function __construct (array $ config = [])
30+ {
31+ Obj::init ($ this , $ config );
32+ }
33+ }
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ trait QuickInitTrait
1414 *
1515 * @return static
1616 */
17- public static function new (array $ config = [])
17+ public static function new (array $ config = []): static
1818 {
1919 return new static ($ config );
2020 }
You can’t perform that action at this time.
0 commit comments