Skip to content

Commit

Permalink
Fix build - remove collision package by default
Browse files Browse the repository at this point in the history
  • Loading branch information
shalvah committed Jul 11, 2019
1 parent 0c1c8d7 commit 2f3a214
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"mpociot/documentarian": "^0.2.0",
"mpociot/reflection-docblock": "^1.0.1",
"ramsey/uuid": "^3.8",
"nunomaduro/collision": "^1.1 || ^3.0",
"league/flysystem": "^1.0"
},
"require-dev": {
Expand All @@ -34,7 +33,8 @@
"league/fractal": "^0.17.0"
},
"suggest": {
"league/fractal": "Required for transformers support"
"league/fractal": "Required for transformers support",
"nunomaduro/collision": "For better reporting of errors that are thrpwn when generating docs"
},
"autoload": {
"psr-4": {
Expand Down
7 changes: 1 addition & 6 deletions src/Tools/ResponseStrategies/ResponseCallStrategy.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
use Illuminate\Routing\Route;
use Mpociot\ApiDoc\Tools\Flags;
use Mpociot\ApiDoc\Tools\Utils;
use Whoops\Exception\Inspector;
use NunoMaduro\Collision\Handler;
use Mpociot\ApiDoc\Tools\Traits\ParamHelpers;

/**
Expand Down Expand Up @@ -41,10 +39,7 @@ public function __invoke(Route $route, array $tags, array $routeProps)
} catch (\Exception $e) {
echo 'Exception thrown during response call for ['.implode(',', $route->methods)."] {$route->uri}.\n";
if (Flags::$shouldBeVerbose) {
$handler = new Handler;
$handler->setInspector(new Inspector($e));
$handler->setException($e);
$handler->handle();
Utils::dumpException($e);
} else {
echo "Run this again with the --verbose flag to see the exception.\n";
}
Expand Down
13 changes: 13 additions & 0 deletions src/Tools/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,19 @@ public static function replaceUrlParameterBindings(string $uri, array $bindings)
return $uri;
}

public function dumpException(\Exception $e)
{
if (class_exists(\NunoMaduro\Collision\Handler::class)) {
$handler = new \NunoMaduro\Collision\Handler;
$handler->setInspector(new \Whoops\Exception\Inspector($e));
$handler->setException($e);
$handler->handle();
} else {
dump($e);
echo "You can get better exception output by installing the library \nunomaduro/collision (PHP 7.1+ only).\n";
}
}

public static function deleteDirectoryAndContents($dir)
{
$adapter = new Local(realpath(__DIR__.'/../../'));
Expand Down

0 comments on commit 2f3a214

Please sign in to comment.