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

More type hints and return type declarations. #4963

Merged
merged 6 commits into from
Dec 31, 2021

Conversation

weitzman
Copy link
Member

No description provided.

@@ -394,7 +394,7 @@ protected function askReferencedBundles(FieldDefinitionInterface $fieldDefinitio
return $this->io()->askQuestion($question) ?: [];
}

protected function createField(): FieldConfigInterface
Copy link
Contributor

Choose a reason for hiding this comment

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

EntityInterface is less specific, this doesn't seem like a good change. Also, why are classes displayed in long notation (full namespace)? Is this a Drush code style convention?

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for the review. These changes were all done via Rector. I'm not sure why it picks less specific classes sometimes. Also I'm not sure why it uses full class namespaces, and if there is a way to avoid that. Would you have any interest in further refining this PR? If not, do you think it does more good than bad (i.e. we merge it). I could go either way, but I'm not too interested in working on it more.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure why it picks less specific classes sometimes.

Gaps in the logic I'm assuming, Rector isn't always right even though it's constantly improving.

Also I'm not sure why it uses full class namespaces, and if there is a way to avoid that.

Yes, there's a way: using the AUTO_IMPORT_NAMES option. I enabled that option and I disabled the IMPORT_SHORT_CLASSES option, so classes without namespaces (like \DateTime) aren't imported. We can still change that if someone doesn't agree.

Would you have any interest in further refining this PR? If not, do you think it does more good than bad (i.e. we merge it).

I re-ran Rector with the new options, went over the changes and committed the results. I'm not too familiar with the coverage of automatic tests in this repo, but the impacted commands should probably also be manually tested.

@weitzman weitzman merged commit bd0cfe4 into drush-ops:11.x Dec 31, 2021
@weitzman weitzman deleted the more-type-declarations-and-hints branch December 31, 2021 17:40
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.

None yet

2 participants