File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace Windwalker \DI \Attributes ;
6+
7+ #[\Attribute(\Attribute::TARGET_PARAMETER )]
8+ class NoAutowire
9+ {
10+ }
Original file line number Diff line number Diff line change 1818use UnexpectedValueException ;
1919use Windwalker \DI \Attributes \Lazy ;
2020use Windwalker \DI \Attributes \Factory ;
21+ use Windwalker \DI \Attributes \NoAutowire ;
2122use Windwalker \DI \Attributes \Service ;
2223use Windwalker \DI \Definition \DefinitionInterface ;
2324use Windwalker \DI \Definition \ObjectBuilderDefinition ;
@@ -334,6 +335,8 @@ public function &resolveParameterDependency(
334335 $ autowire = $ options ->autowire ;
335336 $ nope = null ;
336337
338+ $ noAutowire = $ param ->getAttributes (NoAutowire::class) !== [];
339+
337340 $ type = $ param ->getType ();
338341 // $dependencyVarName = $param->getName();
339342
@@ -374,6 +377,10 @@ public function &resolveParameterDependency(
374377 return $ args [$ dependencyClassName ];
375378 }
376379
380+ if ($ noAutowire ) {
381+ continue ;
382+ }
383+
377384 $ create = function &() use (
378385 $ options ,
379386 $ param ,
You can’t perform that action at this time.
0 commit comments