forked from laravel/framework
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'upstream/5.5' into 5.5
* upstream/5.5: Added missing postgres inet operators. (laravel#21518) tag v5.5.14 release notes version update v5.5 changelog Apply fixes from StyleCI (laravel#21514) formatting Remove unnecessary else statement add mapToDictionary tests rename method dictionary -> mapToDictionary; avoid pre-pr regression formatting formatting [5.5] Allow marking notifications as unread (laravel#21497) methods on facade are static (laravel#21501) StyleCI fixes Add ability to pass callback to whenLoaded Resource method Fix User model typehints & `$user` variable duplicates in Policy stub; Add make command for custom exceptions add buildToDictionary
- Loading branch information
Showing
20 changed files
with
298 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 84 additions & 0 deletions
84
src/Illuminate/Foundation/Console/ExceptionMakeCommand.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
<?php | ||
|
||
namespace Illuminate\Foundation\Console; | ||
|
||
use Illuminate\Console\GeneratorCommand; | ||
use Symfony\Component\Console\Input\InputOption; | ||
|
||
class ExceptionMakeCommand extends GeneratorCommand | ||
{ | ||
/** | ||
* The console command name. | ||
* | ||
* @var string | ||
*/ | ||
protected $name = 'make:exception'; | ||
|
||
/** | ||
* The console command description. | ||
* | ||
* @var string | ||
*/ | ||
protected $description = 'Create a new custom exception class'; | ||
|
||
/** | ||
* The type of class being generated. | ||
* | ||
* @var string | ||
*/ | ||
protected $type = 'Exception'; | ||
|
||
/** | ||
* Get the stub file for the generator. | ||
* | ||
* @return string | ||
*/ | ||
protected function getStub() | ||
{ | ||
if ($this->option('render')) { | ||
return $this->option('report') | ||
? __DIR__.'/stubs/exception-render-report.stub' | ||
: __DIR__.'/stubs/exception-render.stub'; | ||
} | ||
|
||
return $this->option('report') | ||
? __DIR__.'/stubs/exception-report.stub' | ||
: __DIR__.'/stubs/exception.stub'; | ||
} | ||
|
||
/** | ||
* Determine if the class already exists. | ||
* | ||
* @param string $rawName | ||
* @return bool | ||
*/ | ||
protected function alreadyExists($rawName) | ||
{ | ||
return class_exists($this->rootNamespace().'Exceptions\\'.$rawName); | ||
} | ||
|
||
/** | ||
* Get the default namespace for the class. | ||
* | ||
* @param string $rootNamespace | ||
* @return string | ||
*/ | ||
protected function getDefaultNamespace($rootNamespace) | ||
{ | ||
return $rootNamespace.'\Exceptions'; | ||
} | ||
|
||
/** | ||
* Get the console command options. | ||
* | ||
* @return array | ||
*/ | ||
protected function getOptions() | ||
{ | ||
return [ | ||
['render', null, InputOption::VALUE_NONE, 'Create the exception with an empty render method.'], | ||
|
||
['report', null, InputOption::VALUE_NONE, 'Create the exception with an empty report method.'], | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
src/Illuminate/Foundation/Console/stubs/exception-render-report.stub
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
namespace DummyNamespace; | ||
|
||
use Exception; | ||
|
||
class DummyClass extends Exception | ||
{ | ||
/** | ||
* Report the exception. | ||
* | ||
* @return void | ||
*/ | ||
public function report() | ||
{ | ||
// | ||
} | ||
|
||
/** | ||
* Render the exception as an HTTP response. | ||
* | ||
* @param \Illuminate\Http\Request $request | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function render($request) | ||
{ | ||
// | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/Illuminate/Foundation/Console/stubs/exception-render.stub
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
namespace DummyNamespace; | ||
|
||
use Exception; | ||
|
||
class DummyClass extends Exception | ||
{ | ||
/** | ||
* Render the exception as an HTTP response. | ||
* | ||
* @param \Illuminate\Http\Request $request | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function render($request) | ||
{ | ||
// | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/Illuminate/Foundation/Console/stubs/exception-report.stub
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
namespace DummyNamespace; | ||
|
||
use Exception; | ||
|
||
class DummyClass extends Exception | ||
{ | ||
/** | ||
* Report the exception. | ||
* | ||
* @return void | ||
*/ | ||
public function report() | ||
{ | ||
// | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
namespace DummyNamespace; | ||
|
||
use Exception; | ||
|
||
class DummyClass extends Exception | ||
{ | ||
// | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.