Skip to content

Conversation

@samsonasik
Copy link
Member

Reverts #7446 (review)

@TomasVotruba There is no need php version check, as when rector run on php 7.x, it will be result string|false on substr. Just need to skip RecastingRemovalRector on ClassLikeNameClassNameImportSkipVoter for now.

@samsonasik samsonasik merged commit d57b45e into main Oct 8, 2025
50 checks passed
@samsonasik samsonasik deleted the skip-skiper branch October 8, 2025 06:42
@TomasVotruba
Copy link
Member

Wait with fast merges for this substr issue, I need to review them first :)

@samsonasik
Copy link
Member Author

This is the original issue arise, without skip on rector.php, when run:

bin/rector

the RecastingRemovalRector will remove (string) cast on rules/CodingStyle/ClassNameImport/ClassNameImportSkipVoter/ClassLikeNameClassNameImportSkipVoter.php

-        $subClassName = (string) substr(
+        $subClassName = substr(
            $fullyQualifiedObjectType->getClassName(),
            0,
            -strlen($fullyQualifiedObjectType->getShortName()) - 1
        );

as we are using php 8.2 when running rectify.

$subClassName = (string) substr(
$fullyQualifiedObjectType->getClassName(),
0,
-strlen($fullyQualifiedObjectType->getShortName()) - 1
);

@TomasVotruba
Copy link
Member

Yes, that's expected. We need to figure out, why it's returning false in the first place. That's the real bug we're having :)

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