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

Add support for enum default arguments using enum cases #1464

Merged
merged 7 commits into from
Feb 7, 2024

Conversation

d8vjork
Copy link
Contributor

@d8vjork d8vjork commented Aug 28, 2023

Summary

Fixes #1463

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • Existing tests have been adapted and/or new tests have been added
  • Add a CHANGELOG.md entry
  • Update the README.md
  • Code style has been fixed via composer fix-style

@d8vjork d8vjork changed the title Add case when default value is of type enum Add support for enum default arguments using enum cases Aug 28, 2023
@mfn
Copy link
Collaborator

mfn commented Aug 28, 2023

Can you please add a test too?

@d8vjork
Copy link
Contributor Author

d8vjork commented Aug 28, 2023

@mfn Will try, don't know if there are tests for these default values, I was looking around and didn't found something I can adapt to this, or do you think I should add a new folder instead?

@d8vjork
Copy link
Contributor Author

d8vjork commented Aug 28, 2023

Ok I reply myself, I think this should go in a new folder so we can mark it as PHP 8+ only as these enums won't work on PHP 7 tests

@d8vjork
Copy link
Contributor Author

d8vjork commented Aug 28, 2023

Ok tests added and passing on PHP 8.2, also added same way it was done for Laravel 9 only tests (a condition to check if PHP 8.1+ is running otherwise markAsSkipped the test)

@@ -17,7 +17,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.0
php-version: 8.1
Copy link
Owner

Choose a reason for hiding this comment

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

Otherwise the UnitEnum does not exist

Copy link
Collaborator

Choose a reason for hiding this comment

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

Probably always should run on the latest stable (would be 8.2)

@barryvdh barryvdh merged commit f64ff9c into barryvdh:master Feb 7, 2024
33 checks passed
d3v2a pushed a commit to d3v2a/laravel-ide-helper that referenced this pull request Feb 16, 2024
* add case when default value is of type enum

* Update CHANGELOG.md

* add tests for enum arguments default values

* ignore psalm issue (built-in `\UnitEnum` class does not exists in PHP7)

* Update run-static-analysis.yml to use PHP8.1

---------

Co-authored-by: Barry vd. Heuvel <[email protected]>
Co-authored-by: Barry vd. Heuvel <[email protected]>
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.

Default values as enums cases
3 participants