File tree Expand file tree Collapse file tree 1 file changed +55
-0
lines changed
tests/PHPStan/Rules/Regexp Expand file tree Collapse file tree 1 file changed +55
-0
lines changed Original file line number Diff line number Diff line change @@ -276,4 +276,59 @@ public function testValidRegexPatternAfter73(): void
276
276
);
277
277
}
278
278
279
+ /**
280
+ * @dataProvider dataArrayShapePatterns
281
+ */
282
+ public function testArrayShapePatterns (string $ file , array $ errors ): void
283
+ {
284
+ $ this ->analyse (
285
+ [$ file ],
286
+ $ errors
287
+ );
288
+ }
289
+
290
+ public function dataArrayShapePatterns (): iterable
291
+ {
292
+ yield [
293
+ __DIR__ . '/../../Analyser/nsrt/preg_match_all_shapes.php ' ,
294
+ []
295
+ ];
296
+ yield [
297
+ __DIR__ . '/../../Analyser/nsrt/preg_match_php7.php ' ,
298
+ []
299
+ ];
300
+ yield [
301
+ __DIR__ . '/../../Analyser/nsrt/preg_match_php8.php ' ,
302
+ []
303
+ ];
304
+
305
+ yield [
306
+ __DIR__ . '/../../Analyser/nsrt/preg_match_shapes.php ' ,
307
+ [
308
+ [
309
+ "Regex pattern is invalid: Unknown modifier 'y' in pattern: /(foo)(bar)(baz)/xyz " ,
310
+ 124
311
+ ]
312
+ ]
313
+ ];
314
+
315
+ yield [
316
+ __DIR__ . '/../../Analyser/nsrt/preg_match_shapes_php80.php ' ,
317
+ []
318
+ ];
319
+ yield [
320
+ __DIR__ . '/../../Analyser/nsrt/preg_match_shapes_php82.php ' ,
321
+ []
322
+ ];
323
+
324
+ yield [
325
+ __DIR__ . '/../../Analyser/nsrt/preg_replace_callback_shapes.php ' ,
326
+ []
327
+ ];
328
+ yield [
329
+ __DIR__ . '/../../Analyser/nsrt/preg_replace_callback_shapes-php72.php ' ,
330
+ []
331
+ ];
332
+ }
333
+
279
334
}
You can’t perform that action at this time.
0 commit comments