Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
"puli/composer-plugin": "1.0.0-beta10"
},
"suggest": {
"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.",
"php-http/message": "Allow to use Guzzle, Diactoros or Slim Framework factories"
},
"autoload": {
Expand Down
10 changes: 8 additions & 2 deletions src/ClassDiscovery.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,13 @@ abstract class ClassDiscovery
* @var array
*/
private static $strategies = [
Strategy\PuliBetaStrategy::class,
Strategy\CommonClassesStrategy::class,
Strategy\CommonPsr17ClassesStrategy::class,
Strategy\PuliBetaStrategy::class,
];

private static $deprecatedStrategies = [
Strategy\PuliBetaStrategy::class => true,
];

/**
Expand Down Expand Up @@ -55,7 +59,9 @@ protected static function findOneByType($type)
try {
$candidates = call_user_func($strategy.'::getCandidates', $type);
} catch (StrategyUnavailableException $e) {
$exceptions[] = $e;
if (!isset(self::$deprecatedStrategies[$strategy])) {
$exceptions[] = $e;
}

continue;
}
Expand Down
1 change: 0 additions & 1 deletion tests/Exception/InitializeExceptionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ public function testInitialize()
{
$e[] = new DiscoveryException\ClassInstantiationFailedException();
$e[] = new DiscoveryException\NotFoundException();
$e[] = new DiscoveryException\PuliUnavailableException();
$e[] = new DiscoveryException\StrategyUnavailableException();
$e[] = new DiscoveryException\NoCandidateFoundException('CommonClasses', []);
$e[] = DiscoveryException\DiscoveryFailedException::create($e);
Expand Down