Skip to content

result cache: Handling of deleted files not working #3043

@bendavies

Description

@bendavies

Bug report

Deleting files does not trigger errors in dependencies.
I'm using dev master, including phpstan/phpstan-src@ffb7796

Code snippet that reproduces the problem

A.php

<?php

namespace App;

class A
{
    public function __construct(B $b)
    {
    }
}

B.php

<?php

namespace App;

class B
{
}
vendor/bin/phpstan analyse src
[OK] No errors
rm src/B.php
vendor/bin/phpstan analyse src
 [OK] No errors

Expected output

B is gone so A has a dependency error.

Clearing cache triggers the error:

vendor/bin/phpstan analyse src
[OK] No errors
rm src/B.php
vendor/bin/phpstan analyse src
[OK] No errors
vendor/bin/phpstan clear-result-cache
vendor/bin/phpstan analyse src
 ------ ------------------------------------------------------------------------------
  Line   A.php
 ------ ------------------------------------------------------------------------------
  7      Parameter $b of method App\A::__construct() has invalid typehint type App\B.
 ------ ------------------------------------------------------------------------------

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