Skip to content

Commit 8b15495

Browse files
ArshidArshid
authored andcommitted
/DowngradeMbStrContainsRector
1 parent 2402d39 commit 8b15495

18 files changed

+475
-1
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
namespace Rector\Tests\DowngradePhp80\Rector\FuncCall\DowngradeMbStrContainsRector\Fixture;
4+
5+
class Fixture
6+
{
7+
public function run()
8+
{
9+
$isMatch = str_contains('😊abc', 'a');
10+
}
11+
}
12+
13+
?>
14+
-----
15+
<?php
16+
17+
namespace Rector\Tests\DowngradePhp80\Rector\FuncCall\DowngradeMbStrContainsRector\Fixture;
18+
19+
class Fixture
20+
{
21+
public function run()
22+
{
23+
$isMatch = mb_strpos('😊abc', 'a') !== false;
24+
}
25+
}
26+
27+
?>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
namespace Rector\Tests\DowngradePhp80\Rector\FuncCall\DowngradeMbStrContainsRector\Fixture;
4+
5+
class IdenticalStrpos
6+
{
7+
public function run()
8+
{
9+
$isMatch = !str_contains('abc😊', 'a');
10+
}
11+
}
12+
13+
?>
14+
-----
15+
<?php
16+
17+
namespace Rector\Tests\DowngradePhp80\Rector\FuncCall\DowngradeMbStrContainsRector\Fixture;
18+
19+
class IdenticalStrpos
20+
{
21+
public function run()
22+
{
23+
$isMatch = mb_strpos('abc😊', 'a') === false;
24+
}
25+
}
26+
27+
?>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
namespace Rector\Tests\DowngradePhp80\Rector\FuncCall\DowngradeMbStrContainsRector\Fixture;
4+
5+
class IdenticalStrstr
6+
{
7+
public function run()
8+
{
9+
$isMatch = !str_contains('abc', 'a');
10+
}
11+
}
12+
13+
?>
14+
-----
15+
<?php
16+
17+
namespace Rector\Tests\DowngradePhp80\Rector\FuncCall\DowngradeMbStrContainsRector\Fixture;
18+
19+
class IdenticalStrstr
20+
{
21+
public function run()
22+
{
23+
$isMatch = mb_strpos('abc', 'a') === false;
24+
}
25+
}
26+
27+
?>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
namespace Rector\Tests\DowngradePhp80\Rector\FuncCall\DowngradeMbStrContainsRector\Fixture;
4+
5+
class IdenticalStrstr
6+
{
7+
public function run()
8+
{
9+
$isMatch = !str_contains('abc', 'a');
10+
}
11+
}
12+
13+
?>
14+
-----
15+
<?php
16+
17+
namespace Rector\Tests\DowngradePhp80\Rector\FuncCall\DowngradeMbStrContainsRector\Fixture;
18+
19+
class IdenticalStrstr
20+
{
21+
public function run()
22+
{
23+
$isMatch = mb_strpos('abc', 'a') === false;
24+
}
25+
}
26+
27+
?>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
namespace Rector\Tests\DowngradePhp80\Rector\FuncCall\DowngradeMbStrContainsRector\Fixture;
4+
5+
class OffsetStrpos
6+
{
7+
public function run()
8+
{
9+
$isMatch = str_contains(mb_substr('abc', 1), 'a');
10+
}
11+
}
12+
?>
13+
-----
14+
<?php
15+
16+
namespace Rector\Tests\DowngradePhp80\Rector\FuncCall\DowngradeMbStrContainsRector\Fixture;
17+
18+
class OffsetStrpos
19+
{
20+
public function run()
21+
{
22+
$isMatch = mb_strpos('abc', 'a', 1) !== false;
23+
}
24+
}
25+
?>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
namespace Rector\Tests\DowngradePhp80\Rector\FuncCall\DowngradeMbStrContainsRector\Fixture;
4+
5+
class OffsetExpressionStrpos
6+
{
7+
public function run()
8+
{
9+
$offset = 1;
10+
$isMatch = str_contains(mb_substr('abc', $offset + 1), 'a');
11+
}
12+
}
13+
?>
14+
-----
15+
<?php
16+
17+
namespace Rector\Tests\DowngradePhp80\Rector\FuncCall\DowngradeMbStrContainsRector\Fixture;
18+
19+
class OffsetExpressionStrpos
20+
{
21+
public function run()
22+
{
23+
$offset = 1;
24+
$isMatch = mb_strpos('abc', 'a', $offset + 1) !== false;
25+
}
26+
}
27+
?>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
namespace Rector\Tests\DowngradePhp80\Rector\FuncCall\DowngradeMbStrContainsRector\Fixture;
4+
5+
class OffsetExpressionStrpos
6+
{
7+
public function run()
8+
{
9+
$offset = 1;
10+
$isMatch = str_contains(mb_substr('abc', $offset + 1), 'a');
11+
}
12+
}
13+
?>
14+
-----
15+
<?php
16+
17+
namespace Rector\Tests\DowngradePhp80\Rector\FuncCall\DowngradeMbStrContainsRector\Fixture;
18+
19+
class OffsetExpressionStrpos
20+
{
21+
public function run()
22+
{
23+
$offset = 1;
24+
$isMatch = mb_strpos('abc', 'a', $offset + 1) !== false;
25+
}
26+
}
27+
?>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
namespace Rector\Tests\DowngradePhp80\Rector\FuncCall\DowngradeMbStrContainsRector\Fixture;
4+
5+
class OffsetNegativeStrpos
6+
{
7+
public function run()
8+
{
9+
$isMatch = str_contains(mb_substr('abc', -1), 'a');
10+
}
11+
}
12+
?>
13+
-----
14+
<?php
15+
16+
namespace Rector\Tests\DowngradePhp80\Rector\FuncCall\DowngradeMbStrContainsRector\Fixture;
17+
18+
class OffsetNegativeStrpos
19+
{
20+
public function run()
21+
{
22+
$isMatch = mb_strpos('abc', 'a', -1) !== false;
23+
}
24+
}
25+
?>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
namespace Rector\Tests\DowngradePhp80\Rector\FuncCall\DowngradeMbStrContainsRector\Fixture;
4+
5+
class OffsetNegativeStrpos
6+
{
7+
public function run()
8+
{
9+
$isMatch = str_contains(mb_substr('abc', -1), 'a');
10+
}
11+
}
12+
?>
13+
-----
14+
<?php
15+
16+
namespace Rector\Tests\DowngradePhp80\Rector\FuncCall\DowngradeMbStrContainsRector\Fixture;
17+
18+
class OffsetNegativeStrpos
19+
{
20+
public function run()
21+
{
22+
$isMatch = mb_strpos('abc', 'a', -1) !== false;
23+
}
24+
}
25+
?>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
namespace Rector\Tests\DowngradePhp80\Rector\FuncCall\DowngradeMbStrContainsRector\Fixture;
4+
5+
class OffsetStrpos
6+
{
7+
public function run()
8+
{
9+
$isMatch = str_contains(mb_substr('abc', 1), 'a');
10+
}
11+
}
12+
?>
13+
-----
14+
<?php
15+
16+
namespace Rector\Tests\DowngradePhp80\Rector\FuncCall\DowngradeMbStrContainsRector\Fixture;
17+
18+
class OffsetStrpos
19+
{
20+
public function run()
21+
{
22+
$isMatch = mb_strpos('abc', 'a', 1) !== false;
23+
}
24+
}
25+
?>

0 commit comments

Comments
 (0)