Skip to content

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

Open

Description

@drinkynet

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

Activity

  1. drinkynet commented on Jun 8, 2022

    @drinkynet
    ContributorAuthor

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

    Snippet of PropertyEnumeration.php

  2. drinkynet commented on Jun 8, 2022

    @drinkynet
    ContributorAuthor

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

  3. nathansalter commented on Jun 8, 2022

    @nathansalter
    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.

  4. nathansalter commented on Jun 8, 2022

    @nathansalter
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions