PHPStan warning #6440

Closed
opened 2026-01-22 15:33:19 +01:00 by admin · 9 comments
Owner

Originally created by @kirya-dev on GitHub (Apr 8, 2020).

Bug Report

Q A
Version 2.7.1

Summary

When im run phpstan analyser with 6 level i get error:
Parameter #1 $x of method Doctrine\ORM\Query\Expr::andX() expects Doctrine\ORM\Query\Expr\Comparison|Doctrine\ORM\Query\Expr\Func|Doctrine\ORM\Query\Expr\Orx|string|null, Doctrine\ORM\Query\Expr\Andx given.

Current behavior

8c259ea5cb/lib/Doctrine/ORM/Query/Expr.php (L31)

How to reproduce

Run vendor/bin/phpstan analyse -c phpstan.neon -l 6

Expected behavior

No warnings

Just replace annotation on mixed?

Originally created by @kirya-dev on GitHub (Apr 8, 2020). ### Bug Report | Q | A |------------ | ------ | Version | 2.7.1 #### Summary When im run phpstan analyser with 6 level i get error: *Parameter #1 $x of method Doctrine\ORM\Query\Expr::andX() expects Doctrine\ORM\Query\Expr\Comparison|Doctrine\ORM\Query\Expr\Func|Doctrine\ORM\Query\Expr\Orx|string|null, Doctrine\ORM\Query\Expr\Andx given.* #### Current behavior https://github.com/doctrine/orm/blob/8c259ea5cb632dbb57001b2262048ae7fa52b102/lib/Doctrine/ORM/Query/Expr.php#L31 #### How to reproduce Run ` vendor/bin/phpstan analyse -c phpstan.neon -l 6` #### Expected behavior No warnings Just replace annotation on mixed?
admin added the Bug label 2026-01-22 15:33:19 +01:00
admin closed this issue 2026-01-22 15:33:19 +01:00
Author
Owner

@greg0ire commented on GitHub (Apr 8, 2020):

Just replace annotation on mixed?

The list of allowed classes is shown here: 8c259ea5cb/lib/Doctrine/ORM/Query/Expr/Andx.php (L16-L21)

So it would just be a matter of adding Andx here. Please send a PR against 2.7

@greg0ire commented on GitHub (Apr 8, 2020): > Just replace annotation on mixed? The list of allowed classes is shown here: https://github.com/doctrine/orm/blob/8c259ea5cb632dbb57001b2262048ae7fa52b102/lib/Doctrine/ORM/Query/Expr/Andx.php#L16-L21 So it would just be a matter of adding `Andx` here. Please send a PR against 2.7
Author
Owner

@kirya-dev commented on GitHub (Aug 5, 2020):

We can replace just on \Stringable (polyfill php8)?

@kirya-dev commented on GitHub (Aug 5, 2020): We can replace just on \Stringable (polyfill php8)?
Author
Owner

@greg0ire commented on GitHub (Aug 5, 2020):

What do you want to replace with \Stringable and why? We don't cast to string, do we?

@greg0ire commented on GitHub (Aug 5, 2020): What do you want to replace with `\Stringable` and why? We don't cast to string, do we?
Author
Owner

@kirya-dev commented on GitHub (Aug 6, 2020):

Want use this interface because all Expr has __toString()

@kirya-dev commented on GitHub (Aug 6, 2020): Want use this interface because all Expr has __toString()
Author
Owner

@kirya-dev commented on GitHub (Aug 6, 2020):

They just build DQL expression

@kirya-dev commented on GitHub (Aug 6, 2020): They just build DQL expression
Author
Owner

@greg0ire commented on GitHub (Aug 6, 2020):

I see, but we don't actually want to allow any \Stringable, do we?

@greg0ire commented on GitHub (Aug 6, 2020): I see, but we don't actually want to allow any `\Stringable`, do we?
Author
Owner

@kirya-dev commented on GitHub (Aug 6, 2020):

Using \Stringable able create own DQL classes

@kirya-dev commented on GitHub (Aug 6, 2020): Using **\Stringable** able create own DQL classes
Author
Owner

@greg0ire commented on GitHub (Aug 6, 2020):

It's called $allowedClasses so I guess you can't just use any class.

@greg0ire commented on GitHub (Aug 6, 2020): It's called `$allowedClasses` so I guess you can't just use any class.
Author
Owner

@kirya-dev commented on GitHub (Aug 6, 2020):

PR here: https://github.com/doctrine/orm/pull/8227

@kirya-dev commented on GitHub (Aug 6, 2020): PR here: https://github.com/doctrine/orm/pull/8227
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#6440