Skip to content
This repository was archived by the owner on Dec 10, 2024. It is now read-only.

Commit d3403d7

Browse files
committed
May the force be with us, close #4
1 parent 7b564a1 commit d3403d7

File tree

6 files changed

+7
-11
lines changed

6 files changed

+7
-11
lines changed

src/Error.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,6 @@ public function setStructured( StructuredInterface $structured ) : ErrorInterfac
179179
*/
180180
public function getStructured() : StructuredInterface
181181
{
182-
183182
return $this->structured;
184183
}
185184

@@ -250,7 +249,7 @@ public function register() : ErrorInterface
250249
*/
251250
public function handleError( ErrorMapInterface $error ) : ErrorInterface
252251
{
253-
// error was suppressed with the @-operator
252+
// check if the error was suppressed with the @-operator and it's not fatal error.
254253
if ( 0 === error_reporting() && !in_array( $error->getNumber(), self::FATAL_ERRORS ) )
255254
{
256255
return $this;
@@ -424,7 +423,6 @@ public function addPolicy( string $name, PolicyInterface $policy ) : ErrorInterf
424423
*/
425424
public function deletePolicy( $parameter, string $name ) : ErrorInterface
426425
{
427-
428426
if ( !array_key_exists( $parameter, $this->policies ) )
429427
{
430428
throw new \InvalidArgumentException( sprintf( '(%s) has no registered Policies.', $parameter ) );
@@ -499,7 +497,6 @@ protected function log( $parameter ) : ErrorInterface
499497
*/
500498
protected function display( $parameter ) : ErrorInterface
501499
{
502-
503500
if ( array_key_exists( $parameter, $this->policies ) )
504501
{
505502
foreach ( $this->policies[$parameter] as $policy )
@@ -527,7 +524,6 @@ protected function display( $parameter ) : ErrorInterface
527524
*/
528525
protected function exit( $parameter ) : ErrorInterface
529526
{
530-
531527
if ( array_key_exists( $parameter, $this->policies ) )
532528
{
533529
foreach ( $this->policies[$parameter] as $policy )

src/Map.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public function getType() : int
8181
*/
8282
public function isError() : bool
8383
{
84-
return $this->getType() === ErrorInterface::TYPE_ERROR;
84+
return ErrorInterface::TYPE_ERROR === $this->getType();
8585
}
8686

8787
/**
@@ -91,7 +91,7 @@ public function isError() : bool
9191
*/
9292
public function isException() : bool
9393
{
94-
return $this->getType() === ErrorInterface::TYPE_EXCEPTION;
94+
return ErrorInterface::TYPE_EXCEPTION === $this->getType();
9595
}
9696

9797
/**

src/Output/HTML.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function display() : OutputInterface
7070
$structured = '';
7171
}
7272

73-
$type = ( $this->getMap()->getType() == ErrorInterface::TYPE_ERROR ) ? 'Error' : 'Exception';
73+
$type = ( ErrorInterface::TYPE_ERROR === $this->getMap()->getType() ) ? 'Error' : 'Exception';
7474

7575
print sprintf( $string, $type, $this->escapeString( $this->getMap()->getMessage() ), $structured, $trace );
7676

src/Output/Twig.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function display() : OutputInterface
7070

7171
$structured = $this->getMap()->getStructured();
7272

73-
if ( $this->getMap()->getType() === ErrorInterface::TYPE_EXCEPTION )
73+
if ( ErrorInterface::TYPE_EXCEPTION === $this->getMap()->getType() )
7474
{
7575
$class = get_class( $this->getMap()->getException() );
7676
$type = ( new \ReflectionClass( $class ) )->getShortName();

src/Policy.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function __construct( int $type, $parameter, bool $logging, bool $display
6464
{
6565
if ( !is_string( $parameter ) && !is_int( $parameter ) )
6666
{
67-
throw new \InvalidArgumentException( 'Parameter Type is not string or int.' );
67+
throw new \InvalidArgumentException( '$parameter has to be (String)"Class FQN" or an (int)"Error Number"' );
6868
}
6969

7070
$this->type = $type;

src/Tracer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public function process() : TracerInterface
124124

125125
foreach ( $this->ignore as $file )
126126
{
127-
if ( stripos( $file, $trace['file'] ) !== false )
127+
if ( false !== stripos( $file, $trace['file'] ) )
128128
{
129129
continue 2;
130130
}

0 commit comments

Comments
 (0)