Skip to content

Commit c5695e0

Browse files
committed
[DowngradePhp81] Handle version_compare() in If_ on DowngradeHashAlgorithmXxHashRector
1 parent 9ae8fea commit c5695e0

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
namespace Rector\Tests\DowngradePhp81\Rector\FuncCall\DowngradeHashAlgorithmXxHash\Fixture;
4+
5+
final class SkipCheckVersionCompareOnIf
6+
{
7+
public function run_v()
8+
{
9+
if ( version_compare( PHP_VERSION, '8.1', '>=' ) ) {
10+
return hash( 'xxh128', $value );
11+
}
12+
13+
return hash( 'md4', $value );
14+
}
15+
16+
public function run_v2()
17+
{
18+
if (version_compare( PHP_VERSION, '8.1', '>=' ) ) {
19+
$hash = hash( 'xxh128', $value );
20+
} else {
21+
$hash = hash( 'md4', $value );
22+
}
23+
24+
return $hash;
25+
}
26+
}

0 commit comments

Comments
 (0)