From be448f1e31d001ed3e2587c887952c70111dc91b Mon Sep 17 00:00:00 2001 From: Arnaud De Abreu <138440879+arnaud-deabreu@users.noreply.github.com> Date: Mon, 4 Dec 2023 17:15:12 +0100 Subject: [PATCH] feat: Support `mb_str_pad` function in `mb_str_functions` rule (#7499) --- src/Fixer/Alias/MbStrFunctionsFixer.php | 4 ++++ tests/Fixer/Alias/MbStrFunctionsFixerTest.php | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/Fixer/Alias/MbStrFunctionsFixer.php b/src/Fixer/Alias/MbStrFunctionsFixer.php index 6dd62f49845..a06a1ea60bd 100644 --- a/src/Fixer/Alias/MbStrFunctionsFixer.php +++ b/src/Fixer/Alias/MbStrFunctionsFixer.php @@ -69,6 +69,10 @@ public function __construct() { parent::__construct(); + if (\PHP_VERSION_ID >= 8_03_00) { + self::$functionsMap['str_pad'] = ['alternativeName' => 'mb_str_pad', 'argumentCount' => [1, 2, 3, 4]]; + } + $this->functions = array_filter( self::$functionsMap, static fn (array $mapping): bool => (new \ReflectionFunction($mapping['alternativeName']))->isInternal() diff --git a/tests/Fixer/Alias/MbStrFunctionsFixerTest.php b/tests/Fixer/Alias/MbStrFunctionsFixerTest.php index e36b612c559..11fe9d800fe 100644 --- a/tests/Fixer/Alias/MbStrFunctionsFixerTest.php +++ b/tests/Fixer/Alias/MbStrFunctionsFixerTest.php @@ -79,5 +79,9 @@ public function strtolower($a); '= 8_03_00) { + yield ['