Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make RemoveDumpDataDeadCodeRector rule configurable #258

Conversation

jivanf
Copy link
Contributor

@jivanf jivanf commented Oct 13, 2024

This PR makes it possible to configure the RemoveDumpDataDeadCodeRector rule with an array of dump functions. dd() and dump() are removed by default if the rule isn't used with a configuration in order to keep the current behavior.

@GeniJaho
Copy link
Collaborator

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',
])

@jivanf jivanf force-pushed the make-remove-dump-data-dead-code-rector-configurable branch from eda0be1 to 9635e17 Compare October 13, 2024 17:15
@jivanf
Copy link
Contributor Author

jivanf commented Oct 13, 2024

Linting failed, but it should be good to go now.

@jivanf
Copy link
Contributor Author

jivanf commented Oct 13, 2024

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

@GeniJaho
Copy link
Collaborator

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.

@GeniJaho GeniJaho merged commit 84edb4a into driftingly:main Oct 17, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants