mikeerickson / phpunit-pretty-result-printer

PHPUnit Pretty Result Printer -- make your PHPUnit tests look pretty!
MIT License
1.2k stars 71 forks source link

Ambiguous class resolution #74

Closed tobz-nz closed 6 years ago

tobz-nz commented 6 years ago

I'm getting this warning when installing/updating composer:

Is there a way to fix this?

php 7.2.4 (brew) Laravel 5.6 (phpunit ~7.0)

Warning: Ambiguous class resolution, "Codedungeon\PHPUnitPrettyResultPrinter\_ResultPrinter" was found in both "/Users/tobyevans/Code/dovetailx/api.dovetailx/vendor/codedungeon/phpunit-result-printer/src/ResultPrinter5.php" and "/Users/tobyevans/Code/dovetailx/api.dovetailx/vendor/codedungeon/phpunit-result-printer/src/ResultPrinter6.php", the first will be used.
Warning: Ambiguous class resolution, "Codedungeon\PHPUnitPrettyResultPrinter\_ResultPrinter" was found in both "/Users/tobyevans/Code/dovetailx/api.dovetailx/vendor/codedungeon/phpunit-result-printer/src/ResultPrinter5.php" and "/Users/tobyevans/Code/dovetailx/api.dovetailx/vendor/codedungeon/phpunit-result-printer/src/ResultPrinter70.php", the first will be used.
Warning: Ambiguous class resolution, "Codedungeon\PHPUnitPrettyResultPrinter\_ResultPrinter" was found in both "/Users/tobyevans/Code/dovetailx/api.dovetailx/vendor/codedungeon/phpunit-result-printer/src/ResultPrinter5.php" and "/Users/tobyevans/Code/dovetailx/api.dovetailx/vendor/codedungeon/phpunit-result-printer/src/ResultPrinter71.php", the first will be used.
mikeerickson commented 6 years ago

The warnings are harmless. I have to maintain 4 separate Result Printers based on the version of PHPUnit that is being used (5, 6, 7.0 and 7.1). This error is prompted because of the 4 different classes with same name being exported as _ResultPrinter (all with different signatures) which then extend PHPUnit ResultPrinter class.

Mike Erickson codedungeon@gmail.com

On Apr 11, 2018, at 9:38 PM, Toby Evans notifications@github.com wrote:

I'm getting this warning when installing/updating composer:

Is there a way to fix this?

php 7.2.4 (brew) Laravel 5.6 (phpunit ~7.0)

Warning: Ambiguous class resolution, "Codedungeon\PHPUnitPrettyResultPrinter_ResultPrinter" was found in both "/Users/tobyevans/Code/dovetailx/api.dovetailx/vendor/codedungeon/phpunit-result-printer/src/ResultPrinter5.php" and "/Users/tobyevans/Code/dovetailx/api.dovetailx/vendor/codedungeon/phpunit-result-printer/src/ResultPrinter6.php", the first will be used. — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/mikeerickson/phpunit-pretty-result-printer/issues/74, or mute the thread https://github.com/notifications/unsubscribe-auth/AALLcfd9PblNrQap0DEIzvS9T-cbN2bTks5tntozgaJpZM4TRIPa.

tobz-nz commented 6 years ago

I know warning are harmless, except for looking terrible and unprofessional in my opinion. Wouldn't it make more sense to just name the classes separately and let eh user load the correct one for their setup?

Or load the correct class in the version check - instead of defining the class.

I'm just saying it shouldn't be too difficult to not have the warnings.

I realize I might sound like a bit of a dick, its not intentional - I just really like this package and want to help make it better.

mikeerickson commented 6 years ago

I Have a few different ideas of how l want to handle this, I just need to pick the approach that Is maintainable.

mikeerickson commented 6 years ago

Like all things related to OSS allocating the time is minor hurdle. I try to be all things to all people, but that sometimes not easy. I will get it addressed as soon as possible.

assertchris commented 6 years ago

Fixed in https://github.com/mikeerickson/phpunit-pretty-result-printer/pull/75

tobz-nz commented 6 years ago

I totally understand the time allocation hurdle and appreciate the that you do it. Thanks so much :)