Skip to content

Commit ef7f48f

Browse files
committed
tidy up
1 parent 3c356ac commit ef7f48f

File tree

9 files changed

+24
-105
lines changed

9 files changed

+24
-105
lines changed

rules-tests/DowngradePhp81/Rector/FuncCall/DowngradeHashAlgorithmXxHash/Fixture/fixture_named_arguments.php.inc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Rector\Tests\DowngradePhp81\Rector\FuncCall\DowngradeHashAlgorithmXxHash\Fixture;
44

5-
class Fixture
5+
final class FixtureNamedArguments
66
{
77
public function run()
88
{
@@ -16,7 +16,7 @@ class Fixture
1616

1717
namespace Rector\Tests\DowngradePhp81\Rector\FuncCall\DowngradeHashAlgorithmXxHash\Fixture;
1818

19-
class Fixture
19+
final class FixtureNamedArguments
2020
{
2121
public function run()
2222
{

rules-tests/DowngradePhp81/Rector/FuncCall/DowngradeHashAlgorithmXxHash/Fixture/fixture_named_arguments_false_order.php.inc

Lines changed: 0 additions & 27 deletions
This file was deleted.

rules-tests/DowngradePhp81/Rector/FuncCall/DowngradeHashAlgorithmXxHash/Fixture/fixture_xxh128.php.inc

Lines changed: 0 additions & 27 deletions
This file was deleted.

rules-tests/DowngradePhp81/Rector/FuncCall/DowngradeHashAlgorithmXxHash/Fixture/fixture_xxh32.php.inc

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,15 @@
22

33
namespace Rector\Tests\DowngradePhp81\Rector\FuncCall\DowngradeHashAlgorithmXxHash\Fixture;
44

5-
class Fixture
5+
final class FixtureXxh32
66
{
77
public function run()
88
{
9-
return hash('xxh32', 'some-data-to-hash');
9+
$value = hash('xxh32', 'some-data-to-hash');
10+
11+
$value = hash('xxh64', 'some-data-to-hash');
12+
13+
$value = hash('xxh128', 'some-data-to-hash');
1014
}
1115
}
1216

@@ -16,11 +20,15 @@ class Fixture
1620

1721
namespace Rector\Tests\DowngradePhp81\Rector\FuncCall\DowngradeHashAlgorithmXxHash\Fixture;
1822

19-
class Fixture
23+
final class FixtureXxh32
2024
{
2125
public function run()
2226
{
23-
return hash('md5', 'some-data-to-hash');
27+
$value = hash('md5', 'some-data-to-hash');
28+
29+
$value = hash('md5', 'some-data-to-hash');
30+
31+
$value = hash('md5', 'some-data-to-hash');
2432
}
2533
}
2634

rules-tests/DowngradePhp81/Rector/FuncCall/DowngradeHashAlgorithmXxHash/Fixture/fixture_xxh64.php.inc

Lines changed: 0 additions & 27 deletions
This file was deleted.

rules-tests/DowngradePhp81/Rector/FuncCall/DowngradeHashAlgorithmXxHash/Fixture/skip_check_version_compare_ternary.php.inc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,12 @@ final class SkipCheckVersionCompareTernary
66
{
77
public function run_v()
88
{
9-
return version_compare(PHP_VERSION, '8.1','>=')
9+
$value = version_compare(PHP_VERSION, '8.1','>=')
1010
? hash( 'xxh128', $value )
1111
: hash( 'md4', $value );
12+
13+
$value = version_compare(PHP_VERSION, '8.1','<')
14+
? hash( 'md4', $value )
15+
: hash( 'xxh128', $value );
1216
}
1317
}

rules-tests/DowngradePhp81/Rector/FuncCall/DowngradeHashAlgorithmXxHash/Fixture/skip_check_version_compare_ternary2.php.inc

Lines changed: 0 additions & 13 deletions
This file was deleted.

rules/DowngradePhp82/Rector/FuncCall/DowngradeIteratorCountToArrayRector.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,16 +68,18 @@ function test(array|Traversable $data) {
6868

6969
/**
7070
* @param Ternary|FuncCall $node
71-
* @return null|FuncCall|NodeVisitor::DONT_TRAVERSE_CHILDREN
71+
* @return null|FuncCall
7272
*/
73-
public function refactor(Node $node): null|FuncCall|int
73+
public function refactor(Node $node): null|FuncCall
7474
{
7575
if ($node instanceof Ternary) {
7676
$hasIsArrayCheck = (bool) $this->betterNodeFinder->findFirst(
7777
$node,
7878
fn (Node $subNode): bool => $subNode instanceof FuncCall && $this->isName($subNode, 'is_array')
7979
);
8080

81+
// get tgype...
82+
8183
if ($hasIsArrayCheck) {
8284
return NodeVisitor::DONT_TRAVERSE_CHILDREN;
8385
}

rules/DowngradePhp83/Rector/FuncCall/DowngradeJsonValidateRector.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,7 @@ public function getRuleDefinition(): RuleDefinition
8484
*/
8585
public function getNodeTypes(): array
8686
{
87-
$stmtsAware = NodeGroup::STMTS_AWARE;
88-
return [...$stmtsAware, Switch_::class, Return_::class, Expression::class, Echo_::class];
87+
return [...NodeGroup::STMTS_AWARE, Switch_::class, Return_::class, Expression::class, Echo_::class];
8988
}
9089

9190
/**

0 commit comments

Comments
 (0)