SanderRonde / phpstan-vscode

PHPStan plugin for VSCode
https://marketplace.visualstudio.com/items?itemName=SanderRonde.phpstan-vscode
MIT License
37 stars 7 forks source link

Not Matched Ignored error breaks error display #66

Closed Grldk closed 3 months ago

Grldk commented 3 months ago

I am running into disappearing errors lately, that seem to be caused by errors that were ignored (via a baseline file) and have since been fixed. This is best illustrated by an example.

Suppose I started with this class:

<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model as LaravelModel;

class Model extends LaravelModel
{
    use HasFactory;

    public function array(): array
    {
        return [];
    }

    public function string(): string
    {
        return 1;
    }
}

Which gives two errors: Method App\Models\Model::array() return type has no value type specified in iterable type array. Method App\Models\Model::string() should return string but returns int. image

I then add the first error to my baseline file, which leaves me with one error: image

If I then fix the first error, without removing it from the baseline, the second error disappears from vscode: image

PHPStan Client output:

[check:1] Check completed for file:///app/app/Models/Model.php errors= {"file:///app/app/Models/Model.php":["Ignored error pattern #^Method App\\\\Models\\\\Model\\:\\:array\\(\\) return type has no value type specified in iterable type array\\.$# in path /app/app/Models/Model.php was not matched in reported errors.","Method App\\Models\\Model::string() should return string but returns int."]}
SanderRonde commented 3 months ago

Thanks for the clear report! It should be fixed in the newest release (3.0.6)