From 88ecf98cba55c69120e417f883b8598207cb417f Mon Sep 17 00:00:00 2001 From: seb-jean Date: Mon, 6 May 2024 20:12:35 +0200 Subject: [PATCH 1/2] Update UserClassBuilder.php --- src/Security/UserClassBuilder.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Security/UserClassBuilder.php b/src/Security/UserClassBuilder.php index 261780368..a7a44afeb 100644 --- a/src/Security/UserClassBuilder.php +++ b/src/Security/UserClassBuilder.php @@ -216,7 +216,7 @@ private function addGetPassword(ClassSourceManipulator $manipulator, UserClassCo $manipulator->addGetter( 'password', - 'string', + '?string', true ); @@ -231,7 +231,7 @@ private function addGetPassword(ClassSourceManipulator $manipulator, UserClassCo $manipulator->addAccessorMethod( 'password', 'getPassword', - 'string', + '?string', false, [ '@see PasswordAuthenticatedUserInterface', From bea51b55c68bac5c58d2d092a71dc3c523918385 Mon Sep 17 00:00:00 2001 From: Jesse Rushlow Date: Mon, 17 Jun 2024 08:41:25 -0400 Subject: [PATCH 2/2] fix nullable return type --- src/Security/UserClassBuilder.php | 6 +++--- .../fixtures/expected/UserEntityWithEmailAsIdentifier.php | 2 +- tests/Security/fixtures/expected/UserEntityWithPassword.php | 2 +- .../expected/UserEntityWithUser_IdentifierAsIdentifier.php | 2 +- .../fixtures/expected/UserModelWithEmailAsIdentifier.php | 2 +- tests/Security/fixtures/expected/UserModelWithPassword.php | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Security/UserClassBuilder.php b/src/Security/UserClassBuilder.php index a7a44afeb..e99af57dc 100644 --- a/src/Security/UserClassBuilder.php +++ b/src/Security/UserClassBuilder.php @@ -216,7 +216,7 @@ private function addGetPassword(ClassSourceManipulator $manipulator, UserClassCo $manipulator->addGetter( 'password', - '?string', + 'string', true ); @@ -231,8 +231,8 @@ private function addGetPassword(ClassSourceManipulator $manipulator, UserClassCo $manipulator->addAccessorMethod( 'password', 'getPassword', - '?string', - false, + 'string', + true, [ '@see PasswordAuthenticatedUserInterface', ] diff --git a/tests/Security/fixtures/expected/UserEntityWithEmailAsIdentifier.php b/tests/Security/fixtures/expected/UserEntityWithEmailAsIdentifier.php index 71d2e49fa..d053ec604 100644 --- a/tests/Security/fixtures/expected/UserEntityWithEmailAsIdentifier.php +++ b/tests/Security/fixtures/expected/UserEntityWithEmailAsIdentifier.php @@ -83,7 +83,7 @@ public function setRoles(array $roles): static /** * @see PasswordAuthenticatedUserInterface */ - public function getPassword(): string + public function getPassword(): ?string { return $this->password; } diff --git a/tests/Security/fixtures/expected/UserEntityWithPassword.php b/tests/Security/fixtures/expected/UserEntityWithPassword.php index dc4999299..ae4158d56 100644 --- a/tests/Security/fixtures/expected/UserEntityWithPassword.php +++ b/tests/Security/fixtures/expected/UserEntityWithPassword.php @@ -78,7 +78,7 @@ public function setRoles(array $roles): static /** * @see PasswordAuthenticatedUserInterface */ - public function getPassword(): string + public function getPassword(): ?string { return $this->password; } diff --git a/tests/Security/fixtures/expected/UserEntityWithUser_IdentifierAsIdentifier.php b/tests/Security/fixtures/expected/UserEntityWithUser_IdentifierAsIdentifier.php index a77a08fed..709982a4a 100644 --- a/tests/Security/fixtures/expected/UserEntityWithUser_IdentifierAsIdentifier.php +++ b/tests/Security/fixtures/expected/UserEntityWithUser_IdentifierAsIdentifier.php @@ -78,7 +78,7 @@ public function setRoles(array $roles): static /** * @see PasswordAuthenticatedUserInterface */ - public function getPassword(): string + public function getPassword(): ?string { return $this->password; } diff --git a/tests/Security/fixtures/expected/UserModelWithEmailAsIdentifier.php b/tests/Security/fixtures/expected/UserModelWithEmailAsIdentifier.php index 062108367..d08e3b66e 100644 --- a/tests/Security/fixtures/expected/UserModelWithEmailAsIdentifier.php +++ b/tests/Security/fixtures/expected/UserModelWithEmailAsIdentifier.php @@ -67,7 +67,7 @@ public function setRoles(array $roles): static /** * @see PasswordAuthenticatedUserInterface */ - public function getPassword(): string + public function getPassword(): ?string { return $this->password; } diff --git a/tests/Security/fixtures/expected/UserModelWithPassword.php b/tests/Security/fixtures/expected/UserModelWithPassword.php index 6c4dcafc5..fd2e86898 100644 --- a/tests/Security/fixtures/expected/UserModelWithPassword.php +++ b/tests/Security/fixtures/expected/UserModelWithPassword.php @@ -62,7 +62,7 @@ public function setRoles(array $roles): static /** * @see PasswordAuthenticatedUserInterface */ - public function getPassword(): string + public function getPassword(): ?string { return $this->password; }