Skip to content

Commit

Permalink
skip direct square bracket as delimiter
Browse files Browse the repository at this point in the history
  • Loading branch information
samsonasik committed Jun 10, 2024
1 parent fcb905c commit 4136ed5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace Rector\Tests\CodeQuality\Rector\FuncCall\SimplifyRegexPatternRector\Fixture;

use Nette\Utils\Strings;

class SkipDirectSquareBracketAsDelimiter
{
public function run($value)
{
preg_match('[0-9]', $value);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ public function refactor(Node $node): ?Node
continue;
}

if ($complexPattern === $node->value) {
continue;
}

$node->value = $simplifiedValue;
return $node;
}
Expand Down

0 comments on commit 4136ed5

Please sign in to comment.