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

Trigger Rectify #4997

Merged
merged 2 commits into from
Sep 11, 2023
Merged

Trigger Rectify #4997

merged 2 commits into from
Sep 11, 2023

Conversation

samsonasik
Copy link
Member

Trigger rectify from changes:

@TomasVotruba TomasVotruba self-requested a review as a code owner September 11, 2023 15:54
@@ -74,8 +74,11 @@ private function traverseForType(array $stmts, callable $callable, int $desiredT

$callable($useUse, $name);
}

return null;
Copy link
Contributor

@staabm staabm Sep 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thats wrong. I intentionally left that out

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since our logic here already traverses into such nodes, the traverser itself doesn't need todo it a second time

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, reverted, I will test in other projects :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@staabm I am testing it, it cause overlapped type

diff --git a/rules/CodingStyle/ClassNameImport/ClassNameImportSkipper.php b/rules/CodingStyle/ClassNameImport/ClassNameImportSkipper.php
index 7e3b49fa0f..25e5d6c605 100644
--- a/rules/CodingStyle/ClassNameImport/ClassNameImportSkipper.php
+++ b/rules/CodingStyle/ClassNameImport/ClassNameImportSkipper.php
@@ -67,7 +67,7 @@ final class ClassNameImportSkipper
     public function isFoundInUse(Name $name, array $uses): bool
     {
         $stringName = $name->toString();
-        $nameLastName = strtolower($name->getLast());
+        $nameLastName = strtolower((string) $name->getLast());

when changing import type :), so return null seems needed, I will. create separate PR :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

double run seems resolve it:

1) rules/CodingStyle/ClassNameImport/ClassNameImportSkipper.php:66

    ---------- begin diff ----------
@@ @@
     public function isFoundInUse(Name $name, array $uses): bool
     {
         $stringName = $name->toString();
-        $nameLastName = strtolower((string) $name->getLast());
+        $nameLastName = strtolower($name->getLast());

         foreach ($uses as $use) {
             $prefix = $this->useImportsResolver->resolvePrefix($use);
    ----------- end diff -----------

Applied rules:
 * RecastingRemovalRector

I guess it is a glitch somewhere, actually, return null is fine, as the Use_ and GroupUse actually has limited attributes.

Copy link
Contributor

@staabm staabm Sep 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for testing.

would a return null resolve these problems?

Copy link
Member Author

@samsonasik samsonasik Sep 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't 😁

It probably another problem with detecting type as mixed/errortype when docblock changed, probably related with @TomasVotruba change on:

which type now immediatelly got mixed when docblock changed

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks 🙏

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@samsonasik samsonasik merged commit 9e7367c into main Sep 11, 2023
@samsonasik samsonasik deleted the trigger-rectify-2 branch September 11, 2023 16:04
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