Skip to content

Commit

Permalink
Use strict comparisons
Browse files Browse the repository at this point in the history
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
  • Loading branch information
MauricioFauth committed Feb 27, 2020
1 parent e3e6a7f commit 2d0e597
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Translator.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ public function __construct(string $filename)

try {
$magic = $stream->read(0, 4);
if (strcmp($magic, self::MAGIC_LE) == 0) {
if (strcmp($magic, self::MAGIC_LE) === 0) {
$unpack = 'V';
} elseif (strcmp($magic, self::MAGIC_BE) == 0) {
} elseif (strcmp($magic, self::MAGIC_BE) === 0) {
$unpack = 'N';
} else {
$this->error = self::ERROR_BAD_MAGIC;
Expand Down Expand Up @@ -225,11 +225,11 @@ public static function extractPluralCount($expr)
{
$parts = explode(';', $expr, 2);
$nplurals = explode('=', trim($parts[0]), 2);
if (strtolower(rtrim($nplurals[0])) != 'nplurals') {
if (strtolower(rtrim($nplurals[0])) !== 'nplurals') {
return 1;
}

if (count($nplurals) == 1) {
if (count($nplurals) === 1) {
return 1;
}

Expand Down Expand Up @@ -327,7 +327,7 @@ public function ngettext($msgid, $msgidPlural, $number)
// this should contains all strings separated by NULLs
$key = implode(chr(0), [$msgid, $msgidPlural]);
if (! array_key_exists($key, $this->cacheTranslations)) {
return ($number != 1) ? $msgidPlural : $msgid;
return ($number !== 1) ? $msgidPlural : $msgid;
}

// find out the appropriate form
Expand Down

0 comments on commit 2d0e597

Please sign in to comment.