diff --git a/README.md b/README.md index 4075baf4..0f4f4449 100644 --- a/README.md +++ b/README.md @@ -160,6 +160,7 @@ use nix - [php-cs-fixer](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer) - [phpcbf](https://github.com/squizlabs/PHP_CodeSniffer) - [phpcs](https://github.com/squizlabs/PHP_CodeSniffer) +- [phpstan](https://github.com/phpstan/phpstan) ## Rust diff --git a/modules/hooks.nix b/modules/hooks.nix index 08ad9ae3..802c4053 100644 --- a/modules/hooks.nix +++ b/modules/hooks.nix @@ -410,6 +410,19 @@ in }; }; + phpstan = + { + binPath = + mkOption { + type = types.str; + description = lib.mdDoc "PHPStan binary path."; + default = "${pkgs.php82Packages.phpstan}/bin/phpstan"; + defaultText = lib.literalExpression '' + "''${pkgs.php81Packages.phpstan}/bin/phpstan" + ''; + }; + }; + php-cs-fixer = { binPath = @@ -1530,6 +1543,15 @@ in types = [ "php" ]; }; + phpstan = + { + name = "phpstan"; + description = "Static Analysis of PHP files."; + entry = with settings.phpstan; + "${binPath} analyse"; + types = [ "php" ]; + }; + php-cs-fixer = { name = "php-cs-fixer";