diff --git a/Magento2/Sniffs/Functions/DiscouragedFunctionSniff.php b/Magento2/Sniffs/Functions/DiscouragedFunctionSniff.php index 4982f8cc..13acffdc 100644 --- a/Magento2/Sniffs/Functions/DiscouragedFunctionSniff.php +++ b/Magento2/Sniffs/Functions/DiscouragedFunctionSniff.php @@ -238,5 +238,12 @@ class DiscouragedFunctionSniff extends ForbiddenFunctionsSniff '^fseek$' => 'Magento\Framework\Filesystem\DriverInterface::fileSeek()', '^feof$' => 'Magento\Framework\Filesystem\DriverInterface::endOfFile()', '^flock$' => 'Magento\Framework\Filesystem\DriverInterface::fileLock()', + '^date_sunrise$' => 'date_sun_info', + '^date_sunset$' => 'date_sun_info', + '^strptime$' => 'date_parse_from_format', + '^strftime$' => 'IntlDateFormatter::format', + '^gmstrftime$' => 'IntlDateFormatter::format', + '^(mhash|mhash_.*)$' => 'hash_*', + '^odbc_result_all$' => null ]; } diff --git a/Magento2/Tests/Functions/DiscouragedFunctionUnitTest.inc b/Magento2/Tests/Functions/DiscouragedFunctionUnitTest.inc index 0302ff56..7aaafaf1 100644 --- a/Magento2/Tests/Functions/DiscouragedFunctionUnitTest.inc +++ b/Magento2/Tests/Functions/DiscouragedFunctionUnitTest.inc @@ -482,3 +482,25 @@ fseek($file, 0); feof($fp); flock($fp, LOCK_EX); + +$test = date_sunrise(0); + +$test = date_sunset(0); + +$test = strptime('12.12.12 00:00:00', 'D, d M Y H:i:s'); + +strftime('D, d M Y H:i:s'); + +gmstrftime('D, d M Y H:i:s'); + +$test = mhash(1000, 'test_value'); + +$test = mhash_count(); + +$test = mhash_get_block_size(1000); + +$test = mhash_get_hash_name(1000); + +$test = mhash_keygen_s2k(1000, 'password', 'abccdf' , 10); + +$test = odbc_result_all('test_value', 'test_value'); diff --git a/Magento2/Tests/Functions/DiscouragedFunctionUnitTest.php b/Magento2/Tests/Functions/DiscouragedFunctionUnitTest.php index 2a30100e..dee3dd92 100644 --- a/Magento2/Tests/Functions/DiscouragedFunctionUnitTest.php +++ b/Magento2/Tests/Functions/DiscouragedFunctionUnitTest.php @@ -255,7 +255,18 @@ public function getWarningList() 478 => 1, 480 => 1, 482 => 1, - 484 => 1 + 484 => 1, + 486 => 1, + 488 => 1, + 490 => 1, + 492 => 1, + 494 => 1, + 496 => 1, + 498 => 1, + 500 => 1, + 502 => 1, + 504 => 1, + 506 => 1 ]; } }