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

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

Closed
tucson-tom opened this issue Jan 17, 2023 · 2 comments · Fixed by #495
Closed

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

tucson-tom opened this issue Jan 17, 2023 · 2 comments · Fixed by #495
Labels

Comments

@tucson-tom
Copy link

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
@tucson-tom tucson-tom added the bug label Jan 17, 2023
Ph0tonic added a commit to Ph0tonic/uuid that referenced this issue Feb 17, 2023
Ph0tonic added a commit to Ph0tonic/uuid that referenced this issue Feb 17, 2023
@Ph0tonic
Copy link
Contributor

Hello,
I made a PR to fix your problem by applying your changes, see #495.
\cc @ramsey

ramsey pushed a commit that referenced this issue Apr 15, 2023
@ramsey ramsey linked a pull request Apr 15, 2023 that will close this issue
7 tasks
@ramsey
Copy link
Owner

ramsey commented Apr 15, 2023

The fix for this is released in version 4.7.4. Thank you for your patience.

Thank you, @Ph0tonic, for the patch! 🎉

@ramsey ramsey closed this as completed Apr 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants