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

format/control-flow/yoda

In the format-laravel preset. Safe fix.

What it does

Write conditions in Yoda style (true), non-Yoda style (['equal' => false, 'identical' => false, 'less_and_greater' => false]) or ignore those conditions (null) based on configuration.

Configuration

[format.rules]
"control-flow/yoda" = true

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

Options

Name Type Allowed values Default Upstream name
always-move-variable bool Any false always_move_variable
equal bool Any true equal
identical bool Any true identical
less-and-greater bool Any "ignore" less_and_greater

Replaces

More format/control-flow rules · Edit this page

Last updated on

Was this page helpful?