1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-02 17:52:45 +01:00
psalm/tests/Config/Plugin/Hook/FileProvider.php
orklah 10f2966dcb
return types (#4311)
* return types

* remove willReturn for void methods
2020-10-12 15:02:52 -04:00

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;
}
}