Commit 08ca9785 authored by Andreas Fernandez's avatar Andreas Fernandez
Browse files

[TASK] Add `function_to_constant` to php-cs-fixer

php-cs-fixer has the fixer `function_to_constant` which replaces PHP
functions to their equivalent constants, which is added with this
commit.

Resolves: #97697
Releases: main
Change-Id: Ibdbfab404d2a7d35698d4afd6bb265294f7c3faf
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/74773


Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
Tested-by: Oliver Klee's avatarOliver Klee <typo3-coding@oliverklee.de>
Tested-by: Andreas Fernandez's avatarAndreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
Reviewed-by: Oliver Klee's avatarOliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: Andreas Fernandez's avatarAndreas Fernandez <a.fernandez@scripting-base.de>
parent 1e90ac9d
......@@ -58,6 +58,7 @@ return (new \PhpCsFixer\Config())
'concat_space' => ['spacing' => 'one'],
'declare_equal_normalize' => ['space' => 'none'],
'dir_constant' => true,
'function_to_constant' => ['functions' => ['get_called_class', 'get_class', 'get_class_this', 'php_sapi_name', 'phpversion', 'pi']],
'function_typehint_space' => true,
'lowercase_cast' => true,
'method_argument_space' => ['on_multiline' => 'ensure_fully_multiline'],
......
......@@ -845,7 +845,7 @@ class RteHtmlParser extends HtmlParser implements LoggerAwareInterface
$builder = $factory->build($build);
}
$sanitizer = $builder->build();
$initiator = GeneralUtility::makeInstance(SanitizerInitiator::class, get_class($this));
$initiator = GeneralUtility::makeInstance(SanitizerInitiator::class, static::class);
return $sanitizer->sanitize($content, $initiator);
}
}
......@@ -69,7 +69,7 @@ abstract class Enumeration implements TypeInterface
*/
protected static function loadValues()
{
$class = get_called_class();
$class = static::class;
if (isset(static::$enumConstants[$class])) {
return;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment