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

New ExtensionPathRector to replace ExtensionPathBase #244

Merged
merged 1 commit into from
Aug 22, 2023

Conversation

bbrala
Copy link
Collaborator

@bbrala bbrala commented Aug 22, 2023

Description

New ExtensionPathRector to replace ExtensionPathBase

To Test

  • Add steps to test this feature

Drupal.org issue

Provide a link to the issue from https://www.drupal.org/project/rector/issues. If no issue exists, please create one and link to this PR.

@bbrala bbrala requested a review from mglaman August 22, 2023 09:08
@bbrala
Copy link
Collaborator Author

bbrala commented Aug 22, 2023

Please review, the merge conflict is in the use statements, which will move when earlier PR's are merged. These do not impact the change really. They are just annoying to deal with when doing multiple PR's.

$extensionType = $extensionTypeValueType->getValue();
}

if (in_array($extensionType, [
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it possible $extensionType is not a string here? So !is_string in case the constant string value couldn't be detected, such as PHPStan considering it as a union (I don't know how or why.)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't know, i've not audited the code in the Rectors. There might be an edge case imaginable, although i haven't really seen any feedback on this change in any of the regular channels.

When searching gitlab i see this comment nowhere, but since updatebot doesnt do comments this might not mean much.

Copy link
Collaborator

Choose a reason for hiding this comment

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

We must not be using PHPStan, because it would/should error on types here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Why not? Needle can be mixed and we check typesafe. So why error? We handle the non-string value "perfectly".

PHPStan is ran on this code.

Copy link
Collaborator

Choose a reason for hiding this comment

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

We're at PHPStan level 1

parameters:
	level: 1

We can merge as is. It'd probably never error, but it could. We can fix later once PHPStan is bumped up

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ah, oops. Yeah that is not very helpfull then :x

@bbrala bbrala requested a review from mglaman August 22, 2023 12:06
@bbrala bbrala force-pushed the feature/extention-path-base-rector branch from 7456ad2 to c2b5821 Compare August 22, 2023 13:20
Copy link
Collaborator

@mglaman mglaman left a comment

Choose a reason for hiding this comment

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

Approving. It works. There is a possible edge case bug, but let's reduce the total number lines of code in this package and then kick up PHPStan level to find these things automatically.

@bbrala bbrala merged commit 839cca2 into main Aug 22, 2023
@bbrala bbrala deleted the feature/extention-path-base-rector branch September 4, 2023 13:53
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