phar-io/version

Warning during installation

alextesi opened this issue · 10 comments

Hi,
i receive this warning during the installation.

Warning: Ambiguous class resolution, "PharIo\Version\AnyVersionConstraint" was found in both "/home/dev/mySoft/vendor/phar-io/version/src/AnyVersionConstraint.php" and "/home/dev/mySoft/vendor/phar-io/version/src/constraints/AnyVersionConstraint.php", the first will be used.
Warning: Ambiguous class resolution, "PharIo\Version\VersionConstraint" was found in both "/home/dev/mySoft/vendor/phar-io/version/src/VersionConstraint.php" and "/home/dev/mySoft/vendor/phar-io/version/src/constraints/VersionConstraint.php", the first will be used.
Warning: Ambiguous class resolution, "PharIo\Version\SpecificMajorAndMinorVersionConstraint" was found in both "/home/dev/mySoft/vendor/phar-io/version/src/SpecificMajorAndMinorVersionConstraint.php" and "/home/dev/mySoft/vendor/phar-io/version/src/constraints/SpecificMajorAndMinorVersionConstraint.php", the first will be used.
Warning: Ambiguous class resolution, "PharIo\Version\OrVersionConstraintGroup" was found in both "/home/dev/mySoft/vendor/phar-io/version/src/OrVersionConstraintGroup.php" and "/home/dev/mySoft/vendor/phar-io/version/src/constraints/OrVersionConstraintGroup.php", the first will be used.
Warning: Ambiguous class resolution, "PharIo\Version\GreaterThanOrEqualToVersionConstraint" was found in both "/home/dev/mySoft/vendor/phar-io/version/src/constraints/GreaterThanOrEqualToVersionConstraint.php" and "/home/dev/mySoft/vendor/phar-io/version/src/GreaterThanOrEqualToVersionConstraint.php", the first will be used.
Warning: Ambiguous class resolution, "PharIo\Version\ExactVersionConstraint" was found in both "/home/dev/mySoft/vendor/phar-io/version/src/constraints/ExactVersionConstraint.php" and "/home/dev/mySoft/vendor/phar-io/version/src/ExactVersionConstraint.php", the first will be used.
Warning: Ambiguous class resolution, "PharIo\Version\AbstractVersionConstraint" was found in both "/home/dev/mySoft/vendor/phar-io/version/src/constraints/AbstractVersionConstraint.php" and "/home/dev/mySoft/vendor/phar-io/version/src/AbstractVersionConstraint.php", the first will be used.
Warning: Ambiguous class resolution, "PharIo\Version\SpecificMajorVersionConstraint" was found in both "/home/dev/mySoft/vendor/phar-io/version/src/constraints/SpecificMajorVersionConstraint.php" and "/home/dev/mySoft/vendor/phar-io/version/src/SpecificMajorVersionConstraint.php", the first will be used.
Warning: Ambiguous class resolution, "PharIo\Version\UnsupportedVersionConstraintException" was found in both "/home/dev/mySoft/vendor/phar-io/version/src/UnsupportedVersionConstraintException.php" and "/home/dev/mySoft/vendor/phar-io/version/src/exceptions/UnsupportedVersionConstraintException.php", the first will be used.
Warning: Ambiguous class resolution, "PharIo\Version\Exception" was found in both "/home/dev/mySoft/vendor/phar-io/version/src/Exception.php" and "/home/dev/mySoft/vendor/phar-io/version/src/exceptions/Exception.php", the first will be used.
Warning: Ambiguous class resolution, "PharIo\Version\InvalidVersionException" was found in both "/home/dev/mySoft/vendor/phar-io/version/src/InvalidVersionException.php" and "/home/dev/mySoft/vendor/phar-io/version/src/exceptions/InvalidVersionException.php", the first will be used.
Warning: Ambiguous class resolution, "PharIo\Version\AndVersionConstraintGroup" was found in both "/home/dev/mySoft/vendor/phar-io/version/src/constraints/AndVersionConstraintGroup.php" and "/home/dev/mySoft/vendor/phar-io/version/src/AndVersionConstraintGroup.php", the first will be used.

Can you fix it ?
Can i help you to fix it?

Thanks in advance
Alex

I just experienced the same problem... any suggestions?

Sorry for taking long to respond, somehow I manually had to watch this project because I didn't get any notifications. No idea what Github did here...

Regarding the issue: I have no idea how this might be in any way related to this project:

theseer@nyda /tmp $ mkdir xy

theseer@nyda /tmp $ cd xy

theseer@nyda /tmp/xy $ composer require phar-io/version
Using version ^2.0 for phar-io/version
./composer.json has been created
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
  - Installing phar-io/version (2.0.1): Loading from cache
Writing lock file
Generating autoload files

No issues till here - despite an autoloader being generated.
I can even manually force a dump:

theseer@nyda /tmp/xy $ composer dump
Generating autoload files

Also, no issues.

Afterwards, checking for duplicates using one of the filenames that are supposedly causing the issue:

theseer@nyda /tmp/xy $ ls -1R | grep -c AnyVersionConstraint.php
1

As to be expected, there's only one. And it's where it's supposed to be:

