-
-
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
Add strict rules #7340
Add strict rules #7340
Conversation
Could you please rebase your PR and fix merge conflicts? |
d060638
to
833a99e
Compare
2edb33e
to
5236bd0
Compare
@jordisala1991 What do you recommend in order to solve
? Changing to
could stop working if the get wasn't returning a boolean. I don't know what was returned before. An option could be to use
but is it supposed to be passed as attributes, query or request ?
cc @sonata-project/contributors |
5236bd0
to
4dc3e41
Compare
We need to check where it is passed that parameter, it will probably be query if it is a get call or request if it is a post |
In tests, we're setting the Here, it's POST SonataAdminBundle/src/Resources/views/CRUD/Association/edit_one_script.html.twig Lines 49 to 51 in 2cce28c
SonataAdminBundle/src/Resources/views/CRUD/Association/edit_many_script.html.twig Lines 331 to 333 in 2cce28c
Here, it rely on the form SonataAdminBundle/src/Resources/views/CRUD/Association/edit_many_script.html.twig Lines 93 to 96 in 2cce28c
Here it rely on an attr.method, or can be GET SonataAdminBundle/src/Resources/views/CRUD/Association/edit_many_script.html.twig Lines 259 to 296 in 2cce28c
So I would say, it can be either GET or POST. Do we have to check both query and request ? |
- # https://github.com/phpstan/phpstan-phpunit/issues/87 | ||
message: '#^Trying to mock an undefined method [a-zA-Z]*\(\) on class stdClass\.$#' | ||
path: tests/ | ||
- # https://github.com/phpstan/phpstan-strict-rules/issues/130 | ||
message: '#^Call to static method PHPUnit\\Framework\\Assert::.* will always evaluate to true\.$#' |
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.
Cant some of these be removed or they conflict with other errors for psalm?
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 issue is that we checking our return type.
for instance the method
function createDate(): \DateTime {
return new \DateTime();
}
has the following test
self::assertInstanceOf(\DateTime::class, createDate());
Phpstan is complaining about this being always true. But we might consider it's the purpose of the test to be sure it will be true in the futur.
* | ||
* @throws \InvalidArgumentException if the menu does not exists | ||
*/ | ||
public function get(string $name, array $options = []): ItemInterface | ||
{ | ||
if (!isset($options['name'])) { | ||
throw new \InvalidArgumentException('TODO'); |
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.
missing message, same below
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.
Indeed, I forgot ^^'
No description provided.