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

lint/refactor/prefer-constant

In the coding-style set. Unsafe fix: it can change behaviour.

What it does

Replace function calls that return a constant (php_sapi_name(), pi(), …) with the constant.

Configuration

[lint.rules]
"refactor/prefer-constant" = "error"

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

Options

Name Type Allowed values Default Upstream name
functions list get-called-class, get-class, get-class-this, php-sapi-name, phpversion, pi ["get-called-class", "get-class", "get-class-this", "php-sapi-name", "phpversion", "pi"] functions

Replaces

More lint/refactor rules · Edit this page

Last updated on

Was this page helpful?