Adjust type declarations a little bit #194
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
digestParts
should be a bit more flexibleResponse.php
setStatus
- be more careful to set the variable toint
- specially in the case when the passed-in value isctype_digit
(e.g. "200" "402" ...)I tried phpstan level 7 and noticed these things that looked like they can and should be fixed/adjusted. Level 7 also reports a lot of stuff about PHP functions that can return "something or false" like
string|false
- there are quite a few places where the (remote) possibility offalse
is not checked. We put the return value straight intostring
(or whatever). In most of those cases, there is no good explanation for whenfalse
can happen - "the internet broke", "the operating system fell to pieces"... So I am not planning to analyze each one and work out some path to handle the occurrence offalse
. Those things could happen already with the code, they are not regressions, and if/when they happen, some unexpected code path is being taken until, presumably, something falls over. Now they are likely to fall over earlier, because PHP will complain if the code tries to assignfalse
to somestring $var
- and the PHP error and traceback will point more directly the the point in the code where the problem first happened.