-
Notifications
You must be signed in to change notification settings - Fork 545
Add support for maths with constant numeric string #2209
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
Conversation
5f02314 to
ff8335f
Compare
458e1f4 to
4889ca0
Compare
9a0575c to
ebab444
Compare
ebab444 to
a8c373f
Compare
e709ec9 to
95c0003
Compare
|
Friendly ping @ondrejmirtes, I'm not sure if it's just a time-issue or if this PR got away from your notifications |
10ef075 to
d77dcbe
Compare
d77dcbe to
b8036b3
Compare
|
On one real world project, it shows 101 new errors. One example: /**
* @return array<int, array<string, int>>
*/
public function getIdsByStatus(BankTransactionStatus $status): array
{
return $this->entityManager->createQueryBuilder()
->select('bt.id')
->from(BankTransaction::class, 'bt')
->andWhere('bt.status = :status')->setParameter('status', $status)
->addOrderBy('bt.id', 'ASC')
->getQuery()
->getArrayResult();
}PHPStan reports: The primary key really can't be null. The definition: Another similar example: $id = $this->entityManager->createQueryBuilder()
->select('c.id')
->from(Campaign::class, 'c')
->andWhere('c.hash = ?', $hash)
->setMaxResults(1)
->getQuery()
->getSingleScalarResult();PHPStan thinks the |
I think you meant to post this on phpstan/phpstan-doctrine#412 |
|
Oh yeah, sorry :) |
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.
Hi, type inference tests are great but the linked bug reports are about false positives in specific rules. Please also add regression tests for those rules. Thank you.
b8036b3 to
0dad8a1
Compare
I added non-regression tests for those rules :) |
0dad8a1 to
bb38a73
Compare
|
I rebased the PR, and the three failing build seems unrelated @ondrejmirtes :) |
b12516f to
bf1ebef
Compare
bf1ebef to
d6047aa
Compare
d6047aa to
f9b262c
Compare
|
Friendly ping @ondrejmirtes, I rebased the PR. This should be ready to be reviewed :) |
|
Thank you! |
When doing math, constantString can be casted to ConstantInt by Phpstan to compute the result.
Closes phpstan/phpstan#8803
In the same way boolean can be casted to
0|1, I added a commitCloses phpstan/phpstan#8827