@@ -103,13 +103,24 @@ public function findFunctionReflection(string $functionName): ?NativeFunctionRef
103103 $ acceptsNamedArguments = $ phpDoc ->acceptsNamedArguments ();
104104 }
105105
106+ $ pureUnlessCallableIsImpureParameters = [];
107+ if ($ this ->signatureMapProvider ->hasFunctionMetadata ($ lowerCasedFunctionName )) {
108+ $ functionMetadata = $ this ->signatureMapProvider ->getFunctionMetadata ($ lowerCasedFunctionName );
109+ if (isset ($ functionMetadata ['pureUnlessCallableIsImpureParameters ' ])) {
110+ $ pureUnlessCallableIsImpureParameters = $ functionMetadata ['pureUnlessCallableIsImpureParameters ' ];
111+ }
112+ } else {
113+ $ functionMetadata = null ;
114+ }
115+
106116 $ variantsByType = ['positional ' => []];
107117 foreach ($ functionSignaturesResult as $ signatureType => $ functionSignatures ) {
108118 foreach ($ functionSignatures ?? [] as $ functionSignature ) {
109119 $ variantsByType [$ signatureType ][] = new ExtendedFunctionVariant (
110120 TemplateTypeMap::createEmpty (),
111121 null ,
112- array_map (static function (ParameterSignature $ parameterSignature ) use ($ phpDoc ): ExtendedNativeParameterReflection {
122+ array_map (static function (ParameterSignature $ parameterSignature ) use ($ phpDoc , $ pureUnlessCallableIsImpureParameters ): ExtendedNativeParameterReflection {
123+ $ name = $ parameterSignature ->getName ();
113124 $ type = $ parameterSignature ->getType ();
114125
115126 $ phpDocType = null ;
@@ -139,7 +150,7 @@ public function findFunctionReflection(string $functionName): ?NativeFunctionRef
139150 $ phpDoc !== null ? NativeFunctionReflectionProvider::getParamOutTypeFromPhpDoc ($ parameterSignature ->getName (), $ phpDoc ) : null ,
140151 $ immediatelyInvokedCallable ,
141152 $ closureThisType ,
142- [ ],
153+ isset ( $ pureUnlessCallableIsImpureParameters [ $ name ]) && $ pureUnlessCallableIsImpureParameters [ $ name ],
143154 );
144155 }, $ functionSignature ->getParameters ()),
145156 $ functionSignature ->isVariadic (),
@@ -150,8 +161,8 @@ public function findFunctionReflection(string $functionName): ?NativeFunctionRef
150161 }
151162 }
152163
153- if ($ this -> signatureMapProvider -> hasFunctionMetadata ( $ lowerCasedFunctionName )) {
154- $ hasSideEffects = TrinaryLogic::createFromBoolean ($ this -> signatureMapProvider -> getFunctionMetadata ( $ lowerCasedFunctionName ) ['hasSideEffects ' ]);
164+ if (isset ( $ functionMetadata [ ' hasSideEffects ' ] )) {
165+ $ hasSideEffects = TrinaryLogic::createFromBoolean ($ functionMetadata ['hasSideEffects ' ]);
155166 } else {
156167 $ hasSideEffects = TrinaryLogic::createMaybe ();
157168 }
0 commit comments