Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,8 @@ parameters:

- '#Register "Rector\\Php81\\Rector\\ClassMethod\\NewInInitializerRector" service to "php81\.php" config set#'

- '#Register "Rector\\Php80\\Rector\\NotIdentical\\MbStrContainsRector" service to "php80\.php" config set#'

# closure detailed
- '#Method Rector\\Config\\RectorConfig\:\:singleton\(\) has parameter \$concrete with no signature specified for Closure#'

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

namespace Rector\Tests\Php80\Rector\NotIdentical\MbStrContainsRector\Fixture;

class Fixture
{
public function run()
{
$isMatch = mb_strpos('abc', 'a') !== false;
}
}

?>
-----
<?php

namespace Rector\Tests\Php80\Rector\NotIdentical\MbStrContainsRector\Fixture;

class Fixture
{
public function run()
{
$isMatch = str_contains('abc', 'a');
}
}

?>
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

namespace Rector\Tests\Php80\Rector\NotIdentical\MbStrContainsRector\Fixture;

class Fixture
{
public function run()
{
$isMatch = mb_strpos('😊abc', 'a') != false;
}
}

?>
-----
<?php

namespace Rector\Tests\Php80\Rector\NotIdentical\MbStrContainsRector\Fixture;

class Fixture
{
public function run()
{
$isMatch = str_contains('😊abc', 'a');
}
}

?>
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

namespace Rector\Tests\Php80\Rector\NotIdentical\MbStrContainsRector\Fixture;

class IdenticalStrpos
{
public function run()
{
$isMatch = mb_strpos('abc😊', 'a') === false;
}
}

?>
-----
<?php

namespace Rector\Tests\Php80\Rector\NotIdentical\MbStrContainsRector\Fixture;

class IdenticalStrpos
{
public function run()
{
$isMatch = !str_contains('abc😊', 'a');
}
}

?>
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

namespace Rector\Tests\Php80\Rector\NotIdentical\MbStrContainsRector\Fixture;

class IdenticalStrstr
{
public function run()
{
$isMatch = mb_strstr('abc', 'a') == false;
}
}

?>
-----
<?php

namespace Rector\Tests\Php80\Rector\NotIdentical\MbStrContainsRector\Fixture;

class IdenticalStrstr
{
public function run()
{
$isMatch = !str_contains('abc', 'a');
}
}

?>
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

namespace Rector\Tests\Php80\Rector\NotIdentical\MbStrContainsRector\Fixture;

class IdenticalStrstr
{
public function run()
{
$isMatch = mb_strstr('abc', 'a') === false;
}
}

?>
-----
<?php

namespace Rector\Tests\Php80\Rector\NotIdentical\MbStrContainsRector\Fixture;

class IdenticalStrstr
{
public function run()
{
$isMatch = !str_contains('abc', 'a');
}
}

?>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

namespace Rector\Tests\Php80\Rector\NotIdentical\MbStrContainsRector\Fixture;

class OffsetStrpos
{
public function run()
{
$isMatch = mb_strpos('abc', 'a', 1) != false;
}
}
?>
-----
<?php

namespace Rector\Tests\Php80\Rector\NotIdentical\MbStrContainsRector\Fixture;

class OffsetStrpos
{
public function run()
{
$isMatch = str_contains(mb_substr('abc', 1), 'a');
}
}
?>
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

namespace Rector\Tests\Php80\Rector\NotIdentical\MbStrContainsRector\Fixture;

class OffsetExpressionStrpos
{
public function run()
{
$offset = 1;
$isMatch = mb_strpos('abc', 'a', $offset + 1) != false;
}
}
?>
-----
<?php

namespace Rector\Tests\Php80\Rector\NotIdentical\MbStrContainsRector\Fixture;

class OffsetExpressionStrpos
{
public function run()
{
$offset = 1;
$isMatch = str_contains(mb_substr('abc', $offset + 1), 'a');
}
}
?>
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

