Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
"phpunit/phpunit": "^11.5",
"rector/rector-src": "dev-main",
"symplify/easy-coding-standard": "^12.3",
"symplify/phpstan-extensions": "^12.0",
"symplify/phpstan-rules": "^14.9",
"symplify/rule-doc-generator": "^12.2",
"symplify/vendor-patches": "^11.5",
"tomasvotruba/class-leak": "^1.0",
Expand Down
49 changes: 38 additions & 11 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# to be enabled later once rector upgraded to use phpstan v2
# includes:
# - vendor/symplify/phpstan-rules/config/symplify-rules.neon
# - vendor/symplify/phpstan-rules/config/rector-rules.neon
includes:
- vendor/symplify/phpstan-rules/config/symplify-rules.neon
- vendor/symplify/phpstan-rules/config/rector-rules.neon

parameters:
level: 8
errorFormat: symplify

reportUnmatchedIgnoredErrors: false

Expand Down Expand Up @@ -57,16 +57,16 @@ parameters:
- '#Doing instanceof PHPStan\\Type\\.+ is error\-prone and deprecated#'

# phpstan instanceof
-
identifier: phpstanApi.instanceofAssumption

-
identifier: phpstanApi.varTagAssumption
- identifier: phpstanApi.instanceofAssumption
- identifier: phpstanApi.varTagAssumption
- '#Asking about instanceof PHPStan\\.* is not covered by backward compatibility promise#'

-
identifier: argument.type

- '#Asking about instanceof PHPStan\\.* is not covered by backward compatibility promise#'
paths:
- rules/DowngradePhp85/Rector/StmtsAwareInterface/DowngradePipeOperatorRector.php
- rules/DowngradePhp85/Rector/Class_/DowngradeFinalPropertyPromotionRector.php
- rules/DowngradePhp80/Rector/New_/DowngradeArbitraryExpressionsSupportRector.php

# false positive intanceof in OR usage
-
Expand All @@ -76,3 +76,30 @@ parameters:
-
identifier: deadCode.unreachable
path: rules/DowngradePhp80/Rector/NullsafeMethodCall/DowngradeNullsafeToTernaryOperatorRector.php

# cached printed nodes
-
identifier: rector.noPropertyNodeAssign
paths:
- rules/DowngradePhp83/Rector/FuncCall/DowngradeJsonValidateRector.php
- rules/DowngradePhp81/Rector/FuncCall/DowngradeArrayIsListRector.php
- rules/DowngradePhp72/Rector/FuncCall/DowngradeStreamIsattyRector.php

# already registered in PHP 8.1 set
-
identifier: rector.upgradeDowngradeRegisteredInSet
path: rules/DowngradePhp74/Rector/Array_/DowngradeArraySpreadRector.php

# valid stmts property check
-
identifier: symplify.forbiddenFuncCall
path: rules/DowngradePhp73/Rector/FuncCall/DowngradeArrayKeyFirstLastRector.php

# false positive
-
identifier: symplify.seeAnnotationToTest
path: rules/DowngradePhp85/Rector/StmtsAwareInterface/DowngradePipeOperatorRector.php

-
identifier: rector.noIntegerRefactorReturn
path: rules/DowngradePhp82/Rector/FuncCall/DowngradeIteratorCountToArrayRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

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

class Fixture
final class FixtureConstant
{
public function run()
{
Expand All @@ -16,7 +16,7 @@ class Fixture

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

class Fixture
final class FixtureConstant
{
public function run()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

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

class Fixture
final class FixtureNamedArguments
{
public function run()
{
Expand All @@ -16,7 +16,7 @@ class Fixture

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

class Fixture
final class FixtureNamedArguments
{
public function run()
{
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@

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

class Fixture
final class FixtureXxh32
{
public function run()
{
return hash('xxh32', 'some-data-to-hash');
$value = hash('xxh32', 'some-data-to-hash');

$value = hash('xxh64', 'some-data-to-hash');

$value = hash('xxh128', 'some-data-to-hash');
}
}

Expand All @@ -16,11 +20,15 @@ class Fixture

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

class Fixture
final class FixtureXxh32
{
public function run()
{
return hash('md5', 'some-data-to-hash');
$value = hash('md5', 'some-data-to-hash');

$value = hash('md5', 'some-data-to-hash');

$value = hash('md5', 'some-data-to-hash');
}
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@ final class SkipCheckVersionCompareTernary
{
public function run_v()
{
return version_compare(PHP_VERSION, '8.1','>=')
$value = version_compare(PHP_VERSION, '8.1','>=')
? hash( 'xxh128', $value )
: hash( 'md4', $value );

$value = version_compare(PHP_VERSION, '8.1','<')
? hash( 'md4', $value )
: hash( 'xxh128', $value );
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ public function run($items)
*/
public function getNodeTypes(): array
{
$stmtsAware = NodeGroup::STMTS_AWARE;
return [...$stmtsAware, Switch_::class, Return_::class, Expression::class, Echo_::class];
return [...NodeGroup::STMTS_AWARE, Switch_::class, Return_::class, Expression::class, Echo_::class];
}

/**
Expand Down
Loading