Skip to content

Conversation

@wiewiurdp
Copy link
Contributor

🎫 Issue IBX-10507

Description:

Allowed nullable type declarations for method parameters across the codebase

@wiewiurdp wiewiurdp changed the base branch from main to 4.6 September 23, 2025 09:43
@wiewiurdp wiewiurdp marked this pull request as ready for review September 23, 2025 09:50
@wiewiurdp wiewiurdp requested a review from a team September 23, 2025 09:50
@ezrobot ezrobot requested review from Steveb-p, ViniTou, adamwojs, alongosz, barw4, ciastektk, konradoboza, mikadamczyk and tbialcz and removed request for a team September 23, 2025 09:50
*/
public function resetUserPassword(
UserPasswordResetData $data = null,
?UserPasswordResetData $data = null,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we enforce $data to be just UserPasswordData without null if we really don't support null?

In the user package it's executed only in 1 place where $data is not null

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, but for the sake of efficiency let's stick to original task which is (getting rid of deprecated syntax instead of evaluating each case separately) 😉

Comment on lines 55 to 57
if ($data->getEmail() === null){
throw new InvalidArgumentException('Email cannot be null');
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do we need this check ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because of phpstan Error:


 ------ ------------------------------------------------------------------------------------------------------------------------------------ 
  Line   src/bundle/Controller/UserInvitationController.php                                                                                  
 ------ ------------------------------------------------------------------------------------------------------------------------------------ 
  58     Parameter #1 $email of class Ibexa\Contracts\User\Invitation\InvitationCreateStruct constructor expects string, string|null given.  
         🪪  argument.type                                                                                                                   
 ------ --------------------------------------------------------------------

@sonarqubecloud
Copy link

sonarqubecloud bot commented Oct 1, 2025

@wiewiurdp wiewiurdp merged commit 76dc302 into 4.6 Oct 1, 2025
14 checks passed
@wiewiurdp wiewiurdp deleted the IBX-10507-fixing-implicitly-nullable-parameters branch October 1, 2025 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants