Subject: [PATCH v4 25/98] gnu: Add php-phpstan-phpdoc-parser.

From: Nicolas Graves <[email-masked]>
Date: Mon, 7 Oct 2024 23:43:53 +0200

* gnu/packages/php-xyz.scm (php-phpstan-phpdoc-parser): New variable.

Change-Id: Ia6fc12ef3b3ccccde0dec0528f473369c0ddc4a1
---
 gnu/packages/php-xyz.scm | 40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/gnu/packages/php-xyz.scm b/gnu/packages/php-xyz.scm
index 9822bba3de..7f48a9cf67 100644
--- a/gnu/packages/php-xyz.scm
+++ b/gnu/packages/php-xyz.scm
@@ -639,3 +639,43 @@ (define-public php-phpspec-prophecy
     (home-page "https://github.com/phpspec/prophecy")
     (license license:expat)))
 
+(define-public php-phpstan-phpdoc-parser
+  (package
+    (name "php-phpstan-phpdoc-parser")
+    (version "1.24.2")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/phpstan/phpdoc-parser")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0sdnij33y0baqi4wzspzr67id00vk1p0n851s2a056njpyym65lv"))
+       (snippet '(begin
+                   (delete-file "tests/abnfgen-0.20.tar.gz")
+                   (delete-file "build-abnfgen.sh")))))
+    (build-system composer-build-system)
+    (arguments
+     (list
+      #:test-flags ''("--bootstrap" "vendor/autoload.php")
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'unbundle-abnfgen
+            (lambda _
+              (substitute* "tests/PHPStan/Parser/FuzzyTest.php"
+                (("__DIR__ \\. '/\\.\\./\\.\\./\\.\\./tools/abnfgen/abnfgen'")
+                 (string-append "'" #$(this-package-native-input "abnfgen")
+                                "/bin/abnfgen'"))))))))
+    (native-inputs
+     (list abnfgen
+           php-phpunit-phpunit
+           php-symfony-process
+           php-doctrine-annotations))
+    (synopsis "PHPDoc parser")
+    (description
+     "This package provides a PHPDoc parser with support for nullable,
+intersection and generic types.")
+    (home-page "https://github.com/phpstan/phpdoc-parser")
+    (license license:expat)))
+
-- 
2.46.0