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

[BUGFIX] partially satisfy psalm for src/HtmlProcessor/AbstractHtmlProcessor.php #805

Conversation

SignpostMarv
Copy link
Contributor

No description provided.

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
@JakeQZ
Copy link
Contributor

JakeQZ commented Oct 7, 2019

Yoda is speaking :))

Copy link
Contributor

@JakeQZ JakeQZ left a 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) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yoda not like this :)

Copy link
Contributor Author

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved in 451e379

Comment on lines 112 to 116
throw new \UnexpectedValueException(
self::class .
'::setDomDocument() has not yet been called on ' .
static::class
);
Copy link
Contributor

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. :>)

Copy link
Contributor

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...

Copy link
Contributor Author

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.

Copy link
Contributor Author

@SignpostMarv SignpostMarv Oct 7, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved in 0bf5794 and 0adb26f

Copy link
Contributor

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)
Copy link
Contributor

@JakeQZ JakeQZ left a 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 :)

@JakeQZ JakeQZ merged commit a09b0ed into MyIntervals:master Oct 7, 2019
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