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
function_to_constant(php-cs-fixer, risky)