@@ -88,13 +88,24 @@ public function findFunctionReflection(string $functionName): ?NativeFunctionRef
8888 $ acceptsNamedArguments = $ phpDoc ->acceptsNamedArguments ();
8989 }
9090
91+ $ pureUnlessCallableIsImpureParameters = [];
92+ if ($ this ->signatureMapProvider ->hasFunctionMetadata ($ lowerCasedFunctionName )) {
93+ $ functionMetadata = $ this ->signatureMapProvider ->getFunctionMetadata ($ lowerCasedFunctionName );
94+ if (isset ($ functionMetadata ['pureUnlessCallableIsImpureParameters ' ])) {
95+ $ pureUnlessCallableIsImpureParameters = $ functionMetadata ['pureUnlessCallableIsImpureParameters ' ];
96+ }
97+ } else {
98+ $ functionMetadata = null ;
99+ }
100+
91101 $ variantsByType = ['positional ' => []];
92102 foreach ($ functionSignaturesResult as $ signatureType => $ functionSignatures ) {
93103 foreach ($ functionSignatures ?? [] as $ functionSignature ) {
94104 $ variantsByType [$ signatureType ][] = new FunctionVariantWithPhpDocs (
95105 TemplateTypeMap::createEmpty (),
96106 null ,
97- array_map (static function (ParameterSignature $ parameterSignature ) use ($ phpDoc ): NativeParameterWithPhpDocsReflection {
107+ array_map (static function (ParameterSignature $ parameterSignature ) use ($ phpDoc , $ pureUnlessCallableIsImpureParameters ): NativeParameterWithPhpDocsReflection {
108+ $ name = $ parameterSignature ->getName ();
98109 $ type = $ parameterSignature ->getType ();
99110
100111 $ phpDocType = null ;
@@ -113,7 +124,7 @@ public function findFunctionReflection(string $functionName): ?NativeFunctionRef
113124 }
114125
115126 return new NativeParameterWithPhpDocsReflection (
116- $ parameterSignature -> getName () ,
127+ $ name ,
117128 $ parameterSignature ->isOptional (),
118129 TypehintHelper::decideType ($ type , $ phpDocType ),
119130 $ phpDocType ?? new MixedType (),
@@ -124,6 +135,7 @@ public function findFunctionReflection(string $functionName): ?NativeFunctionRef
124135 $ phpDoc !== null ? NativeFunctionReflectionProvider::getParamOutTypeFromPhpDoc ($ parameterSignature ->getName (), $ phpDoc ) : null ,
125136 $ immediatelyInvokedCallable ,
126137 $ closureThisType ,
138+ isset ($ pureUnlessCallableIsImpureParameters [$ name ]) && $ pureUnlessCallableIsImpureParameters [$ name ],
127139 );
128140 }, $ functionSignature ->getParameters ()),
129141 $ functionSignature ->isVariadic (),
@@ -134,8 +146,8 @@ public function findFunctionReflection(string $functionName): ?NativeFunctionRef
134146 }
135147 }
136148
137- if ($ this -> signatureMapProvider -> hasFunctionMetadata ( $ lowerCasedFunctionName )) {
138- $ hasSideEffects = TrinaryLogic::createFromBoolean ($ this -> signatureMapProvider -> getFunctionMetadata ( $ lowerCasedFunctionName ) ['hasSideEffects ' ]);
149+ if (isset ( $ functionMetadata [ ' hasSideEffects ' ] )) {
150+ $ hasSideEffects = TrinaryLogic::createFromBoolean ($ functionMetadata ['hasSideEffects ' ]);
139151 } else {
140152 $ hasSideEffects = TrinaryLogic::createMaybe ();
141153 }
0 commit comments