-
Notifications
You must be signed in to change notification settings - Fork 154
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
[BUGFIX] partially satisfy psalm for src/HtmlProcessor/AbstractHtmlProcessor.php #805
[BUGFIX] partially satisfy psalm for src/HtmlProcessor/AbstractHtmlProcessor.php #805
Conversation
This commit resolves one of the PossiblyNullPropertyAssignmentValue issues identified in src/HtmlProcessor/AbstractHtmlProcessor.php at the expense of identifying various further Null issues regarding: MyIntervals#537
This commit resolves the PossiblyNullReference issues introduced by a previous [BUGFIX] in src/HtmlProcessor/AbstractHtmlProcessor.php by refactoring `$this->domDocument->` to `$this->getDomDocument()->` This necessarily alters the body of the previously identified NullableReturnStatement issue. regarding: MyIntervals#537
This commit resolves 1 InvalidNullableReturnType and 1 NullableReturnStatement issue identified in src/HtmlProcessor/AbstractHtmlProcessor.php by throwing an exception if `AbstractHtmlProcessor::$domDocument` has not been set. regarding: MyIntervals#537
Yoda is speaking :)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of issues to resolve (easily) here. But otherwise looks good 👍
*/ | ||
public function getDomDocument(): \DOMDocument | ||
{ | ||
if (null === $this->domDocument) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yoda not like this :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like this can't be cleanly cherry-picked, so it'll be addressed directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolved in 451e379
throw new \UnexpectedValueException( | ||
self::class . | ||
'::setDomDocument() has not yet been called on ' . | ||
static::class | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we have an exception code based on the current UNIX timestamp? (It will also mark your change on the timeline of all history, up until at least 2037, etc. :>)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also I prefer to have the .
operators on the beginning of the next line rather than end of the preceding. But I don't think we have any stylistic rule about that - @oliverklee ?
It might become clearer when you add the 2nd argument - is the code easier to read with the .
operator at the start of a new line? YMMV, and it's no big deal...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might become clearer when you add the 2nd argument - is the code easier to read with the
.
operator at the start of a new line? YMMV, and it's no big deal...
my general preference is parenthesis.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my general preference is parenthesis.
Good idea. LGTM now :)
This commit resolves the yoda conditions introduced in previous [BUGFIX] commits. regarding: * MyIntervals#794 * MyIntervals#778 (comment) * MyIntervals#805 (review)
This commit adjusts the indentation separate from the addition of parenthesis in a previous commit, on the basis of making indentation & line break changes separate from functional changes. regarding: MyIntervals#805 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice improvements to defend against 'latent' bugs :)
No description provided.