Skip to content

Ramsey\Uuid\Nonstandard namespace conflicts with itself in standalone builds #490

@tucson-tom

Description

@tucson-tom

This library is used by Google Cloud APIs (BigQuery in particular). When this library is imported as part of a standalone build, the Nonstandard namespace conflicts with itself.

Description

Ramsey\Uuid\Nonstandard creates a Uuid class that conflicts with Ramsey\Uuid\Uuid when use Ramsey\Uuid\Uuid is encountered later in the same namespace by PHP because "Uuid" is already defined as a class. PHP has no idea which class to use and so it throws up a Fatal error.

Steps to reproduce

  1. Run PHP Decomposer to generate a standalone build of Google Cloud BigQuery.
  2. Get this lovely and very confusing error message when linting the output: PHP Fatal error: Cannot use Ramsey\Uuid\Uuid as Uuid because the name is already in use in C:\php-decomposer\projects\google-cloud-apis\final\google-cloud-apis_decomposed.php on line 47783.

Expected behavior

Non-conflicting namespace and class names.

Suggested fix

In vendor\ramsey\uuid\src\Nonstandard\UuidV6.php, change:

use Ramsey\Uuid\Uuid;

class UuidV6 extends Uuid implements UuidInterface

To:

use Ramsey\Uuid\Uuid as BaseUuid;

class UuidV6 extends BaseUuid implements UuidInterface

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions