========================= Rule ``modernize_strpos`` ========================= Replace ``strpos()`` and ``stripos()`` calls with ``str_starts_with()`` or ``str_contains()`` if possible. Warning ------- Using this rule is risky ~~~~~~~~~~~~~~~~~~~~~~~~ Risky if ``strpos``, ``stripos``, ``str_starts_with``, ``str_contains`` or ``strtolower`` functions are overridden. Configuration ------------- ``modernize_stripos`` ~~~~~~~~~~~~~~~~~~~~~ Whether to modernize ``stripos`` calls as well. Allowed types: ``bool`` Default value: ``false`` Examples -------- Example #1 ~~~~~~~~~~ *Default* configuration. .. code-block:: diff --- Original +++ New true]``. .. code-block:: diff --- Original +++ New `_ - `@PHP82Migration:risky <./../../ruleSets/PHP82MigrationRisky.rst>`_ - `@Symfony:risky <./../../ruleSets/SymfonyRisky.rst>`_ References ---------- - Fixer class: `PhpCsFixer\\Fixer\\Alias\\ModernizeStrposFixer <./../../../src/Fixer/Alias/ModernizeStrposFixer.php>`_ - Test class: `PhpCsFixer\\Tests\\Fixer\\Alias\\ModernizeStrposFixerTest <./../../../tests/Fixer/Alias/ModernizeStrposFixerTest.php>`_ The test class defines officially supported behaviour. Each test case is a part of our backward compatibility promise.