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

Change enum type from string[] to string[]|int[]|float[] #1233

Merged
merged 1 commit into from
May 12, 2022

Conversation

berrugo
Copy link
Contributor

@berrugo berrugo commented May 12, 2022

At the moment you can only use strings in enum, if you use integer or floats, static code analyzers such as Psalm will trigger an error.

E.g.
When defining an enum of integer values like the one below:
#[OA\Property(enum: [123, 456, 789], default: 123)]

Psalm will trigger an InvalidScalarArgument (https://psalm.dev/docs/running_psalm/issues/InvalidScalarArgument/)
Argument 1 of OpenApi\Attributes\Property::__construct expects array<array-key, string>|null, array{123, 456, 789} provided

Thanks @tm1000 for pointing in this direction

@DerManoMann
Copy link
Collaborator

I hope you didn't update the docs .md files manually - there is a script for that.... I usually just forget to commit the changes as the gh-pages workflow uses the same code.
OTOH, it certainly would be nice to keep the checked in markup files up-to-date...

@berrugo
Copy link
Contributor Author

berrugo commented May 12, 2022

I updated the docs automatically using the docs:build script in the composer file. Also the tests and linter passed

@berrugo berrugo marked this pull request as ready for review May 12, 2022 15:57
@DerManoMann DerManoMann merged commit a9226e8 into zircote:master May 12, 2022
@DerManoMann
Copy link
Collaborator

Thanks @berrugo

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