From 9fa92211456dff6f11b669e793c67ef4639055c8 Mon Sep 17 00:00:00 2001 From: octoseth <71984208+octoseth@users.noreply.github.com> Date: Sat, 7 Dec 2024 12:06:06 +0100 Subject: [PATCH] Keep the 'is' prefix on a boolean property when making the setter --- src/Util/ClassSourceManipulator.php | 4 ---- templates/verifyEmail/EmailVerifier.tpl.php | 2 +- tests/Util/fixtures/add_setter/User_bool_begins_with_is.php | 2 +- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/Util/ClassSourceManipulator.php b/src/Util/ClassSourceManipulator.php index 25b57bdbb..ec3534496 100644 --- a/src/Util/ClassSourceManipulator.php +++ b/src/Util/ClassSourceManipulator.php @@ -485,10 +485,6 @@ private function createSetterNodeBuilder(string $propertyName, $type, bool $isNu private function getSetterName(string $propertyName, $type): string { - if ('bool' === $type && 0 === strncasecmp($propertyName, 'is', 2)) { - return 'set'.Str::asCamelCase(substr($propertyName, 2)); - } - return 'set'.Str::asCamelCase($propertyName); } diff --git a/templates/verifyEmail/EmailVerifier.tpl.php b/templates/verifyEmail/EmailVerifier.tpl.php index f5e37f7f2..85422dfc9 100644 --- a/templates/verifyEmail/EmailVerifier.tpl.php +++ b/templates/verifyEmail/EmailVerifier.tpl.php @@ -43,7 +43,7 @@ public function handleEmailConfirmation(Request $request, verifyEmailHelper->validateEmailConfirmationFromRequest($request, (string) $user->(), (string) $user->()); - $user->setVerified(true); + $user->setIsVerified(true); $this->entityManager->persist($user); $this->entityManager->flush(); diff --git a/tests/Util/fixtures/add_setter/User_bool_begins_with_is.php b/tests/Util/fixtures/add_setter/User_bool_begins_with_is.php index 7b52a6158..f55b60a4f 100644 --- a/tests/Util/fixtures/add_setter/User_bool_begins_with_is.php +++ b/tests/Util/fixtures/add_setter/User_bool_begins_with_is.php @@ -17,7 +17,7 @@ public function getId(): ?int return $this->id; } - public function setFooProp(bool $isFooProp): static + public function setIsFooProp(bool $isFooProp): static { $this->isFooProp = $isFooProp;