You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Strange DBAL discrepancy between local env and CI #225
The package table has a simple int(11) primary id, nothing weird, and it definitely hasn't changed in 10 years so I believe my local schema matches CI :)
in your example phpstan-dba is taking one of the return $defaultReturn branches and therefore defines the return-type to whatever doctrine-dbal itself defines at the phpdoc level
Activity
staabm commentedon Feb 2, 2022
having a mixed only for a single column-type would mean you are running into this case:
phpstan-dba/src/QueryReflection/MysqliQueryReflector.php
Line 293 in e2939f2
are you sure you are using the same db schema locally and in CI?
maybe its a difference in mysql versions or maria db vs. mysql?
alternatively: maybe your schema is using a column type, which is not yet properly mapped to a phpstan type in
phpstan-dba/src/QueryReflection/MysqliQueryReflector.php
Lines 182 to 301 in e2939f2
Seldaek commentedon Feb 2, 2022
The package table has a simple int(11) primary id, nothing weird, and it definitely hasn't changed in 10 years so I believe my local schema matches CI :)
https://github.com/composer/packagist/blob/8a3d28e42f9790dea401e5f9afc7c2c9780b58d8/src/Entity/Package.php#L62-L67
I'm on mysql8.0.13 and GH is on 8.0.26 but I doubt that'd make a difference here.. I can try to upgrade to be sure, wouldn't hurt anyway ;)
staabm commentedon Feb 2, 2022
If time allows I can debug the CI job and the used phpstan-dba version within the CI pipeline.
Seldaek commentedon Feb 2, 2022
On 8.0.28 locally now, still can't repro :/
Seldaek commentedon Feb 2, 2022
Very confused, just tried again to run phpstan and suddenly it changed to the same output as CI?!
I even tried clearing PHPStan & phpstan-dba caches earlier, it didn't help.. proper WTF here.. but at least it works now so I guess closing 🤷♂️
staabm commentedon Feb 2, 2022
hm ok, so you are now able to debug locally why its returning
mixed?running phpstan with
--debugdisables all caches.. thats the first thing I try when caching might be a problem.staabm commentedon Feb 3, 2022
I have a new theory, why you get a
array<int, mixed>,..doctrine defines the method
fetchFirstColumnonConnectionto returnlist<mixed>:https://github.com/doctrine/dbal/blob/0dc504e80b400870d4d1d0392394164b4dd39019/src/Connection.php#L888-L902
in your example phpstan-dba is taking one of the
return $defaultReturnbranches and therefore defines the return-type to whatever doctrine-dbal itself defines at the phpdoc levelphpstan-dba/src/Extensions/DoctrineConnectionFetchDynamicReturnTypeExtension.php
Lines 48 to 76 in 47c9935
I am not yet sure for the exact reason.
staabm commentedon Feb 4, 2022
just installed packagist locally and did some debugging.
the reason for this query not beeing analyzable is the following mysql error:
phpstan-dba simulates a value which does not fit to the mysql native type and therefore we produce a sql error
staabm commentedon Feb 4, 2022
I think we can consider this issue fixed.
the acual problem was, that we skipped everything which had no parameters.
Seldaek commentedon Feb 4, 2022
Thanks!