Skip to content

Conversation

@samsonasik
Copy link
Member

@samsonasik samsonasik commented Oct 10, 2025

Ref rectorphp/rector#9430

I will check if it can be reproduced at https://github.com/rectorphp/rector-compat-tests

@X-Coder264 could you verify by manual patch of this into vendor/rector/rector/preload.php ? Better if you can provide minimal reproducible repo so we can properly test it :)

@samsonasik samsonasik changed the title Handle crash redeclare isPHPStanTestPreloaded() method Handle crash redeclare isPHPStanTestPreloaded() function Oct 10, 2025
@samsonasik
Copy link
Member Author

define early seems also needed when check function_exists(), avoid crash

Call to undefined function isPHPStanTestPreloaded()

232dcab

@samsonasik
Copy link
Member Author

@TomasVotruba I am thinking that the isPHPStanTestPreloaded() can just be removed, and use directly check:

if (defined('PHPUNIT_COMPOSER_INSTALL') 
     && class_exists(PHPStanTestCase::class, false)
     && interface_exists(Node::class, false)) {
     return;
}

wdyt?

@samsonasik
Copy link
Member Author

@TomasVotruba I created alternative PR for it, which should be safer:

@TomasVotruba
Copy link
Member

As I stated, let's isolate the reproduced first, to avoid back and forth guessing PRs. Wait with PRs before we have failing test in https://github.com/rectorphp/rector-compat-tests

@samsonasik
Copy link
Member Author

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.

3 participants