TomasVotruba / bladestan

PHPStan analysis for Blade templates
https://tomasvotruba.com/blog/introducing-bladestan-phpstan-analysis-of-blade-templates/
MIT License
286 stars 14 forks source link

When Blade file doesn't exist, it didn't report any error and just passed. #106

Closed johntheteam closed 3 weeks ago

johntheteam commented 3 weeks ago

A full test project:

composer create-project --prefer-dist laravel/laravel blade

cd blade

composer require --dev phpstan/phpstan tomasvotruba/bladestan

#vi phpstan.neon
includes:
    - vendor/tomasvotruba/bladestan/config/extension.neon

parameters:
    level: 8
    paths:
        - resources/views
    fileExtensions:
        - blade.php

#vi resources/views/templates/test.blade.php

<div>Hello, Blade!</div>
<?php echo \Carbon\Carbon::now()->undefined();?>
{{ \Carbon\Carbon::now()->undefined() }}

#vi BlogController.php 
<?php
final class BlogController
{
    public function __invoke():string
    {
        return view('not-exist-blade', [
            'title' => 'Blog'
        ])->render();
    }
}

vendor/bin/phpstan analyze -c phpstan.neon --memory-limit=512M --debug -vvv BlogController.php
# the blade file doesn't exist but the above output:  [OK] No errors
AJenbo commented 3 weeks ago

Duplicate https://github.com/TomasVotruba/bladestan/issues/56

Please search existing issues before creating new ones.