Closed thomasvargiu closed 5 years ago
Ak, I think you're correct. Removing the if checks in the constructor would resolve the issue for title and type, but not the other pre-defined properties. I think the solution is to give them all default values when declared, as an empty string is still easy enough for a caller to detect. (I really dislike nullables unless there's absolutely no other option.)
Happy to accept a PR if you get to it before I do. :smile:
I'm doing it. There is any reason why strict types is declared but disabled?
Uh. I don't know what that means...? Strict types are declared at the top of the file. They can't be disabled after that in that file.
More likely, the tests just didn't happen to catch that use case.
Oh. Wait, I just realized what you mean. No, that's just me being brain-dead stupid. Thanks for catching it. :smile: Yes, everything should always be strictly typed, always.
I revised the PR with a new one, but kept all of your commits so that you got credit for them. :smile:
3.1 release has been tagged. Assuming I have it setup correctly it should push out to Composer any minute now. Thanks @thomasvargiu!
Crell\ApiProblem\ApiProblem
sets$title
(and$type
) property only if argument isn't empty, but getters requires a string return value.I think is possible to remove conditions in constructor. If you enable strict types, currently it would throw an error.
Same thing for other properties, they are
null
by default, but getters' return values aren't nullable.