-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Tests: Add test for numeric variables * Ignore numeric variables
- Loading branch information
1 parent
aae12c8
commit 14cb29e
Showing
3 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
VariableAnalysis/Tests/CodeAnalysis/fixtures/PregReplaceFixture.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
function doPregReplaceWithIgnoredVariable($subject) { | ||
$selector = 'good morning'; | ||
return preg_replace('/(hello \w+)/', "$selector$1", $subject, 1); | ||
} | ||
|
||
function doPregReplaceWithZeroIgnoredVariable($subject) { | ||
$selector = 'good morning'; | ||
return preg_replace('/(hello \w+)/', "$selector$0", $subject, 1); | ||
} | ||
|
||
function doPregReplaceWithNonIgnoredVariable($subject) { | ||
$selector = 'good morning'; | ||
return preg_replace('/(hello \w+)/', "$selector$bad", $subject, 1); | ||
} | ||
|
||
function doPregReplaceWithNonIgnoredAndIgnoredVariable($subject) { | ||
$selector = 'good morning'; | ||
return preg_replace('/(hello \w+)/', "$selector$1$bad", $subject, 1); | ||
} |