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

Fix Parsing of Optional Types Annotations in DataIterableAnnotation #808

Merged
merged 2 commits into from
Jul 25, 2024

Conversation

clementbirkle
Copy link
Contributor

This PR fixes an issue where DataIterableAnnotation couldn't correctly identify data types with optional parameters.

Previously, the test for "is data" returned:

// Previously failed
@param \Spatie\LaravelData\DataCollection<\Spatie\LaravelData\Tests\Fakes\SimpleData>|null $paramK (false)

// Previously worked
@param null|\Spatie\LaravelData\DataCollection<\Spatie\LaravelData\Tests\Fakes\SimpleData> $paramK (true)

Now, the test returns true for both cases, ensuring accurate data type identification regardless of optional parameters like |null.

@rubenvanassche
Copy link
Member

Cool, thanks!

@rubenvanassche rubenvanassche merged commit d1f9731 into spatie:main Jul 25, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants