Commit a1e85db7 authored by Pol Dellaiera's avatar Pol Dellaiera
Browse files

phpPackages.phpstan: use `buildComposerProject` builder

parent 043a094c
Loading
Loading
Loading
Loading
+13 −25
Original line number Diff line number Diff line
{ mkDerivation, fetchurl, makeWrapper, lib, php }:
{ fetchFromGitHub, lib, php }:

let
php.buildComposerProject (finalAttrs: {
  pname = "phpstan";
  version = "1.10.37";
in
mkDerivation {
  inherit pname version;

  src = fetchurl {
    url = "https://github.com/phpstan/phpstan/releases/download/${version}/phpstan.phar";
    sha256 = "sha256-i1h3N11MsKhHx/RJxAthnUbjacA5yZJF6bzmQnmEKzg=";
  src = fetchFromGitHub {
    owner = "phpstan";
    repo = "phpstan-src";
    rev = finalAttrs.version;
    hash = "sha256-y55bfwE3H/oDCwDq3wrClyX8dhk0p6vEl/CMhqN6LkA=";
  };

  dontUnpack = true;
  vendorHash = "sha256-hjCfrmpn2rYgApenZkHX8fXqPXukh7BVKENkvwIk8Dk=";

  nativeBuildInputs = [ makeWrapper ];

  installPhase = ''
    runHook preInstall
    mkdir -p $out/bin
    install -D $src $out/libexec/phpstan/phpstan.phar
    makeWrapper ${php}/bin/php $out/bin/phpstan \
      --add-flags "$out/libexec/phpstan/phpstan.phar"
    runHook postInstall
  '';

  meta = with lib; {
    changelog = "https://github.com/phpstan/phpstan/releases/tag/${version}";
  meta = {
    changelog = "https://github.com/phpstan/phpstan/releases/tag/${finalAttrs.version}";
    description = "PHP Static Analysis Tool";
    longDescription = ''
      PHPStan focuses on finding errors in your code without actually
@@ -35,8 +23,8 @@ mkDerivation {
      sense that the correctness of each line of the code can be checked
      before you run the actual line.
    '';
    license = licenses.mit;
    license = lib.licenses.mit;
    homepage = "https://github.com/phpstan/phpstan";
    maintainers = teams.php.members;
    maintainers = lib.teams.php.members;
  };
}
})