File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed
tests/PHPStan/Rules/Regexp Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change 1313use PHPStan \Type \Regex \RegexExpressionHelper ;
1414use function in_array ;
1515use function sprintf ;
16- use function str_contains ;
1716use function str_starts_with ;
17+ use function stripos ;
1818use function strlen ;
1919use function strpos ;
2020use function strtolower ;
@@ -128,7 +128,10 @@ private function validatePattern(string $pattern): ?string
128128 try {
129129 Strings::match ('' , $ pattern );
130130 } catch (RegexpException $ e ) {
131- if (str_contains ($ e ->getMessage (), 'UTF-8 error ' )) {
131+ if (
132+ stripos ($ e ->getMessage (), 'Compilation failed ' ) !== false
133+ && stripos ($ e ->getMessage (), 'UTF-8 ' ) !== false
134+ ) {
132135 $ patternPos = strpos ($ e ->getMessage (), 'pattern: ' );
133136 if ($ patternPos === false ) {
134137 throw new ShouldNotHappenException ();
Original file line number Diff line number Diff line change @@ -334,6 +334,10 @@ public function dataArrayShapePatterns(): iterable
334334
335335 public function testBug12629 (): void
336336 {
337+ if (PHP_VERSION_ID < 70300 ) {
338+ $ this ->markTestSkipped ('This test requires PHP >= 7.3.0 ' );
339+ }
340+
337341 $ this ->analyse (
338342 [__DIR__ . '/data/bug-12629.php ' ],
339343 [
You can’t perform that action at this time.
0 commit comments