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

Intentions and Solutions #77

Closed
dmecke opened this issue Mar 15, 2019 · 13 comments
Closed

Intentions and Solutions #77

dmecke opened this issue Mar 15, 2019 · 13 comments
Assignees

Comments

@dmecke
Copy link
Contributor

dmecke commented Mar 15, 2019

First of all thank you for sharing your phpstan rules!

There are some rules (the nullable-rules to be precise) where I get the intention, but I am not sure how to avoid violations in some cases. I think there might also be a lack of understandment why some rules might be a good idea.

I think the rules would benefit from a brief description on why they should be applied and how to avoid violations.

@localheinz
Copy link
Member

@dmecke

Totally agree!

I‘ve meant to write a blog post a while ago, but never got around to actually do it. I’ll take care of it!

👍

@localheinz localheinz self-assigned this Mar 15, 2019
@localheinz
Copy link
Member

@dmecke

Still haven't gotten around to writing the post, but haven't forgotten - have recently moved, got lots of things to do. Hope to get it done soon!

@stale
Copy link

stale bot commented Jul 6, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jul 6, 2019
@localheinz localheinz removed the stale label Jul 6, 2019
@github-actions
Copy link

github-actions bot commented Sep 4, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions
Copy link

github-actions bot commented Nov 6, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Nov 6, 2019
@localheinz localheinz removed the stale label Nov 6, 2019
@github-actions
Copy link

github-actions bot commented Jan 6, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Jan 6, 2020
@localheinz localheinz removed the stale label Jan 6, 2020
@ergebnis-bot
Copy link
Member

Since this issue has not had any activity within the last sixty days, I have marked it as stale.
I will close it if no further activity occurs within the next five days.

@ergebnis-bot
Copy link
Member

Since this issue has not had any activity within the last sixty days, I have marked it as stale.

I will close it if no further activity occurs within the next five days.

@ergebnis-bot
Copy link
Member

Since this issue has not had any activity within the last sixty days, I have marked it as stale.

I will close it if no further activity occurs within the next five days.

@jansor
Copy link

jansor commented Dec 11, 2020

I totally @dmecke, for now i am not going to use this rules anymore, they causing confusion.
Example: why NoNullableReturnTypeDeclarationRule even exists? It is perfectlly fine that methods can return null.
If we better understand why something is like this, then we can build better solutions.

Thanks for the effort on these rules. but for now i remove them from the programming.

@dmecke
Copy link
Contributor Author

dmecke commented Dec 11, 2020

Well, for this specific rule the answer, I guess, is that nullable return types mean, that there are in fact two possible "types" that might be returned: the actual type or null. So every callee has to make sure to check for null, which makes the code much harder to read. If can rely on one specific type instead, you don't have to make any checks. You could achieve this with the null object pattern for example. And you might ask yourself: what does null actually mean? Maybe it's some kind of error case, so maybe an exception could be the better way to handle it.

Anyhow, these are just my thoughts and I am sure there is more reasoning about that topic.

@ergebnis-bot
Copy link
Member

Since this issue has not had any activity within the last 180 days, I have marked it as stale.

I will close it if no further activity occurs within the next 14 days.

@localheinz localheinz removed the stale label Jun 9, 2021
@ergebnis-bot
Copy link
Member

Since this issue has not had any activity within the last 180 days, I have marked it as stale.

I will close it if no further activity occurs within the next 14 days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants