Closed (fixed)
Project:
OpenID Connect Client
Version:
2.2.0
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
5 Jan 2024 at 10:39 UTC
Updated:
23 Jan 2024 at 20:24 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
jonasanne commentedIn this code modification, I enhanced the UserMailUniqueValidator class in the UserMailUniqueValidator.php file. The changes involve refactoring the constructor to leverage property promotion, which is a feature introduced in PHP 8.0. This helps simplify the code by declaring and initializing class properties directly within the constructor parameters.
Here's a breakdown of the changes:
Property Promotion in Constructor:
I replaced the individual property declarations and assignments in the constructor with property promotion.
Introduced property promotion for the AuthmapInterface, OpenidConnectRealmManagerInterface, EntityFieldManagerInterface, and EntityTypeManagerInterface properties.
Constructor Parameter Removal:
Removed the unnecessary parameters from the constructor, as property promotion takes care of both declaration and initialization.
Dependency Injection Enhancement:
Updated the create method to include the new dependencies (EntityFieldManagerInterface and EntityTypeManagerInterface) when instantiating the class.
Comment #3
jelle_sCode style: space after
$realm_manager,Code style: rename
$realm_managerto$realmManagerDrupal uses snake_case for method arguments, but camelCase for properties; I believe the fact you're defining a property here has precedence over the fact that it's a constructor argument.
Revert this change based on previous remark.
Comment #4
matthijsThanks for your merge request!
I'm not a big fan constructor property promotion since it causes mixed casing for class properties or function arguments, so please change that as well.
Comment #6
viren18febs commentedI have fixed the reported issues and added a patch file please review
Thanks
Comment #8
matthijsPatch committed, thanks for the effort!