File tree Expand file tree Collapse file tree 6 files changed +30
-34
lines changed Expand file tree Collapse file tree 6 files changed +30
-34
lines changed Original file line number Diff line number Diff line change 11
11
12
12
namespace CodeIgniter \Database \Exceptions ;
13
13
14
- use CodeIgniter \Exceptions \ExitExceptionInterface ;
14
+ use CodeIgniter \Exceptions \hasExitCodeInterface ;
15
15
use Error ;
16
16
17
- class DatabaseException extends Error implements ExceptionInterface, ExitExceptionInterface
17
+ class DatabaseException extends Error implements ExceptionInterface, hasExitCodeInterface
18
18
{
19
- /**
20
- * Exit status code
21
- *
22
- * @var int
23
- */
24
- protected $ code = EXIT_DATABASE ;
19
+ public function getExitCode (): int
20
+ {
21
+ return EXIT_DATABASE ;
22
+ }
25
23
}
Original file line number Diff line number Diff line change 12
12
namespace CodeIgniter \Debug ;
13
13
14
14
use CodeIgniter \API \ResponseTrait ;
15
- use CodeIgniter \Exceptions \ExitExceptionInterface ;
15
+ use CodeIgniter \Exceptions \hasExitCodeInterface ;
16
16
use CodeIgniter \Exceptions \HTTPExceptionInterface ;
17
17
use CodeIgniter \Exceptions \PageNotFoundException ;
18
18
use CodeIgniter \HTTP \CLIRequest ;
@@ -321,8 +321,8 @@ protected function determineCodes(Throwable $exception): array
321
321
$ statusCode = $ exception ->getCode ();
322
322
}
323
323
324
- if ($ exception instanceof ExitExceptionInterface ) {
325
- $ exitStatus = $ exception ->getCode ();
324
+ if ($ exception instanceof hasExitCodeInterface ) {
325
+ $ exitStatus = $ exception ->getExitCode ();
326
326
}
327
327
328
328
return [$ statusCode , $ exitStatus ];
Original file line number Diff line number Diff line change 11
11
12
12
namespace CodeIgniter \Entity \Exceptions ;
13
13
14
- use CodeIgniter \Exceptions \ExitExceptionInterface ;
15
14
use CodeIgniter \Exceptions \FrameworkException ;
15
+ use CodeIgniter \Exceptions \hasExitCodeInterface ;
16
16
17
17
/**
18
18
* CastException is thrown for invalid cast initialization and management.
19
19
*/
20
- class CastException extends FrameworkException implements ExitExceptionInterface
20
+ class CastException extends FrameworkException implements hasExitCodeInterface
21
21
{
22
- /**
23
- * Exit status code
24
- *
25
- * @var int
26
- */
27
- protected $ code = EXIT_CONFIG ;
22
+ public function getExitCode (): int
23
+ {
24
+ return EXIT_CONFIG ;
25
+ }
28
26
29
27
/**
30
28
* Thrown when the cast class does not extends BaseCast.
Original file line number Diff line number Diff line change 18
18
*
19
19
* @codeCoverageIgnore
20
20
*/
21
- class CastException extends CriticalError implements ExitExceptionInterface
21
+ class CastException extends CriticalError implements hasExitCodeInterface
22
22
{
23
23
use DebugTraceableTrait;
24
24
25
- /**
26
- * Exit status code
27
- *
28
- * @var int
29
- */
30
- protected $ code = EXIT_CONFIG ;
25
+ public function getExitCode (): int
26
+ {
27
+ return EXIT_CONFIG ;
28
+ }
31
29
32
30
public static function forInvalidJsonFormatException (int $ error )
33
31
{
Original file line number Diff line number Diff line change 14
14
/**
15
15
* Exception for automatic logging.
16
16
*/
17
- class ConfigException extends CriticalError implements ExitExceptionInterface
17
+ class ConfigException extends CriticalError implements hasExitCodeInterface
18
18
{
19
19
use DebugTraceableTrait;
20
20
21
- /**
22
- * Exit status code
23
- *
24
- * @var int
25
- */
26
- protected $ code = EXIT_CONFIG ;
21
+ public function getExitCode (): int
22
+ {
23
+ return EXIT_CONFIG ;
24
+ }
27
25
28
26
public static function forDisabledMigrations ()
29
27
{
Original file line number Diff line number Diff line change 14
14
/**
15
15
* Interface for Exceptions that has exception code as exit code.
16
16
*/
17
- interface ExitExceptionInterface
17
+ interface hasExitCodeInterface
18
18
{
19
+ /**
20
+ * Returns exit status code.
21
+ */
22
+ public function getExitCode (): int ;
19
23
}
You can’t perform that action at this time.
0 commit comments