Skip to content

Commit 386612f

Browse files
nadermanNyholm
andauthored
Do not suggest installation of puli via composer or error messages (#195)
* Do not suggest installation of puli via composer or error messages * Reorder strategies Co-authored-by: Nyholm <[email protected]>
1 parent 788f72d commit 386612f

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
"puli/composer-plugin": "1.0.0-beta10"
2222
},
2323
"suggest": {
24-
"puli/composer-plugin": "Sets up Puli which is recommended for Discovery to work. Check http://docs.php-http.org/en/latest/discovery.html for more details.",
2524
"php-http/message": "Allow to use Guzzle, Diactoros or Slim Framework factories"
2625
},
2726
"autoload": {

src/ClassDiscovery.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,13 @@ abstract class ClassDiscovery
2222
* @var array
2323
*/
2424
private static $strategies = [
25-
Strategy\PuliBetaStrategy::class,
2625
Strategy\CommonClassesStrategy::class,
2726
Strategy\CommonPsr17ClassesStrategy::class,
27+
Strategy\PuliBetaStrategy::class,
28+
];
29+
30+
private static $deprecatedStrategies = [
31+
Strategy\PuliBetaStrategy::class => true,
2832
];
2933

3034
/**
@@ -55,7 +59,9 @@ protected static function findOneByType($type)
5559
try {
5660
$candidates = call_user_func($strategy.'::getCandidates', $type);
5761
} catch (StrategyUnavailableException $e) {
58-
$exceptions[] = $e;
62+
if (!isset(self::$deprecatedStrategies[$strategy])) {
63+
$exceptions[] = $e;
64+
}
5965

6066
continue;
6167
}

tests/Exception/InitializeExceptionTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ public function testInitialize()
1111
{
1212
$e[] = new DiscoveryException\ClassInstantiationFailedException();
1313
$e[] = new DiscoveryException\NotFoundException();
14-
$e[] = new DiscoveryException\PuliUnavailableException();
1514
$e[] = new DiscoveryException\StrategyUnavailableException();
1615
$e[] = new DiscoveryException\NoCandidateFoundException('CommonClasses', []);
1716
$e[] = DiscoveryException\DiscoveryFailedException::create($e);

0 commit comments

Comments
 (0)