Skip to content

Add type annotations for Commentable #294

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

Merged
merged 2 commits into from
Jul 2, 2021

Conversation

oliverklee
Copy link
Collaborator

Also copy these type annotations to the implementing classes.

@sabberworm
Copy link
Collaborator

Is it really necessary to repeat type annotations in overrides? Isn’t there some tag (like @inheritDoc in Java) that can be used instead?

Also copy these type annotations to the implementing classes.
@oliverklee oliverklee force-pushed the task/types-commentable branch from 0c95eb8 to 904340e Compare July 2, 2021 07:15
@oliverklee
Copy link
Collaborator Author

Technically, we need to have something - be it either a copy of the iterface's method, or be it @inheritdoc (which should be recognized by tools like PHPStan, Psalm and PhpStorm's static analysis).

However, for the human reader who scrolls through the source code, I very strongly prefer copying the type annotations. This is because the human reader would need to click on the @inheritdoc annotation (or hover, depending on which plugins are installed) to see the types, which makes quick reading quite impossible.

@sabberworm
Copy link
Collaborator

However, for the human reader who scrolls through the source code, I very strongly prefer copying the type annotations. This is because the human reader would need to click on the @inheritdoc annotation (or hover, depending on which plugins are installed) to see the types, which makes quick reading quite impossible.

On the other hand, maintenance is going to be a pain when we want to change the signature (unless we have a tool that enforces consistent type annotations).

@sabberworm sabberworm merged commit 4f802f4 into MyIntervals:master Jul 2, 2021
@oliverklee oliverklee deleted the task/types-commentable branch July 2, 2021 17:02
@oliverklee
Copy link
Collaborator Author

On the other hand, maintenance is going to be a pain when we want to change the signature (unless we have a tool that enforces consistent type annotations).

This indeed is true. PHPStan (on higher levels) will at least warn us if the type annotations get inconsistent.

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