@@ -49,14 +49,17 @@ public static function checkParams(
4949 string $ function ,
5050 array $ vars ,
5151 object |string |null $ thisOrClass ,
52- TypeValidatorRegistry $ registry
52+ TypeValidatorRegistry $ registry ,
53+ string $ effectiveFunction = ''
5354 ): ?ErrorMessage {
5455 if (! Config::isParamsEnabled ()) {
5556 return null ;
5657 }
5758
5859 $ thisObj = \is_object ($ thisOrClass ) ? $ thisOrClass : null ;
59- $ effectiveFunction = self ::resolveEffectiveFunction ($ function , $ thisOrClass , $ thisObj );
60+ if ($ effectiveFunction === '' ) {
61+ $ effectiveFunction = self ::resolveEffectiveFunction ($ function , $ thisOrClass , $ thisObj );
62+ }
6063
6164 $ magicError = self ::handleMagicCall ($ effectiveFunction , $ vars , $ thisObj , $ registry );
6265 if ($ magicError !== null ) {
@@ -140,20 +143,23 @@ public static function resolveEffectiveFunction(string $function, object|string|
140143 }
141144
142145 $ actualClassName = \is_object ($ thisOrClass ) ? \get_class ($ thisOrClass ) : (\is_string ($ thisOrClass ) ? $ thisOrClass : '' );
143- $ cacheKey = $ function . '| ' . $ actualClassName ;
146+ if ($ actualClassName === '' ) {
147+ return $ function ;
148+ }
149+
150+ [$ classOrTrait , $ methodName ] = explode (':: ' , $ function , 2 );
144151
152+ $ cacheKey = $ function . '| ' . $ actualClassName ;
145153 if (isset (self ::$ effectiveFunctionCache [$ cacheKey ])) {
146154 return self ::$ effectiveFunctionCache [$ cacheKey ];
147155 }
148156
149- [$ classOrTrait , $ methodName ] = explode (':: ' , $ function , 2 );
150-
151- $ effectiveFunction = ($ actualClassName !== '' && $ actualClassName !== $ classOrTrait )
157+ $ effectiveFunction = ($ actualClassName !== $ classOrTrait )
152158 ? $ actualClassName . ':: ' . $ methodName
153159 : $ function ;
154160
155161 if ($ thisObj !== null ) {
156- $ targetClass = $ actualClassName !== '' ? $ actualClassName : $ classOrTrait ;
162+ $ targetClass = $ actualClassName ;
157163 $ traitAliases = HierarchyResolver::getTraitAliases ($ targetClass );
158164
159165 if (\count ($ traitAliases ) > 0 ) {
@@ -195,8 +201,11 @@ private static function handleMagicCall(
195201 ?object $ thisObj ,
196202 TypeValidatorRegistry $ registry
197203 ): ?ErrorMessage {
198- $ isMagicCall = str_ends_with ($ effectiveFunction , '::__call ' ) || str_ends_with ($ effectiveFunction , '::__callStatic ' );
199- if (! $ isMagicCall || ! Config::isMagicMethodsEnabled ()) {
204+ if (! Config::isMagicMethodsEnabled ()) {
205+ return null ;
206+ }
207+
208+ if (! str_ends_with ($ effectiveFunction , '::__call ' ) && ! str_ends_with ($ effectiveFunction , '::__callStatic ' )) {
200209 return null ;
201210 }
202211
0 commit comments