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

Reserved word 'Abstract' used in PropertyEnumeration.php #102

Open
drinkynet opened this issue Jun 8, 2022 · 4 comments
Open

Reserved word 'Abstract' used in PropertyEnumeration.php #102

drinkynet opened this issue Jun 8, 2022 · 4 comments
Labels
bug Something isn't working

Comments

@drinkynet
Copy link
Contributor

drinkynet commented Jun 8, 2022

Method OrderItem::setAttendeeDetailsRequired() expects an argument of type \OpenActive\Enums\PropertyEnumeration[] or null passing it an array of instances of Enums (GivenName & FamilyName) generates this syntax error:

PHP Parse error: syntax error, unexpected 'Abstract' (T_ABSTRACT), expecting identifier (T_STRING) in .../vendor/openactive/models/src/Enums/PropertyEnumeration.php on line 88

Line 88 of \OpenActive\Enums\PropertyEnumeration attempts to declare a const called Abstract, which isn't allowed.

Snippet from \OpenActive\Enums\PropertyEnumeration

@drinkynet
Copy link
Contributor Author

It also doesn't like the use of Yield on line 1533

Snippet of PropertyEnumeration.php

@drinkynet
Copy link
Contributor Author

drinkynet commented Jun 8, 2022

Commenting out lines 88 and 1533 lets it work as a quick and dirty fix.

@nathansalter
Copy link
Contributor

This will also happen for any of the reserved PHP words https://www.php.net/manual/en/reserved.keywords.php

After removing words which I feel are unlikely, the list is this:

abstract
break
case
catch
class
clone
const
continue
declare
default
extends
final
finally
for
global
implements
include
interface
list
namespace
new
print
private
protected
public
readonly
require
static
switch
throw
use
while
yield

We should put something in the model generator library to do something else here.

@nathansalter nathansalter added the bug Something isn't working label Jun 8, 2022
@nathansalter
Copy link
Contributor

Worth noting that:

$v = new OpenActive\Enums\PropertyEnumeration\GivenName;

Works in PHP 8.0+, but fails in earlier PHP versions. Calling $t = new OpenActive\Enums\PropertyEnumeration\Abstract; never works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants