Skip to content

PHPStan producing different results on CI #2269

@angelsk

Description

@angelsk

Support question

I have two projects set up using PHPStan. They are both using a Docker container as an image to run stan and unit tests etc again, both locally and on a CI service (GoCD). I have Stan set to max level, the config set up and the phpunit extension installed (and the extensions installer)

I'm running Stan against my tests locally using the Docker image and there are no problems on both projects - which each have a similar test and set up.

On GoCD - one project is failing, one is passing. Locally, both are passing. They are all using the same Docker container, cache cleared and freshly built.

The errors on GoCD are:

  Line   tests/DoctrineExtensions/DBAL/Types/EnumTransactionSourceTypeTest.php    
 ------ ------------------------------------------------------------------------- 
  35     Call to an undefined method                                              
         App\DoctrineExtensions\DBAL\Types\EnumTransactionSourceType|PHPUnit\Fra  
         mework\MockObject\MockObject::getSQLDeclaration().                       
  43     Call to an undefined method                                              
         App\DoctrineExtensions\DBAL\Types\EnumTransactionSourceType|PHPUnit\Fra  
         mework\MockObject\MockObject::getSQLDeclaration().                       
  49     Call to an undefined method                                              
         App\DoctrineExtensions\DBAL\Types\EnumTransactionSourceType|PHPUnit\Fra  
         mework\MockObject\MockObject::getName().                                 
  57     Call to an undefined method                                              
         App\DoctrineExtensions\DBAL\Types\EnumTransactionSourceType|PHPUnit\Fra  
         mework\MockObject\MockObject::convertToDatabaseValue().                  
  77     Call to an undefined method                                              
         App\DoctrineExtensions\DBAL\Types\EnumTransactionSourceType|PHPUnit\Fra  
         mework\MockObject\MockObject::convertToDatabaseValue().                  
 ------ ------------------------------------------------------------------------- 

 [ERROR] Found 5 errors  

Namespaces are included properly. PHPUnit extension included. I've compared against the other project. And as I said it's running fine locally. Also - those methods do exist (and the test runs fine.

Can you think of anything that would cause two different sets of results so I can try and reproduce this locally - as it's really annoying having to commit every potential fix and have it fail again.

An easy fix would be to remove the docblock @var declarations for the test. But as the same test is passing on the other project; I feel like it's something different causing it to fail.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions