Skip to content
This repository has been archived by the owner on Jun 25, 2024. It is now read-only.

Commit

Permalink
Added more stub files from PHPStan Nette plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickkusebauch committed Oct 25, 2020
1 parent b551df4 commit 0929392
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
14 changes: 12 additions & 2 deletions Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,20 @@ public function __invoke(RegistrationInterface $psalm, ?SimpleXMLElement $config
$psalm->addStubFile($file);
}
}

/** @return array<string> */
private function getStubFiles(): array
{
return glob(__DIR__ . '/stubs/*.phpstub') ?: [];
$phpstan = self::rglob(__DIR__ . '/../../phpstan/phpstan-nette/stubs/*/*.stub') ?: [];
$mine = glob(__DIR__.'/stubs/*.phpstub') ?: [];
return $phpstan + $mine;
}

private static function rglob($pattern, $flags = 0) {
$files = glob($pattern, $flags);
foreach (glob(dirname($pattern).'/*', GLOB_ONLYDIR|GLOB_NOSORT) as $dir) {
$files = array_merge($files, self::rglob($dir.'/'.basename($pattern), $flags));
}
return $files;
}

}
5 changes: 4 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "patrickkusebauch/nette-psalm-plugin",
"description": "Psalm plugin for Nette Framework",
"keywords": ["php", "code", "inspection", "psalm", "plugin", "psalm-plugin", "static analysis", "static-analysis", "extension"],
"keywords": ["php", "code", "inspection", "psalm", "plugin", "psalm-plugin", "static analysis", "static-analysis", "extension", "nette", "latte", "Nette Framework"],
"type": "psalm-plugin",
"license": "MIT",
"authors": [
Expand All @@ -13,6 +13,9 @@
"require": {
"vimeo/psalm": "^3.6.2 || dev-master"
},
"suggest": {
"phpstan/phpstan-nette": "More stub files for Nette Framework"
},
"extra": {
"psalm" : {
"pluginClass": "PatrickKusebauch\\NettePsalmPlugin\\Plugin"
Expand Down

0 comments on commit 0929392

Please sign in to comment.