theseer@nyda /tmp/xy $ find . -name AnyVersionConstraint.php
./vendor/phar-io/version/src/constraints/AnyVersionConstraint.php

Are you using any plugins for composer that mess with the directory structure somehow? We - by choice - do not honor PSR namespace-directory-mappings and the "duplicate" location looks like where the file should be if we were versus where it actually is.

There seems to be no way to reproduce this and no feedback has been provided to help reproducing.

I'll close this.

In case any of you happens to experience this issue again please feel free to reopen/add a comment. Please provide details that might help in reproducing.

There seems to be no way to reproduce this and no feedback has been provided to help reproducing.

I'll close this.

In case any of you happens to experience this issue again please feel free to reopen/add a comment. Please provide details that might help in reproducing.

I have exactly the same warning.

It looks to me somehow the file exceptions/ManifestDocumentLoadingException.php is orphaned. In PhpStorm the colour of the file in the Project explorer is brown which shows it doesn't exist in the SVN repository. It's the exactly copy of xml/ManifestDocumentLoadingException.php.

Is it safe I delete exceptions/ManifestDocumentLoadingException.php which should fix the warning?

The exact warning [the full path has been shortened]:

Warning: Ambiguous class resolution,
"PharIo\Manifest\ManifestDocumentLoadingException"
was found in both
".../vendor/phar-io/manifest/src/exceptions/ManifestDocumentLoadingException.php"
and
".../vendor/phar-io/manifest/src/xml/ManifestDocumentLoadingException.php"
the first will be used

image

I am new to laravel, yesterday when I ran composer dump-autoload I got this error

Warning: Ambiguous class resolution, "PharIo\Manifest\ManifestDocumentLoadingException" was found in both "C:\wamp64\www\precampDev2\vendor/phar-io/manifest/src\exceptions\ManifestDocumentLoadingException.php" and "C:\wamp64\www\precampDev2\vendor/phar-io/manifest/src\xml\ManifestDocumentLoadingException.php", the first will be used.
Warning: Ambiguous class resolution, "PharIo\Version\AbstractVersionConstraint" was found in both "C:\wamp64\www\precampDev2\vendor/phar-io/version/src\AbstractVersionConstraint.php" and "C:\wamp64\www\precampDev2\vendor/phar-io/version/src\constraints\AbstractVersionConstraint.php", the first will be used.
Warning: Ambiguous class resolution, "PharIo\Version\AndVersionConstraintGroup" was found in both "C:\wamp64\www\precampDev2\vendor/phar-io/version/src\AndVersionConstraintGroup.php" and "C:\wamp64\www\precampDev2\vendor/phar-io/version/src\constraints\AndVersionConstraintGroup.php", the first will be used.
Warning: Ambiguous class resolution, "PharIo\Version\AnyVersionConstraint" was found in both "C:\wamp64\www\precampDev2\vendor/phar-io/version/src\AnyVersionConstraint.php" and "C:\wamp64\www\precampDev2\vendor/phar-io/version/src\constraints\AnyVersionConstraint.php", the first will be used.

@precamp-io Thanks for the addition. Unfortunately, the report doesn't make any sense to me :-/

Warning: Ambiguous class resolution, "PharIo\Manifest\ManifestDocumentLoadingException" was found in both "C:\wamp64\www\precampDev2\vendor/phar-io/manifest/src\exceptions\ManifestDocumentLoadingException.php" and "C:\wamp64\www\precampDev2\vendor/phar-io/manifest/src\xml\ManifestDocumentLoadingException.php", the first will be used.

This is not part of this project.

Warning: Ambiguous class resolution, "PharIo\Version\AbstractVersionConstraint" was found in both "C:\wamp64\www\precampDev2\vendor/phar-io/version/src\AbstractVersionConstraint.php" and "C:\wamp64\www\precampDev2\vendor/phar-io/version/src\constraints\AbstractVersionConstraint.php", the first will be used.

This is just plain wrong and must be something broken on your system. Over 5 years ago, the directory structure got updated: Back in version 1.0.0, a src\AbstractVersionConstraint.php exists - but that file moved into the constraints subdirectory starting version 2.0.0 (https://github.com/phar-io/version/tree/2.0.0/src vs. https://github.com/phar-io/version/tree/1.0.1/src).

I don't know what happend on your system but i fail to see how this is a problem with phar-io/version.

Warning: Ambiguous class resolution, "PharIo\Version\AndVersionConstraintGroup" was found in both "C:\wamp64\www\precampDev2\vendor/phar-io/version/src\AndVersionConstraintGroup.php" and "C:\wamp64\www\precampDev2\vendor/phar-io/version/src\constraints\AndVersionConstraintGroup.php", the first will be used.

See above.

Warning: Ambiguous class resolution, "PharIo\Version\AnyVersionConstraint" was found in both "C:\wamp64\www\precampDev2\vendor/phar-io/version/src\AnyVersionConstraint.php" and "C:\wamp64\www\precampDev2\vendor/phar-io/version/src\constraints\AnyVersionConstraint.php", the first will be used.

See above.

Thanks for the heads up. I still have no idea what might have happened or what (if at all) I could do (something) to stop this from happening again. Given after a new install (or technically update in your case) the problem vanished, I still believe it's not something under our control.