============================= Rule ``function_to_constant`` ============================= Replace core functions calls returning constants with the constants. Warning ------- Using this rule is risky ~~~~~~~~~~~~~~~~~~~~~~~~ Risky when any of the configured functions to replace are overridden. Configuration ------------- ``functions`` ~~~~~~~~~~~~~ List of function names to fix. Allowed values: a subset of ``['get_called_class', 'get_class', 'get_class_this', 'php_sapi_name', 'phpversion', 'pi']`` Default value: ``['get_called_class', 'get_class', 'get_class_this', 'php_sapi_name', 'phpversion', 'pi']`` Examples -------- Example #1 ~~~~~~~~~~ *Default* configuration. .. code-block:: diff --- Original +++ New ['get_called_class', 'get_class_this', 'phpversion']]``. .. code-block:: diff --- Original +++ New `_ - `@Symfony:risky <./../../ruleSets/SymfonyRisky.rst>`_ References ---------- - Fixer class: `PhpCsFixer\\Fixer\\LanguageConstruct\\FunctionToConstantFixer <./../../../src/Fixer/LanguageConstruct/FunctionToConstantFixer.php>`_ - Test class: `PhpCsFixer\\Tests\\Fixer\\LanguageConstruct\\FunctionToConstantFixerTest <./../../../tests/Fixer/LanguageConstruct/FunctionToConstantFixerTest.php>`_ The test class defines officially supported behaviour. Each test case is a part of our backward compatibility promise.