Skip to content

Commit

Permalink
Replaced ternaries with null coalescing operator
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshyPHP committed Apr 28, 2021
1 parent b5e7084 commit 305276c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Escaper.php
Expand Up @@ -43,7 +43,7 @@ public function __construct(string $delimiter = '/')
*/
public function escapeCharacterClass(string $char): string
{
return (isset($this->inCharacterClass[$char])) ? $this->inCharacterClass[$char] : $char;
return $this->inCharacterClass[$char] ?? $char;
}

/**
Expand All @@ -54,6 +54,6 @@ public function escapeCharacterClass(string $char): string
*/
public function escapeLiteral(string $char): string
{
return (isset($this->inLiteral[$char])) ? $this->inLiteral[$char] : $char;
return $this->inLiteral[$char] ?? $char;
}
}
2 changes: 1 addition & 1 deletion src/Output/PrintableAscii.php
Expand Up @@ -43,7 +43,7 @@ protected function escapeControlCode(int $cp): string
{
$table = [9 => '\\t', 10 => '\\n', 13 => '\\r'];

return (isset($table[$cp])) ? $table[$cp] : $this->escapeAscii($cp);
return $table[$cp] ?? $this->escapeAscii($cp);
}

/**
Expand Down

0 comments on commit 305276c

Please sign in to comment.