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
Union type like "array|string|null" or "string|int|null" crashes Mockery #1105
Comments
What version of mockery are you using? |
1.4.2. |
LeSuisse
changed the title
Union type like "array|string|null" or "" crashes Mockery
Union type like "array|string|null" or "string|int|null" crashes Mockery
Dec 1, 2020
LeSuisse
added a commit
to LeSuisse/mockery
that referenced
this issue
Dec 6, 2020
This change prevents the generation of type hints with 2 "null". For example, "string|array|null" should generate the code "string|array|null" instead of "string|array|null|null" to avoid a PHP fatal error "Duplicate type null is redundant". Closes mockery#1105.
LeSuisse
added a commit
to LeSuisse/mockery
that referenced
this issue
Dec 7, 2020
This change prevents the generation of type hints with 2 "null". For example, "string|array|null" should generate the code "string|array|null" instead of "string|array|null|null" to avoid a PHP fatal error "Duplicate type null is redundant". Closes mockery#1105.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The following code snippet crashes when the code generated by Mockery is evaluated.
In this situation, the generated code looks like this:
I found this issue because of a mock of a class provided by a PHP extension, so I took a quick look at the other classes declared in my environment. At least the following classes are affected:
MultipleIterator::class
DOMXPath::class
IntlDateFormatter::class
Phar::class
PharData::class
SoapFault::class
SoapHeader::class
XSLTProcessor::class
ZipArchive::class
It seems the support introduced by #1088 needs to be improved a bit to manage this case. I will try to take a look later this week.
The text was updated successfully, but these errors were encountered: