File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change 77use DI \Container ;
88use DI \ContainerBuilder ;
99use Psr \Container \ContainerInterface ;
10+ use StaticPHP \Attribute \PatchDescription ;
1011use Symfony \Component \Console \Input \InputInterface ;
1112use Symfony \Component \Console \Output \OutputInterface ;
13+ use ZM \Logger \ConsoleColor ;
1214
1315use function DI \factory ;
1416
@@ -138,6 +140,14 @@ public static function getInvoker(): CallbackInvoker
138140 public static function invoke (callable $ callback , array $ context = []): mixed
139141 {
140142 logger ()->debug ('[INVOKE] ' . (is_array ($ callback ) ? (is_object ($ callback [0 ]) ? get_class ($ callback [0 ]) : $ callback [0 ]) . ':: ' . $ callback [1 ] : (is_string ($ callback ) ? $ callback : 'Closure ' )));
143+
144+ // get if callback has attribute PatchDescription
145+ $ ref = new \ReflectionFunction (\Closure::fromCallable ($ callback ));
146+ $ attributes = $ ref ->getAttributes (PatchDescription::class);
147+ foreach ($ attributes as $ attribute ) {
148+ $ attrInstance = $ attribute ->newInstance ();
149+ logger ()->info (ConsoleColor::magenta ('[PATCH] ' ) . ConsoleColor::green (" {$ attrInstance ->description }" ));
150+ }
141151 return self ::getInvoker ()->invoke ($ callback , $ context );
142152 }
143153
You can’t perform that action at this time.
0 commit comments