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

Phpstan v2 #1017

Merged
merged 9 commits into from
Nov 20, 2024
Merged

Phpstan v2 #1017

merged 9 commits into from
Nov 20, 2024

Conversation

lolli42
Copy link
Member

@lolli42 lolli42 commented Nov 20, 2024

No description provided.

> composer req --dev phpstan/phpstan:^2.0.2 phpstan/phpstan-phpunit:^2.0.1
> vendor/bin/phpstan analyze --generate-baseline
Some tests verify if view helper classes are an
instance of an abstract to see if the VH "can
be instantiated". Those are useless and
instantiation of those VH's is indirectly tested
by following tests that render a template using
the VH.

The instanceof tests add no value and are removed,
testing for the abstracts is useless anyway and
the only contract that must be adhered to is
ViewHelperInterface, which is tested by the
following tests.
SimpleFileCache->getCachedFilenames() always returns
an array.
phpstan is correct here, the is_array() check
is obsolete since the variable is initialized
as array and preg_match_all() won't change
its type when hand over as reference.
If setCache() has not been called, the
property is null. Reflect this in the
type annotation.
In RenderingContext: Property $errorHandler can be
null if setErrorHandler() has not been called.
Reflect this in the type annotation.
implode() always returns string, $actualViewHelperClassName
can never be false.
There is no point in calling parent::initializeArguments()
when we know the parent method is an empty dummy method
that will most likely never have a body since that would
break too much.
@s2b s2b merged commit a013dfd into main Nov 20, 2024
8 checks passed
@s2b s2b deleted the lolli-1 branch November 20, 2024 11:06
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