From 5cdbc70068aa555f48fb4bf2421d71fd8ea575d0 Mon Sep 17 00:00:00 2001
From: Tim Rohaly <tr@202830.no-reply.drupal.org>
Date: Tue, 25 Feb 2025 17:41:51 -0800
Subject: [PATCH 1/2] Issue #3509022 by tr: Add phpstan.neon to ignore some
 phpstan warnings

---
 phpstan.neon | 9 +++++++++
 1 file changed, 9 insertions(+)
 create mode 100644 phpstan.neon

diff --git a/phpstan.neon b/phpstan.neon
new file mode 100644
index 0000000..8aba8b1
--- /dev/null
+++ b/phpstan.neon
@@ -0,0 +1,9 @@
+parameters:
+  level: 1
+
+  ignoreErrors:
+    -
+      message: '#\Drupal calls should be avoided in classes, use dependency injection instead#'
+      paths:
+        - src/VoteResultStorage.php
+        - src/VoteStorage.php
-- 
GitLab


From 11ac231ebb1418bd5b5a452fd768faf0390d7629 Mon Sep 17 00:00:00 2001
From: Tim Rohaly <tr@202830.no-reply.drupal.org>
Date: Tue, 25 Feb 2025 17:48:12 -0800
Subject: [PATCH 2/2] new static()

---
 phpstan.neon | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/phpstan.neon b/phpstan.neon
index 8aba8b1..25f7b6a 100644
--- a/phpstan.neon
+++ b/phpstan.neon
@@ -7,3 +7,13 @@ parameters:
       paths:
         - src/VoteResultStorage.php
         - src/VoteStorage.php
+
+    # new static() is a best practice in Drupal, so we cannot fix that.
+    # @see https://www.drupal.org/docs/develop/development-tools/phpstan/handling-unsafe-usage-of-new-static
+    -
+      message: "#^Unsafe usage of new static#"
+      paths:
+        - src/Form/SettingsForm.php
+        - src/Form/VoteDeleteConfirm.php
+        - src/Form/VoteTypeDeleteConfirm.php
+        - src/VoteTypeForm.php
-- 
GitLab