File tree 2 files changed +34
-1
lines changed
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
14
14
*
15
15
* @return static
16
16
*/
17
- public static function new (array $ config = [])
17
+ public static function new (array $ config = []): static
18
18
{
19
19
return new static ($ config );
20
20
}
You can’t perform that action at this time.
0 commit comments