overblog/GraphQLBundle

Native PHP Enum fails

nkamuo opened this issue · 16 comments

Q A
Bug report? yes
Feature request? no
BC Break report? yes
RFC? no
Version/Branch 0.15.2

Using PHP 8.1 native Enum with #[Enum] Attributes Fails.

I have an Enum File with the following contents

Vincz commented

Hey @nkamuo! Enum are supposed to work with the latest branch. What is your problem with the Enum? Can you share a piece of code?

I have a PHP Enum File with the Following contents:

And I get this Error:

Invalid type for path "overblog_graphql_types.VehicleStatus._enum_config.values.PENDING.value". Expected "scalar",
but got "App\Entity\Transport\Vehicle\VehicleStatus".

Vincz commented

Can you post your enum?

`<?php
namespace App\Entity\Transport\Vehicle;
use Overblog\GraphQLBundle\Annotation\Enum;

#[Enum]
enum VehicleStatus: string{

case PENDING = 'pending';

case ACTIVE = 'active';

case SUSPENDED = 'suspended';

}
`

Same here with v0.14.

Same for me @ v0.14.

Native PHP 8.1 enums work for me on master branch. Are they supposted to work also on 0.15? @Vincz

eteos commented

I think the issue is that the latest GraphQLBundle version (0.15.2) requires "webonyx/graphql-php": "^14.5", whilst webonyx enum support is in "webonyx/graphql-php": "^15.0"

I think the issue is that the latest GraphQLBundle version (0.15.2) requires "webonyx/graphql-php": "^14.5", whilst webonyx enum support is in "webonyx/graphql-php": "^15.0"

How do you sugget I resolve this?

Native PHP 8.1 enums work for me on master branch. Are they supposted to work also on 0.15? @Vincz

It doesn't work for me. Do you use any special config to make it work?

Vincz commented

Yes, the problem is the dependency to webonyx/graphql-php version 14.x. The support was added in v15.0.0
This week, I'll fix the remaining tests and publish a v0.15.3.

any updates here? for me still not working, and as far as I can see v0.15.3 still not released?

Vincz commented

Hi @bogdandubyk! We are waiting a couple of days for #1119, #1071 and #1108 to get fixed by their respective contributors and we will publish a new release.

sure, thank you for the quick response, I'll use dev-master for now on the local machine

Hi @bogdandubyk! We are waiting a couple of days for #1119, #1071 and #1108 to get fixed by their respective contributors and we will publish a new release.

Sorry, but now I don't have free time for #1108

Maybe we release this issue later in another release?

Vincz commented

The v1.0 has been released !