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

lint/php-8.4/prefer-array-find

In the modernize set. Safe fix. Gated by php-8.4.

What it does

Replace foreach loops with array_find(), array_find_key(), array_any() or array_all() (PHP 8.4).

Configuration

[lint.rules]
"php-8.4/prefer-array-find" = "error"

To skip it in some files or lines, add an override or an ignore comment.

Options

Name Type Allowed values Default Upstream name
functions list array-all, array-any, array-find, array-find-key ["array-all", "array-any", "array-find", "array-find-key"] None (Pun’s own)

Replaces

Merged rules

These old IDs are now this rule. A config that still names one stops with an error. See merged rules.

  • lint/php-8.4/prefer-array-all
  • lint/php-8.4/prefer-array-any
  • lint/php-8.4/prefer-array-find-key

More lint/php-8.4 rules · Edit this page

Last updated on

Was this page helpful?