File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -467,12 +467,28 @@ function parameterAttribute(
467467 );
468468}
469469
470+ /**
471+ * @param ?array<array<string, mixed>> $violations
472+ */
470473function reflectionToParameters (
471- ReflectionFunction |ReflectionMethod $ reflection
474+ ReflectionFunction |ReflectionMethod $ reflection ,
475+ ?array &$ violations = null
472476): ParametersInterface {
473477 $ parameters = parameters ();
474478 foreach ($ reflection ->getParameters () as $ reflectionParameter ) {
475- $ parameter = reflectionToParameter ($ reflectionParameter );
479+ try {
480+ $ parameter = reflectionToParameter ($ reflectionParameter );
481+ } catch (Throwable $ e ) {
482+ if ($ violations === null ) {
483+ throw $ e ;
484+ }
485+ $ violations [] = [
486+ 'parameter ' => $ reflectionParameter ->getName (),
487+ 'message ' => $ e ->getMessage (),
488+ ];
489+
490+ continue ;
491+ }
476492 $ withMethod = match ($ reflectionParameter ->isOptional ()) {
477493 true => 'withOptional ' ,
478494 default => 'withRequired ' ,
You can’t perform that action at this time.
0 commit comments