Skip to content

Commit 0e141b0

Browse files
authored
Merge pull request #119 from magento-commerce/improvements/add-php-deprecated-function
Added deprecated function PHP 8.1 to DiscouragedFunctionSniff
2 parents 837e223 + ef8bd3f commit 0e141b0

File tree

3 files changed

+41
-1
lines changed

3 files changed

+41
-1
lines changed

Magento2/Sniffs/Functions/DiscouragedFunctionSniff.php

+7
Original file line numberDiff line numberDiff line change
@@ -238,5 +238,12 @@ class DiscouragedFunctionSniff extends ForbiddenFunctionsSniff
238238
'^fseek$' => 'Magento\Framework\Filesystem\DriverInterface::fileSeek()',
239239
'^feof$' => 'Magento\Framework\Filesystem\DriverInterface::endOfFile()',
240240
'^flock$' => 'Magento\Framework\Filesystem\DriverInterface::fileLock()',
241+
'^date_sunrise$' => 'date_sun_info',
242+
'^date_sunset$' => 'date_sun_info',
243+
'^strptime$' => 'date_parse_from_format',
244+
'^strftime$' => 'IntlDateFormatter::format',
245+
'^gmstrftime$' => 'IntlDateFormatter::format',
246+
'^(mhash|mhash_.*)$' => 'hash_*',
247+
'^odbc_result_all$' => null
241248
];
242249
}

Magento2/Tests/Functions/DiscouragedFunctionUnitTest.inc

+22
Original file line numberDiff line numberDiff line change
@@ -482,3 +482,25 @@ fseek($file, 0);
482482
feof($fp);
483483

484484
flock($fp, LOCK_EX);
485+
486+
$test = date_sunrise(0);
487+
488+
$test = date_sunset(0);
489+
490+
$test = strptime('12.12.12 00:00:00', 'D, d M Y H:i:s');
491+
492+
strftime('D, d M Y H:i:s');
493+
494+
gmstrftime('D, d M Y H:i:s');
495+
496+
$test = mhash(1000, 'test_value');
497+
498+
$test = mhash_count();
499+
500+
$test = mhash_get_block_size(1000);
501+
502+
$test = mhash_get_hash_name(1000);
503+
504+
$test = mhash_keygen_s2k(1000, 'password', 'abccdf' , 10);
505+
506+
$test = odbc_result_all('test_value', 'test_value');

Magento2/Tests/Functions/DiscouragedFunctionUnitTest.php

+12-1
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,18 @@ public function getWarningList()
255255
478 => 1,
256256
480 => 1,
257257
482 => 1,
258-
484 => 1
258+
484 => 1,
259+
486 => 1,
260+
488 => 1,
261+
490 => 1,
262+
492 => 1,
263+
494 => 1,
264+
496 => 1,
265+
498 => 1,
266+
500 => 1,
267+
502 => 1,
268+
504 => 1,
269+
506 => 1
259270
];
260271
}
261272
}

0 commit comments

Comments
 (0)