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