phpstan-dba icon indicating copy to clipboard operation
phpstan-dba copied to clipboard

duplicate stubs error

Open staabm opened this issue 3 years ago • 6 comments

need to figure out a way how we can handle these stub errors and test whether we still need these stub files after all

https://github.com/phpstan/phpstan/issues/8378

I cannot reproduce it yet or know the exact circumstances, but I sometimes get errors like

 ------ -----------------------------------------------------------------
  Line   vendor-bin\phpstan\vendor\staabm\phpstan-dba\config\Mysqli.stub
 ------ -----------------------------------------------------------------
  3      Class mysqli_stmt declared multiple times:

 ------ -----------------------------------------------------------------

 ------ ---------------------------------------------------------------------------------------------------------------
  Line   vendor-bin\phpstan\vendor\staabm\phpstan-dba\config\PdoStatement.stub
 ------ ---------------------------------------------------------------------------------------------------------------
  11     Class PDOStatement declared multiple times:
         -
         phar://C:/dvl/Workspace/daiber/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/stubs/PDOStatement.stub
         :8
 ------ ---------------------------------------------------------------------------------------------------------------

 ------ ----------------------------------------------------------------------------------------------------
  Line   vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/stubs/PDOStatement.stub
 ------ ----------------------------------------------------------------------------------------------------
  8      Class PDOStatement declared multiple times:
         - C:/dvl/Workspace/daiber/vendor-bin/phpstan/vendor/staabm/phpstan-dba/config/PdoStatement.stub:11
 ------ ----------------------------------------------------------------------------------------------------

 ------ --------------------------------------------------------------------------
  Line   vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/stubs/mysqli.stub
 ------ --------------------------------------------------------------------------
  3      Class mysqli_stmt declared multiple times:

 ------ --------------------------------------------------------------------------

staabm avatar Nov 16 '22 16:11 staabm

see https://github.com/phpstan/phpstan-src/pull/2096

staabm avatar Dec 12 '22 19:12 staabm

@staabm since the PdoStatement.stub is now in phpstan-src merged + released, it needs to be removed here, too, right?

pscheit avatar Dec 16 '22 12:12 pscheit

It doesn't work yet with stubs from phpstan-src only.

I don't know yet how we can make this error go away.

If you got this error, you can proceed like usual. It is reported only when no result cache exists. As soon as the result cache is generated the error no longer happens

staabm avatar Dec 16 '22 12:12 staabm

since we have loaded bleedingEdge.neon I (for now) disabled the feature that detects doubles:

parameters:
    featureToggles:
        duplicateStubs: false  # workaround for: https://github.com/staabm/phpstan-dba/issues/466

in the CI it will fail all the time, cause the result cache isnt existing

pscheit avatar Dec 16 '22 12:12 pscheit

Ondrej sounds like, that there will be no fix. Duplicate stubs are not allowed, when they are in phpstan-src :/

pscheit avatar Dec 16 '22 12:12 pscheit

in the CI it will fail all the time, cause the result cache isnt existing

You should enable the result cache in CI. It saves a lot of time. e.g. with GithubActions you can use actions/cache to persist the cache between build jobs

staabm avatar Dec 16 '22 12:12 staabm