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