Skip to content

Conversation

zorac
Copy link
Contributor

@zorac zorac commented Aug 8, 2023

PHP 8.1 added native enumerations, but currently using an enum case as a value definition generates an error when attempting to compile the container: An object was found but objects cannot be compiled. This change simply allows objects which are enum cases to be compiled. I've also added tests for enum cases as value definitions.

@mnapoli
Copy link
Member

mnapoli commented Aug 8, 2023

Great PR, thanks!

There seem to be some failures with some jobs, but happy to merge once that's fixed 👍

@zorac
Copy link
Contributor Author

zorac commented Aug 8, 2023

OK, as Psalm is running on PHP 8.0, it doesn't like the reference to the PHP 8.1-only UnitEnum interface, even after adding a version check, so I've added a @psalm-suppress for that.

The coding standards fixer is complaining about something in a file I didn't touch, so possibly something's changed in their rules? Rather than changing a user-facing class, I've disabled the offending rule in .php-cs-fixer.php which allows it to run without changing things either way. (It doesn't help that the documentation for this rule uses conflicting names, and doesn't appear to match the observed behaviour... https://cs.symfony.com/doc/rules/function_notation/nullable_type_declaration_for_default_null_value.html)

@mnapoli
Copy link
Member

mnapoli commented Aug 10, 2023

Aweeeesome!

@mnapoli mnapoli merged commit 9ea40a5 into PHP-DI:master Aug 10, 2023
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