Closed oliverklee closed 4 years ago
psalm has identified a set of TestCase::assertInstanceOf()
checks as redundant, which renders three test cases redundant:
This is likely because the corresponding methods are flags as @return static
and so long as psalm doesn't identify a different return type from these methods, it should be safe to remove the tests.
It's also possibly because we're asserting something that's provably true by static code analysis!
the question would be whether to leave the assertions in to enforce future behaviour, or remove all three test methods as the static analysis "proves" the appropriate type is in play.
I'd prefer to have more checks than fewer, even if they overlap/duplicate, i.e. keep the assertions.
In a similar vein, I recall a comment about Psalm a few days ago where you mentioned something that was already covered by PHPCS (or -fixer). I'd like to have all the tools cover all the possible issues, regardless of overlap. That way you can be more sure nothing is missed (one tool may be better in different ways at picking up a particular issue than another).
related query to checking with psalm; whether or not to enable the shepherd plugin to have the type-coverage badge in readme.md
psalm has identified a set of
TestCase::assertInstanceOf()
checks as redundant, which renders three test cases redundant:
@SignpostMarv Do you mean "redundant" as in "the tests only need to be in AbstractHtmlProcessorTest
" or as in "the return types do not need to be checked as they are already defined by the return type definition"? Or something else?
psalm has identified a set of
TestCase::assertInstanceOf()
checks as redundant, which renders three test cases redundant:@SignpostMarv Do you mean "redundant" as in "the tests only need to be in
AbstractHtmlProcessorTest
" or as in "the return types do not need to be checked as they are already defined by the return type definition"? Or something else?
as in the issue type is named RedundantConditionGivenDocblockType
.
we're now at the stage in rebased commits where changes affect more than one file.
we're now at the stage in rebased commits where changes affect more than one file.
OK. The principle to stick to is 'small manageable chunks' - if that happens to involve more than one file that's absolutely fine, as long as it's 'small and manageable' :)
We now check the code with Psalm, and we should move more type fixes to separate tickets. Closing.
https://github.com/vimeo/psalm