Skip to content
Esc
↑↓navigate↵open⌘Jpreview
On this page

lint/style/prefer-str-contains

In the modernize set. Unsafe fix: it can change behaviour.

What it does

Replace strpos() and stripos() calls with str_starts_with() or str_contains() if possible.

Configuration

[lint.rules]
"style/prefer-str-contains" = "error"

To skip it in some files, add an override or a @pun-ignore-file comment.

Options

Name Type Allowed values Default Upstream name
modernize-stripos bool Any false modernize_stripos

Replaces

More lint/style rules · Edit this page

Last updated on

Was this page helpful?