Skip to content

PHPStan: Raise to level 4 - #305

Open
jtojnar wants to merge 20 commits into
microformats:mainfrom
jtojnar:phpstan-4
Open

jtojnar wants to merge 20 commits into
microformats:mainfrom
jtojnar:phpstan-4

Conversation

This will allow the tests to work offline or if the servers have an outage,
and they will not break if the site changes.
Reported by PHPStan
Reported by PHPStan.
`parseImg` can return `array` in which case we would not resolve the URL properly.
This is already declared using native PHP keyword.
Performed automatically using Rector.
PHP would complain about passing `false` to `substr` with `strict_types` enabled.
To catch type errors rather than having PHP silently mangle the data and maybe do something incorrect.
To satisfy PHPStan level 2.
Performed automatically using rector.
Level 3 would complain:

    Parameter &$dtValue by-ref type of function Mf2\normalizeTimezoneOffset() expects string, string|null given.
Level 4 would compain:

    If condition is always true.

Because the method will throw an error on failure on PHP 8.1.0+ but will return false on older versions.
Level 4 would complain:

    Property DOMElement::$tagName (string) in isset() is not nullable.

But the property has always been non-null:
https://web.archive.org/web/20130818013638/http://www.php.net/manual/en/class.domelement.php#domelement.props.tagname
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.

1 participant