Open jivanf opened 3 days ago
Thanks for the PR @jivanf. Will merge it after all the checks pass.
In addition to this, in a future PR, we should deprecate the rule entirely, since this can now be achieved with an existing core Rector rule:
->withConfiguredRule(RemoveFuncCallRector::class, [
'dd', 'dump', 'die',
])
Linting failed, but it should be good to go now.
Is there something wrong on my end? I was able to run the test for the rule, but it fails when I run all the tests:
Test Suite Started (RectorLaravel\Tests\Rector\Class_\AnonymousMigrationsRector\AnonymousMigrationsRectorTest, 3 tests)
Test Suite Started (RectorLaravel\Tests\Rector\Class_\AnonymousMigrationsRector\AnonymousMigrationsRectorTest::test, 3 tests)
Test Preparation Started (RectorLaravel\Tests\Rector\Class_\AnonymousMigrationsRector\AnonymousMigrationsRectorTest::test#0)
Assertion Succeeded (Constraint: is empty, Value: Array &0 [])
Before Test Method Called (RectorLaravel\Tests\Rector\Class_\AnonymousMigrationsRector\AnonymousMigrationsRectorTest::setUp)
Before Test Method Finished:
- RectorLaravel\Tests\Rector\Class_\AnonymousMigrationsRector\AnonymousMigrationsRectorTest::setUp
Test Prepared (RectorLaravel\Tests\Rector\Class_\AnonymousMigrationsRector\AnonymousMigrationsRectorTest::test#0)
PHP Fatal error: Allowed memory size of 2147483648 bytes exhausted (tried to allocate 262144 bytes) in phar:///home/jivanf/development/web/forks/rector-laravel/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php on line 464
You should be OK on your side, it's probably some recent core Rector update that we should account for, and make a small release to be compatible with it.
This PR makes it possible to configure the
RemoveDumpDataDeadCodeRector
rule with an array of dump functions.dd()
anddump()
are removed by default if the rule isn't used with a configuration in order to keep the current behavior.