mirror of
https://github.com/danog/psalm.git
synced 2024-12-15 02:47:02 +01:00
10f2966dcb
* return types * remove willReturn for void methods
41 lines
1.2 KiB
PHP
41 lines
1.2 KiB
PHP
<?php
|
|
namespace Psalm\Test\Config\Plugin\Hook;
|
|
|
|
use Psalm\Codebase;
|
|
use Psalm\Context;
|
|
use Psalm\Plugin\Hook\AfterFileAnalysisInterface;
|
|
use Psalm\Plugin\Hook\BeforeFileAnalysisInterface;
|
|
use Psalm\StatementsSource;
|
|
use Psalm\Storage\FileStorage;
|
|
|
|
class FileProvider implements
|
|
AfterFileAnalysisInterface,
|
|
BeforeFileAnalysisInterface
|
|
{
|
|
/**
|
|
* Called before a file has been checked
|
|
*/
|
|
public static function beforeAnalyzeFile(
|
|
StatementsSource $statements_source,
|
|
Context $file_context,
|
|
FileStorage $file_storage,
|
|
Codebase $codebase
|
|
): void {
|
|
$file_storage = $codebase->file_storage_provider->get($statements_source->getFilePath());
|
|
$file_storage->custom_metadata['before-analysis'] = true;
|
|
}
|
|
|
|
/**
|
|
* Called before a file has been checked
|
|
*/
|
|
public static function afterAnalyzeFile(
|
|
StatementsSource $statements_source,
|
|
Context $file_context,
|
|
FileStorage $file_storage,
|
|
Codebase $codebase
|
|
): void {
|
|
$file_storage = $codebase->file_storage_provider->get($statements_source->getFilePath());
|
|
$file_storage->custom_metadata['after-analysis'] = true;
|
|
}
|
|
}
|