-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Bump psalm level #6977
Bump psalm level #6977
Conversation
@sonata-project/contributors There is the following psalm error:
It's right, the Should I add |
d18a63a
to
4fb91e4
Compare
6f97ce9
to
04ebda1
Compare
The PR is now ready @sonata-project/contributors :) |
Could you please rebase your PR and fix merge conflicts? |
@wbloszyk I just discover that The TaggedAdminInterface was meant to define all the setter called by this compiler pass. Should we move the methods from the MutableTemplateRegistryAwareInterface to the TaggedAdminInterface and from |
cc4d9f2
to
89124af
Compare
@@ -55,6 +55,8 @@ public function findOneBy(string $class, array $criteria = []): ?object | |||
|
|||
/** | |||
* @return Foo|null | |||
* | |||
* @psalm-suppress ImplementedReturnTypeMismatch |
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.
The return phpdoc is wrong imo
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.
public function find(string $class, $id): ?object
{
return $this->repository->byId($id);
}
Since the repository is a Foo repository, it always return Foo or null.
I had some trouble with this issue since the modelManager is suppose to return a value corresponding to the class, but is not doing this job in the tests...
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.
But did you try to remove the phpdoc? the interface already have that
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.
If I remove the Phpdoc, I end with another error, from phpstan maybe.
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.
Without the phpdoc I get
phpstan: Method Sonata\AdminBundle\Tests\App\Model\ModelManager::find() should return T of object|null but returns Sonata\AdminBundle\Tests\App\Model\Foo|null.
psalm: InvalidReturnStatement: The inferred type 'Sonata\AdminBundle\Tests\App\Model\Foo|null' does not match the declared return type '(T:fn-sonata\adminbundle\model\modelmanagerinterface::find as object)|null' for Sonata\AdminBundle\Tests\App\Model\ModelManager::find
tests/DependencyInjection/Compiler/AddDependencyCallsCompilerPassTest.php
Show resolved
Hide resolved
Could you please rebase your PR and fix merge conflicts? |
<InternalClass errorLevel="suppress"/> | ||
<InternalMethod errorLevel="suppress"/> | ||
<InternalProperty errorLevel="suppress"/> |
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.
Why suppressing these? can we add a comment?
No description provided.