File tree Expand file tree Collapse file tree 3 files changed +58
-0
lines changed
Expand file tree Collapse file tree 3 files changed +58
-0
lines changed Original file line number Diff line number Diff line change 2323use HyperfTest \Di \Stub \Ast \Foo ;
2424use HyperfTest \Di \Stub \Ast \FooTrait ;
2525use HyperfTest \Di \Stub \FooEnumStruct ;
26+ use HyperfTest \Di \Stub \Par2 ;
2627use PHPUnit \Framework \TestCase ;
2728
2829/**
@@ -67,6 +68,28 @@ function __construct()
6768} ' , $ code );
6869 }
6970
71+ public function testParentWith ()
72+ {
73+ $ ast = new Ast ();
74+ $ code = $ ast ->proxy (Par2::class);
75+
76+ $ this ->assertSame ($ this ->license . '
77+ namespace HyperfTest\Di\Stub;
78+
79+ class Par2 extends Par
80+ {
81+ use \Hyperf\Di\Aop\ProxyTrait;
82+ use \Hyperf\Di\Aop\PropertyHandlerTrait;
83+ function __construct(?\HyperfTest\Di\Stub\Foo $foo)
84+ {
85+ if (method_exists(parent::class, \'__construct \')) {
86+ parent::__construct(...func_get_args());
87+ }
88+ $this->__handlePropertyHandler(__CLASS__);
89+ }
90+ } ' , $ code );
91+ }
92+
7093 public function testAstProxyForEnum ()
7194 {
7295 if (PHP_VERSION_ID < 80100 ) {
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+ /**
5+ * This file is part of Hyperf.
6+ *
7+ * @link https://www.hyperf.io
8+ * @document https://hyperf.wiki
9+ 10+ * @license https://github.com/hyperf/hyperf/blob/master/LICENSE
11+ */
12+ namespace HyperfTest \Di \Stub ;
13+
14+ class Par
15+ {
16+ public function __construct (public ?Foo $ foo )
17+ {
18+ }
19+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+ /**
5+ * This file is part of Hyperf.
6+ *
7+ * @link https://www.hyperf.io
8+ * @document https://hyperf.wiki
9+ 10+ * @license https://github.com/hyperf/hyperf/blob/master/LICENSE
11+ */
12+ namespace HyperfTest \Di \Stub ;
13+
14+ class Par2 extends Par
15+ {
16+ }
You can’t perform that action at this time.
0 commit comments