Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deal with null type in PHP8.2 #1205

Merged
merged 2 commits into from Apr 15, 2023
Merged

Conversation

thomasschiet
Copy link
Contributor

@thomasschiet thomasschiet commented Jan 16, 2023

Because the null type in PHP 8.2 is nullable, the formatNullableType method appends |null to thenull type. This results in null|null as a generated return type. When parsing, this results in the following error:

PHP Fatal error:  Duplicate type null is redundant 

This PR fixes this by simply formatting returning null when the passed type is null.

Fixes #1204.

@cosmastech
Copy link

Just ran into this issue today.

Would love to see this get merged 👍

Copy link
Member

@ghostwriter ghostwriter left a comment

Choose a reason for hiding this comment

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

Hi,

I just wanted to apologize for the delay in reviewing your pull request.

I'm going to rebase and merge this pull request now.

Thanks for your patience and for your contribution to the project!

@ghostwriter ghostwriter changed the base branch from master to 1.5.x April 15, 2023 03:32
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
@ghostwriter ghostwriter merged commit 8c19e1a into mockery:1.5.x Apr 15, 2023
1 of 5 checks passed
@thomasschiet thomasschiet deleted the fix/1204 branch April 17, 2023 08:11
@ghostwriter ghostwriter added this to the 1.5.2 milestone Apr 20, 2023
@ghostwriter ghostwriter mentioned this pull request Apr 22, 2023
@ghostwriter ghostwriter added Patch Backwards compatible bug fixes and improvements Fixed for bug fixes or error corrections labels Apr 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fixed for bug fixes or error corrections Patch Backwards compatible bug fixes and improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PHP Fatal error: Duplicate type null is redundant
3 participants