namespace Rector\Tests\Php80\Rector\NotIdentical\MbStrContainsRector\Fixture;

class OffsetExpressionStrpos
{
public function run()
{
$offset = 1;
$isMatch = mb_strpos('abc', 'a', $offset + 1) !== false;
}
}
?>
-----
<?php

namespace Rector\Tests\Php80\Rector\NotIdentical\MbStrContainsRector\Fixture;

class OffsetExpressionStrpos
{
public function run()
{
$offset = 1;
$isMatch = str_contains(mb_substr('abc', $offset + 1), 'a');
}
}
?>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

namespace Rector\Tests\Php80\Rector\NotIdentical\MbStrContainsRector\Fixture;

class OffsetNegativeStrpos
{
public function run()
{
$isMatch = mb_strpos('abc', 'a', -1) != false;
}
}
?>
-----
<?php

namespace Rector\Tests\Php80\Rector\NotIdentical\MbStrContainsRector\Fixture;

class OffsetNegativeStrpos
{
public function run()
{
$isMatch = str_contains(mb_substr('abc', -1), 'a');
}
}
?>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

namespace Rector\Tests\Php80\Rector\NotIdentical\MbStrContainsRector\Fixture;

class OffsetNegativeStrpos
{
public function run()
{
$isMatch = mb_strpos('abc', 'a', -1) !== false;
}
}
?>
-----
<?php

namespace Rector\Tests\Php80\Rector\NotIdentical\MbStrContainsRector\Fixture;

class OffsetNegativeStrpos
{
public function run()
{
$isMatch = str_contains(mb_substr('abc', -1), 'a');
}
}
?>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

namespace Rector\Tests\Php80\Rector\NotIdentical\MbStrContainsRector\Fixture;

class OffsetStrpos
{
public function run()
{
$isMatch = mb_strpos('abc', 'a', 1) !== false;
}
}
?>
-----
<?php

namespace Rector\Tests\Php80\Rector\NotIdentical\MbStrContainsRector\Fixture;

class OffsetStrpos
{
public function run()
{
$isMatch = str_contains(mb_substr('abc', 1), 'a');
}
}
?>
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

namespace Rector\Tests\Php80\Rector\NotIdentical\MbStrContainsRector\Fixture;

class OffsetVariableStrpos
{
public function run()
{
$offset = 1;
$isMatch = mb_strpos('abc', 'a', $offset) != false;
}
}
?>
-----
<?php

namespace Rector\Tests\Php80\Rector\NotIdentical\MbStrContainsRector\Fixture;

class OffsetVariableStrpos
{
public function run()
{
$offset = 1;
$isMatch = str_contains(mb_substr('abc', $offset), 'a');
}
}
?>
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

namespace Rector\Tests\Php80\Rector\NotIdentical\MbStrContainsRector\Fixture;

class OffsetVariableStrpos
{
public function run()
{
$offset = 1;
$isMatch = mb_strpos('abc', 'a', $offset) !== false;
}
}
?>
-----
<?php

namespace Rector\Tests\Php80\Rector\NotIdentical\MbStrContainsRector\Fixture;

class OffsetVariableStrpos
{
public function run()
{
$offset = 1;
$isMatch = str_contains(mb_substr('abc', $offset), 'a');
}
}
?>
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

namespace Rector\Tests\Php80\Rector\NotIdentical\MbStrContainsRector\Fixture;

class OffsetVariableZeroStrpos
{
public function run()
{
$offset = 0;
$isMatch = mb_strpos('abc', 'a', $offset) != false;
}
}
?>
-----
<?php

namespace Rector\Tests\Php80\Rector\NotIdentical\MbStrContainsRector\Fixture;

class OffsetVariableZeroStrpos
{
public function run()
{
$offset = 0;
$isMatch = str_contains(mb_substr('abc', $offset), 'a');
}
}
?>
Loading
Loading