@@ -88,13 +88,24 @@ public function findFunctionReflection(string $functionName): ?NativeFunctionRef
88
88
$ acceptsNamedArguments = $ phpDoc ->acceptsNamedArguments ();
89
89
}
90
90
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
+
91
101
$ variantsByType = ['positional ' => []];
92
102
foreach ($ functionSignaturesResult as $ signatureType => $ functionSignatures ) {
93
103
foreach ($ functionSignatures ?? [] as $ functionSignature ) {
94
104
$ variantsByType [$ signatureType ][] = new FunctionVariantWithPhpDocs (
95
105
TemplateTypeMap::createEmpty (),
96
106
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 ();
98
109
$ type = $ parameterSignature ->getType ();
99
110
100
111
$ phpDocType = null ;
@@ -113,7 +124,7 @@ public function findFunctionReflection(string $functionName): ?NativeFunctionRef
113
124
}
114
125
115
126
return new NativeParameterWithPhpDocsReflection (
116
- $ parameterSignature -> getName () ,
127
+ $ name ,
117
128
$ parameterSignature ->isOptional (),
118
129
TypehintHelper::decideType ($ type , $ phpDocType ),
119
130
$ phpDocType ?? new MixedType (),
@@ -124,6 +135,7 @@ public function findFunctionReflection(string $functionName): ?NativeFunctionRef
124
135
$ phpDoc !== null ? NativeFunctionReflectionProvider::getParamOutTypeFromPhpDoc ($ parameterSignature ->getName (), $ phpDoc ) : null ,
125
136
$ immediatelyInvokedCallable ,
126
137
$ closureThisType ,
138
+ isset ($ pureUnlessCallableIsImpureParameters [$ name ]) && $ pureUnlessCallableIsImpureParameters [$ name ],
127
139
);
128
140
}, $ functionSignature ->getParameters ()),
129
141
$ functionSignature ->isVariadic (),
@@ -134,8 +146,8 @@ public function findFunctionReflection(string $functionName): ?NativeFunctionRef
134
146
}
135
147
}
136
148
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 ' ]);
139
151
} else {
140
152
$ hasSideEffects = TrinaryLogic::createMaybe ();
141
153
}
0 commit comments