Skip to content

Commit

Permalink
chore: stub
Browse files Browse the repository at this point in the history
  • Loading branch information
jevantang committed Jan 20, 2023
1 parent c0f12d5 commit ee13fb4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
3 changes: 1 addition & 2 deletions src/Commands/stubs/command-provider.stub
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ class CommandServiceProvider extends ServiceProvider

$commands = [];
foreach ((new Finder)->in($paths)->files() as $command) {
$commands[] = Str::before(self::class, 'Providers\\')
. 'Console\\Commands\\' . str_replace('.php', '', $command->getBasename());
$commandClass = Str::before(self::class, 'Providers\\') . 'Console\\Commands\\' . str_replace('.php', '', $command->getBasename());
if (class_exists($commandClass)) {
$commands[] = $commandClass;
}
Expand Down
21 changes: 12 additions & 9 deletions src/Commands/stubs/exception-provider.stub
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@
* Released under the Apache-2.0 License.
*/

namespace $NAMESPACE$;
namespace $NAMESPACE$\Providers;

use App\Exceptions\Handler;
use Illuminate\Support\Str;
use Illuminate\Support\ServiceProvider;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Contracts\Debug\ExceptionHandler;

class ExceptionServiceProvider extends ServiceProvider
{
Expand All @@ -22,10 +20,15 @@ class ExceptionServiceProvider extends ServiceProvider
*/
public function boot()
{
$this->app->resolving(Handler::class, function ($handler) {
$handler->reportable([$this, 'reportable']);
$handler->renderable([$this, 'renderable']);
});
$handler = resolve(ExceptionHandler::class);

if (method_exists($handler, 'reportable')) {
$handler->reportable($this->reportable());
}

if (method_exists($handler, 'renderable')) {
$handler->renderable($this->renderable());
}
}

/**
Expand All @@ -36,7 +39,7 @@ class ExceptionServiceProvider extends ServiceProvider
*/
public function reportable()
{
return function (Throwable $e) {
return function (\Throwable $e) {
//
};
}
Expand Down

0 comments on commit ee13fb4

Please sign in to comment.