From 42b65494dd788f366d0cda0e1be857804b77c4e0 Mon Sep 17 00:00:00 2001 From: Si Hobbs <38379-sime@users.noreply.drupalcode.org> Date: Mon, 10 Jun 2024 18:29:50 +0000 Subject: [PATCH] Issue #3453101 by sime, phenaproxima, mstrelan: phpstan.neon.dist fixes - Get phpstan to level 1 --- .../ProjectBrowserSourceExample.php | 1 - phpstan.neon | 11 +++++++++++ phpstan.neon.dist | 11 ----------- .../ProjectBrowserSource/DrupalDotOrgJsonApi.php | 2 +- 4 files changed, 12 insertions(+), 13 deletions(-) create mode 100644 phpstan.neon delete mode 100644 phpstan.neon.dist diff --git a/modules/project_browser_source_example/src/Plugin/ProjectBrowserSource/ProjectBrowserSourceExample.php b/modules/project_browser_source_example/src/Plugin/ProjectBrowserSource/ProjectBrowserSourceExample.php index 5d150425e..d8de23d01 100644 --- a/modules/project_browser_source_example/src/Plugin/ProjectBrowserSource/ProjectBrowserSourceExample.php +++ b/modules/project_browser_source_example/src/Plugin/ProjectBrowserSource/ProjectBrowserSourceExample.php @@ -159,7 +159,6 @@ class ProjectBrowserSourceExample extends ProjectBrowserSourceBase { // Images: Array of images using the same structure as $logo, above. images: [], ); - // @phpstan-ignore-next-line $pb_path = $this->moduleExtensionList->getPath('project_browser'); $projects[] = new Project( logo: $logo, diff --git a/phpstan.neon b/phpstan.neon new file mode 100644 index 000000000..f715d17e0 --- /dev/null +++ b/phpstan.neon @@ -0,0 +1,11 @@ +parameters: + level: 1 + reportUnmatchedIgnoredErrors: true + excludePaths: + # The node_modules contains some PHP to ignore. + - sveltejs + # Every ignore should be documented. + ignoreErrors: + - + # @see https://www.drupal.org/docs/develop/development-tools/phpstan/handling-unsafe-usage-of-new-static#s-ignoring-the-issue + identifier: new.static diff --git a/phpstan.neon.dist b/phpstan.neon.dist deleted file mode 100644 index fc7542cbf..000000000 --- a/phpstan.neon.dist +++ /dev/null @@ -1,11 +0,0 @@ -includes: - - %rootDir%/../../../web/core/phpstan.neon.dist - -parameters: - excludePaths: - - src/Commands/* - ignoreErrors: - # Drupal core's PHPStan config file ignores the non-anonymous variant of this. - - "#^Anonymous class extends @internal class#" - # Drupal core needs to ignore more things than we need to! - reportUnmatchedIgnoredErrors: false diff --git a/tests/modules/project_browser_test/src/Plugin/ProjectBrowserSource/DrupalDotOrgJsonApi.php b/tests/modules/project_browser_test/src/Plugin/ProjectBrowserSource/DrupalDotOrgJsonApi.php index 544ecd48a..ac2690aac 100644 --- a/tests/modules/project_browser_test/src/Plugin/ProjectBrowserSource/DrupalDotOrgJsonApi.php +++ b/tests/modules/project_browser_test/src/Plugin/ProjectBrowserSource/DrupalDotOrgJsonApi.php @@ -561,7 +561,7 @@ class DrupalDotOrgJsonApi extends ProjectBrowserSourceBase { return (int) ( $version_object->getMajorVersion() . - str_pad($minor_version ?? 0, 3, '0', STR_PAD_LEFT) . + str_pad($minor_version, 3, '0', STR_PAD_LEFT) . str_pad($patch_version, 3, '0', STR_PAD_LEFT) ); } -- GitLab