@@ -184,80 +184,54 @@ public function getSignatureMap(): array
184
184
$ signatureMap = array_change_key_case ($ signatureMap , CASE_LOWER );
185
185
186
186
if ($ this ->stricterFunctionMap ) {
187
- $ stricterFunctionMap = require __DIR__ . '/../../../resources/functionMap_bleedingEdge.php ' ;
188
- if (!is_array ($ stricterFunctionMap )) {
189
- throw new ShouldNotHappenException ('Signature map could not be loaded. ' );
190
- }
191
-
192
- $ signatureMap = $ this ->computeSignatureMap ($ signatureMap , $ stricterFunctionMap );
187
+ $ signatureMap = $ this ->computeSignatureMapFile ($ signatureMap , __DIR__ . '/../../../resources/functionMap_bleedingEdge.php ' );
193
188
}
194
189
195
190
if ($ this ->phpVersion ->getVersionId () >= 70400 ) {
196
- $ php74MapDelta = require __DIR__ . '/../../../resources/functionMap_php74delta.php ' ;
197
- if (!is_array ($ php74MapDelta )) {
198
- throw new ShouldNotHappenException ('Signature map could not be loaded. ' );
199
- }
200
-
201
- $ signatureMap = $ this ->computeSignatureMap ($ signatureMap , $ php74MapDelta );
191
+ $ signatureMap = $ this ->computeSignatureMapFile ($ signatureMap , __DIR__ . '/../../../resources/functionMap_php74delta.php ' );
202
192
}
203
193
204
194
if ($ this ->phpVersion ->getVersionId () >= 80000 ) {
205
- $ php80MapDelta = require __DIR__ . '/../../../resources/functionMap_php80delta.php ' ;
206
- if (!is_array ($ php80MapDelta )) {
207
- throw new ShouldNotHappenException ('Signature map could not be loaded. ' );
208
- }
209
-
210
- $ signatureMap = $ this ->computeSignatureMap ($ signatureMap , $ php80MapDelta );
195
+ $ signatureMap = $ this ->computeSignatureMapFile ($ signatureMap , __DIR__ . '/../../../resources/functionMap_php80delta.php ' );
211
196
212
197
if ($ this ->stricterFunctionMap ) {
213
- $ php80StricterFunctionMapDelta = require __DIR__ . '/../../../resources/functionMap_php80delta_bleedingEdge.php ' ;
214
- if (!is_array ($ php80StricterFunctionMapDelta )) {
215
- throw new ShouldNotHappenException ('Signature map could not be loaded. ' );
216
- }
217
-
218
- $ signatureMap = $ this ->computeSignatureMap ($ signatureMap , $ php80StricterFunctionMapDelta );
198
+ $ signatureMap = $ this ->computeSignatureMapFile ($ signatureMap , __DIR__ . '/../../../resources/functionMap_php80delta_bleedingEdge.php ' );
219
199
}
220
200
}
221
201
222
202
if ($ this ->phpVersion ->getVersionId () >= 80100 ) {
223
- $ php81MapDelta = require __DIR__ . '/../../../resources/functionMap_php81delta.php ' ;
224
- if (!is_array ($ php81MapDelta )) {
225
- throw new ShouldNotHappenException ('Signature map could not be loaded. ' );
226
- }
227
-
228
- $ signatureMap = $ this ->computeSignatureMap ($ signatureMap , $ php81MapDelta );
203
+ $ signatureMap = $ this ->computeSignatureMapFile ($ signatureMap , __DIR__ . '/../../../resources/functionMap_php81delta.php ' );
229
204
}
230
205
231
206
if ($ this ->phpVersion ->getVersionId () >= 80200 ) {
232
- $ php82MapDelta = require __DIR__ . '/../../../resources/functionMap_php82delta.php ' ;
233
- if (!is_array ($ php82MapDelta )) {
234
- throw new ShouldNotHappenException ('Signature map could not be loaded. ' );
235
- }
236
-
237
- $ signatureMap = $ this ->computeSignatureMap ($ signatureMap , $ php82MapDelta );
207
+ $ signatureMap = $ this ->computeSignatureMapFile ($ signatureMap , __DIR__ . '/../../../resources/functionMap_php82delta.php ' );
238
208
}
239
209
240
210
if ($ this ->phpVersion ->getVersionId () >= 80300 ) {
241
- $ php83MapDelta = require __DIR__ . '/../../../resources/functionMap_php83delta.php ' ;
242
- if (!is_array ($ php83MapDelta )) {
243
- throw new ShouldNotHappenException ('Signature map could not be loaded. ' );
244
- }
245
-
246
- $ signatureMap = $ this ->computeSignatureMap ($ signatureMap , $ php83MapDelta );
211
+ $ signatureMap = $ this ->computeSignatureMapFile ($ signatureMap , __DIR__ . '/../../../resources/functionMap_php83delta.php ' );
247
212
}
248
213
249
214
if ($ this ->phpVersion ->getVersionId () >= 80400 ) {
250
- $ php84MapDelta = require __DIR__ . '/../../../resources/functionMap_php84delta.php ' ;
251
- if (!is_array ($ php84MapDelta )) {
252
- throw new ShouldNotHappenException ('Signature map could not be loaded. ' );
253
- }
254
-
255
- $ signatureMap = $ this ->computeSignatureMap ($ signatureMap , $ php84MapDelta );
215
+ $ signatureMap = $ this ->computeSignatureMapFile ($ signatureMap , __DIR__ . '/../../../resources/functionMap_php84delta.php ' );
256
216
}
257
217
258
218
return self ::$ signatureMaps [$ cacheKey ] = $ signatureMap ;
259
219
}
260
220
221
+ /**
222
+ * @param array<string, mixed> $signatureMap
223
+ * @return array<string, mixed>
224
+ */
225
+ private function computeSignatureMapFile (array $ signatureMap , string $ file ): array
226
+ {
227
+ $ signatureMapDelta = include $ file ;
228
+ if (!is_array ($ signatureMapDelta )) {
229
+ throw new ShouldNotHappenException (sprintf ('Signature map file "%s" could not be loaded. ' , $ file ));
230
+ }
231
+
232
+ return $ this ->computeSignatureMap ($ signatureMap , $ signatureMapDelta );
233
+ }
234
+
261
235
/**
262
236
* @param array<string, mixed> $signatureMap
263
237
* @param array<string, array<string, mixed>> $delta
0 commit comments