diff --git a/composer.json b/composer.json index 4f64304..58f21eb 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,8 @@ "editorconfig-checker/editorconfig-checker": "^10.0", "squizlabs/php_codesniffer": "^3.0", "phpunit/phpunit": "^9.2", - "symfony/var-dumper": "^5.1" + "symfony/var-dumper": "^5.1", + "phpstan/phpstan": "^0.12.38" }, "autoload": { "psr-4": { @@ -35,9 +36,11 @@ "scripts": { "lint": [ "@lint:php", + "@analyse:php", "@lint:editorconfig" ], "lint:php": "phpcs --standard=PSR2 --extensions=php --exclude=Generic.Files.LineLength --ignore='vendor' .", + "analyse:php": "phpstan analyse --no-progress --level 1 src/ tests/", "lint:editorconfig": "ec .", "test": "phpunit tests/" } diff --git a/src/Classes/CodeQuality/Check/ParamNamingCheck.php b/src/Classes/CodeQuality/Check/ParamNamingCheck.php index 12c67a8..dce2b74 100644 --- a/src/Classes/CodeQuality/Check/ParamNamingCheck.php +++ b/src/Classes/CodeQuality/Check/ParamNamingCheck.php @@ -70,6 +70,7 @@ public function check(): array protected function extractParamNamesAndTypes(): array { return array_reduce($this->component->paramNodes, function (array $carry, ViewHelperNode $node) { + /** @var \TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\TextNode */ $arguments = $node->getArguments(); $carry[(string) $arguments['name']] = (string) $arguments['type']; return $carry; diff --git a/src/Classes/CodeQuality/Check/ViewHelpersCheck.php b/src/Classes/CodeQuality/Check/ViewHelpersCheck.php index 71e81ce..cdcfb38 100644 --- a/src/Classes/CodeQuality/Check/ViewHelpersCheck.php +++ b/src/Classes/CodeQuality/Check/ViewHelpersCheck.php @@ -46,7 +46,9 @@ protected function extractUsedViewHelpers(): array return $node->getUninitializedViewHelper() instanceof IntrospectionViewHelper; }); return array_map(function (ViewHelperNode $node) { - return $node->getUninitializedViewHelper()->getViewhelperTagName(); + /** @var IntrospectionViewHelper */ + $introspectionViewHelper = $node->getUninitializedViewHelper(); + return $introspectionViewHelper->getViewhelperTagName(); }, $introspectedViewHelpers); } } diff --git a/src/Classes/CodeQuality/Component.php b/src/Classes/CodeQuality/Component.php index b519e05..81b1feb 100644 --- a/src/Classes/CodeQuality/Component.php +++ b/src/Classes/CodeQuality/Component.php @@ -17,6 +17,7 @@ class Component public $path; public $rootNode; + public $fluidService; public $componentNode; public $paramNodes = []; diff --git a/src/Classes/Service/ComponentService.php b/src/Classes/Service/ComponentService.php index f6c720a..039cba6 100644 --- a/src/Classes/Service/ComponentService.php +++ b/src/Classes/Service/ComponentService.php @@ -74,7 +74,7 @@ protected function scanForComponents(string $path, string $ext): array // Continue recursively $components = array_merge( $components, - $this->scanForComponents($componentPath, $ext, $this->scannedPaths) + $this->scanForComponents($componentPath, $ext) ); }