staabm / phpstan-dba

PHPStan based SQL static analysis and type inference for the database access layer
https://staabm.github.io/archive.html#phpstan-dba
MIT License
252 stars 17 forks source link

generic type mysqli_result error with phpstan v1.10.36 and v1.10.37 #631

Closed slackero closed 12 months ago

slackero commented 1 year ago

Trying to update phpstan to v1.10.37 results in an error.

--------------------------------------------------------------------------------
  vendor/staabm/phpstan-dba/config/Mysqli.stub:29
 --------------------------------------------------------------------------------
 PHPDoc tag @param for parameter $result contains generic type mysqli_result<mixed> but class mysqli_result is not generic.
 --------------------------------------------------------------------------------

It doesn't help to ignore the error or exclude the path.

Up to phpstan v1.10.35 it works without this error message. Maybe it is related to this pull request — [mysqli] Add stubs for mysqli and mysqli_result classes phpstan/phpstan-src#2295.

staabm commented 1 year ago

thanks for reporting. I have also seen this error and it seems phpstan-dba is not compatible with the latest phpstan releases because of this stubs error.

I will work on a fix when time allows, as my own projects are also hit by this problem.

staabm commented 12 months ago

in https://github.com/staabm/phpstan-dba/releases/tag/0.2.79 I have pushed a new release containing a bugfix for that particular problem to make phpstan-dba work for everyone not using mysqli_fetch_object.

in the next step I will have a look to get all features back, but at least the more ciritical stuff should work again

thanks for reporting