1{ mkDerivation, fetchurl, makeWrapper, lib, php }:
2let
3 pname = "phpstan";
4 version = "0.12.82";
5in
6mkDerivation {
7 inherit pname version;
8
9 src = fetchurl {
10 url = "https://github.com/phpstan/phpstan/releases/download/${version}/phpstan.phar";
11 sha256 = "sha256-fX7YK4z6xUhSJ2jTCy7bRK13TxXSn/qo7E5DeZlv2Nw=";
12 };
13
14 phases = [ "installPhase" ];
15 nativeBuildInputs = [ makeWrapper ];
16
17 installPhase = ''
18 mkdir -p $out/bin
19 install -D $src $out/libexec/phpstan/phpstan.phar
20 makeWrapper ${php}/bin/php $out/bin/phpstan \
21 --add-flags "$out/libexec/phpstan/phpstan.phar"
22 '';
23
24 meta = with lib; {
25 description = "PHP Static Analysis Tool";
26 longDescription = ''
27 PHPStan focuses on finding errors in your code without actually
28 running it. It catches whole classes of bugs even before you write
29 tests for the code. It moves PHP closer to compiled languages in the
30 sense that the correctness of each line of the code can be checked
31 before you run the actual line.
32 '';
33 license = licenses.mit;
34 homepage = "https://github.com/phpstan/phpstan";
35 maintainers = teams.php.members;
36 };
37}