From 21145774834ae56600557dae81b5c574f2af0436 Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Fri, 27 Dec 2024 23:24:05 +0800 Subject: [PATCH] refactor: fix warning on new static usage --- tests/_support/Entity/CustomUser.php | 4 ++-- utils/phpstan-baseline/loader.neon | 1 - utils/phpstan-baseline/new.static.neon | 8 -------- 3 files changed, 2 insertions(+), 11 deletions(-) delete mode 100644 utils/phpstan-baseline/new.static.neon diff --git a/tests/_support/Entity/CustomUser.php b/tests/_support/Entity/CustomUser.php index 0ba0c73e451b..94a6ae3345ab 100644 --- a/tests/_support/Entity/CustomUser.php +++ b/tests/_support/Entity/CustomUser.php @@ -26,7 +26,7 @@ * @property string $name * @property Time|null $updated_at */ -class CustomUser +final class CustomUser { private function __construct( private readonly int $id, @@ -40,7 +40,7 @@ private function __construct( public static function reconstruct(array $data): static { - return new static( + return new self( $data['id'], $data['name'], $data['email'], diff --git a/utils/phpstan-baseline/loader.neon b/utils/phpstan-baseline/loader.neon index 40d901a7ab2d..8118710b2257 100644 --- a/utils/phpstan-baseline/loader.neon +++ b/utils/phpstan-baseline/loader.neon @@ -43,7 +43,6 @@ includes: - missingType.parameter.neon - missingType.property.neon - missingType.return.neon - - new.static.neon - notIdentical.alwaysTrue.neon - nullCoalesce.expr.neon - nullCoalesce.property.neon diff --git a/utils/phpstan-baseline/new.static.neon b/utils/phpstan-baseline/new.static.neon deleted file mode 100644 index b6195e61eb0b..000000000000 --- a/utils/phpstan-baseline/new.static.neon +++ /dev/null @@ -1,8 +0,0 @@ -# total 1 error - -parameters: - ignoreErrors: - - - message: '#^Unsafe usage of new static\(\)\.$#' - count: 1 - path: ../../tests/_support/Entity/CustomUser.php