Skip to content

Commit

Permalink
php-cs-fixer fix --rules=logical_operators
Browse files Browse the repository at this point in the history
  • Loading branch information
Jimbolino committed Jul 12, 2020
1 parent 24dc176 commit 273916d
Show file tree
Hide file tree
Showing 50 changed files with 204 additions and 203 deletions.
1 change: 1 addition & 0 deletions .php_cs.dist
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ return PhpCsFixer\Config::create()
'array_syntax' => ['syntax' => 'long'],
'list_syntax' => ['syntax' => 'long'],
'modernize_types_casting' => true,
'logical_operators' => true,
]);
2 changes: 1 addition & 1 deletion library/Zend/Cache/Backend.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public function getTmpDir()
foreach (array($_ENV, $_SERVER) as $tab) {
foreach (array('TMPDIR', 'TEMP', 'TMP', 'windir', 'SystemRoot') as $key) {
if (isset($tab[$key]) && is_string($tab[$key])) {
if (($key == 'windir') or ($key == 'SystemRoot')) {
if (($key == 'windir') || ($key == 'SystemRoot')) {
$dir = realpath($tab[$key] . '\\temp');
} else {
$dir = realpath($tab[$key]);
Expand Down
4 changes: 2 additions & 2 deletions library/Zend/Cache/Backend/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@ protected function _clean($dir, $mode = Zend_Cache::CLEANING_MODE_ALL, $tags = a
break;
}
}
if ((is_dir($file)) and ($this->_options['hashed_directory_level']>0)) {
if ((is_dir($file)) && ($this->_options['hashed_directory_level']>0)) {
// Recursive call
$result = $this->_clean($file . DIRECTORY_SEPARATOR, $mode, $tags) && $result;
if ($mode == Zend_Cache::CLEANING_MODE_ALL) {
Expand Down Expand Up @@ -832,7 +832,7 @@ protected function _get($dir, $mode, $tags = array())
break;
}
}
if ((is_dir($file)) and ($this->_options['hashed_directory_level']>0)) {
if ((is_dir($file)) && ($this->_options['hashed_directory_level']>0)) {
// Recursive call
$recursiveRs = $this->_get($file . DIRECTORY_SEPARATOR, $mode, $tags);
if ($recursiveRs === false) {
Expand Down
26 changes: 13 additions & 13 deletions library/Zend/Currency.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public function __construct($options = null, $locale = null)
$this->_options['symbol'] = self::getSymbol($options, $this->_options['locale']);
}

if (($this->_options['currency'] === null) and ($this->_options['name'] === null)) {
if (($this->_options['currency'] === null) && ($this->_options['name'] === null)) {
require_once 'Zend/Currency/Exception.php';
throw new Zend_Currency_Exception("Currency '$options' not found");
}
Expand Down Expand Up @@ -161,7 +161,7 @@ public function toCurrency($value = null, array $options = array())
}

// Validate the passed number
if (!(isset($value)) or (is_numeric($value) === false)) {
if (!(isset($value)) || (is_numeric($value) === false)) {
require_once 'Zend/Currency/Exception.php';
throw new Zend_Currency_Exception("Value '$value' has to be numeric");
}
Expand Down Expand Up @@ -304,15 +304,15 @@ public function setFormat(array $options = array())
private function _checkParams($currency = null, $locale = null)
{
// Manage the params
if ((empty($locale)) and (!empty($currency)) and
if ((empty($locale)) && (!empty($currency)) &&
(Zend_Locale::isLocale($currency, true, false))) {
$locale = $currency;
$currency = null;
}

// Validate the locale and get the country short name
$country = null;
if ((Zend_Locale::isLocale($locale, true, false)) and (strlen($locale) > 4)) {
if ((Zend_Locale::isLocale($locale, true, false)) && (strlen($locale) > 4)) {
$country = substr($locale, (strpos($locale, '_') + 1));
} else {
require_once 'Zend/Currency/Exception.php';
Expand All @@ -321,7 +321,7 @@ private function _checkParams($currency = null, $locale = null)

// Get the available currencies for this country
$data = Zend_Locale_Data::getContent($locale, 'currencytoregion', $country);
if ((empty($currency) === false) and (empty($data) === false)) {
if ((empty($currency) === false) && (empty($data) === false)) {
$abbreviation = $currency;
} else {
$abbreviation = $data;
Expand All @@ -340,7 +340,7 @@ private function _checkParams($currency = null, $locale = null)
*/
public function getSymbol($currency = null, $locale = null)
{
if (($currency === null) and ($locale === null)) {
if (($currency === null) && ($locale === null)) {
return $this->_options['symbol'];
}

Expand Down Expand Up @@ -368,7 +368,7 @@ public function getSymbol($currency = null, $locale = null)
*/
public function getShortName($currency = null, $locale = null)
{
if (($currency === null) and ($locale === null)) {
if (($currency === null) && ($locale === null)) {
return $this->_options['currency'];
}

Expand Down Expand Up @@ -403,7 +403,7 @@ public function getShortName($currency = null, $locale = null)
*/
public function getName($currency = null, $locale = null)
{
if (($currency === null) and ($locale === null)) {
if (($currency === null) && ($locale === null)) {
return $this->_options['name'];
}

Expand Down Expand Up @@ -846,15 +846,15 @@ protected function _checkOptions(array $options = array())

switch($name) {
case 'position':
if (($value !== self::STANDARD) and ($value !== self::RIGHT) and ($value !== self::LEFT)) {
if (($value !== self::STANDARD) && ($value !== self::RIGHT) && ($value !== self::LEFT)) {
require_once 'Zend/Currency/Exception.php';
throw new Zend_Currency_Exception("Unknown position '" . $value . "'");
}

break;

case 'format':
if ((empty($value) === false) and (Zend_Locale::isLocale($value, null, false) === false)) {
if ((empty($value) === false) && (Zend_Locale::isLocale($value, null, false) === false)) {
if (!is_string($value) || (strpos($value, '0') === false)) {
require_once 'Zend/Currency/Exception.php';
throw new Zend_Currency_Exception("'" .
Expand All @@ -865,8 +865,8 @@ protected function _checkOptions(array $options = array())
break;

case 'display':
if (is_numeric($value) and ($value !== self::NO_SYMBOL) and ($value !== self::USE_SYMBOL) and
($value !== self::USE_SHORTNAME) and ($value !== self::USE_NAME)) {
if (is_numeric($value) && ($value !== self::NO_SYMBOL) && ($value !== self::USE_SYMBOL) &&
($value !== self::USE_SHORTNAME) && ($value !== self::USE_NAME)) {
require_once 'Zend/Currency/Exception.php';
throw new Zend_Currency_Exception("Unknown display '$value'");
}
Expand All @@ -877,7 +877,7 @@ protected function _checkOptions(array $options = array())
$value = -1;
}

if (($value < -1) or ($value > 30)) {
if (($value < -1) || ($value > 30)) {
require_once 'Zend/Currency/Exception.php';
throw new Zend_Currency_Exception("'$value' precision has to be between -1 and 30.");
}
Expand Down
54 changes: 27 additions & 27 deletions library/Zend/Date.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ class Zend_Date extends Zend_Date_DateObject
*/
public function __construct($date = null, $part = null, $locale = null)
{
if (is_object($date) and !($date instanceof Zend_TimeSync_Protocol) and
if (is_object($date) && !($date instanceof Zend_TimeSync_Protocol) &&
!($date instanceof Zend_Date)) {
if ($locale instanceof Zend_Locale) {
$locale = $date;
Expand All @@ -147,12 +147,12 @@ public function __construct($date = null, $part = null, $locale = null)
}
}

if (($date !== null) and !is_array($date) and !($date instanceof Zend_TimeSync_Protocol) and
!($date instanceof Zend_Date) and !defined($date) and Zend_Locale::isLocale($date, true, false)) {
if (($date !== null) && !is_array($date) && !($date instanceof Zend_TimeSync_Protocol) &&
!($date instanceof Zend_Date) && !defined($date) && Zend_Locale::isLocale($date, true, false)) {
$locale = $date;
$date = null;
$part = null;
} else if (($part !== null) and !defined($part) and Zend_Locale::isLocale($part, true, false)) {
} else if (($part !== null) && !defined($part) && Zend_Locale::isLocale($part, true, false)) {
$locale = $part;
$part = null;
}
Expand Down Expand Up @@ -191,7 +191,7 @@ public function __construct($date = null, $part = null, $locale = null)
}

// set datepart
if (($part !== null && $part !== self::TIMESTAMP) or (!is_numeric($date))) {
if (($part !== null && $part !== self::TIMESTAMP) || (!is_numeric($date))) {
// switch off dst handling for value setting
$this->setUnixTimestamp($this->getGmtOffset());
$this->set($date, $part, $this->_locale);
Expand Down Expand Up @@ -447,7 +447,7 @@ public function toString($format = null, $type = null, $locale = null)
$format = null;
}

if (($type !== null) and ($type != 'php') and ($type != 'iso') and
if (($type !== null) && ($type != 'php') && ($type != 'iso') &&
Zend_Locale::isLocale($type, null, false)) {
$locale = $type;
$type = null;
Expand All @@ -459,7 +459,7 @@ public function toString($format = null, $type = null, $locale = null)

if ($format === null) {
$format = Zend_Locale_Format::getDateFormat($locale) . ' ' . Zend_Locale_Format::getTimeFormat($locale);
} else if (((self::$_options['format_type'] == 'php') && ($type === null)) or ($type == 'php')) {
} else if (((self::$_options['format_type'] == 'php') && ($type === null)) || ($type == 'php')) {
$format = Zend_Locale_Format::convertPhpToIsoFormat($format);
}

Expand Down Expand Up @@ -1201,7 +1201,7 @@ public function getTimezoneFromString($zone)
}

preg_match('/([+-]\d{2}):{0,1}\d{2}/', $zone, $match);
if (!empty($match) and ($match[count($match) - 1] <= 14) and ($match[count($match) - 1] >= -12)) {
if (!empty($match) && ($match[count($match) - 1] <= 14) && ($match[count($match) - 1] >= -12)) {
$zone = "Etc/GMT";
$zone .= ($match[count($match) - 1] < 0) ? "+" : "-";
$zone .= (int) abs($match[count($match) - 1]);
Expand All @@ -1210,7 +1210,7 @@ public function getTimezoneFromString($zone)

preg_match('/([[:alpha:]\/_]{3,30})(?!.*([[:alpha:]\/]{3,30}))/', $zone, $match);
try {
if (!empty($match) and (!is_int($match[count($match) - 1]))) {
if (!empty($match) && (!is_int($match[count($match) - 1]))) {
$oldzone = $this->getTimezone();
$this->setTimezone($match[count($match) - 1]);
$result = $this->getTimezone();
Expand Down Expand Up @@ -1260,12 +1260,12 @@ private function _assign($calc, $date, $comp = 0, $dst = false)
}

// dst-correction if 'fix_dst' = true and dst !== false but only for non UTC and non GMT
if ((self::$_options['fix_dst'] === true) and ($dst !== false) and ($this->_dst === true)) {
if ((self::$_options['fix_dst'] === true) && ($dst !== false) && ($this->_dst === true)) {
$hour = $this->toString(self::HOUR, 'iso');
if ($hour != $dst) {
if (($dst == ($hour + 1)) or ($dst == ($hour - 23))) {
if (($dst == ($hour + 1)) || ($dst == ($hour - 23))) {
$value += 3600;
} else if (($dst == ($hour - 1)) or ($dst == ($hour + 23))) {
} else if (($dst == ($hour - 1)) || ($dst == ($hour + 23))) {
$value -= 3600;
}
$this->setUnixTimestamp($value);
Expand Down Expand Up @@ -2070,7 +2070,7 @@ private function _calculate($calc, $date, $part, $locale)
if (empty($timematch)) {
preg_match('/[T,\s]{0,1}(\d{2})(\d{2})/', $tmpdate, $timematch);
}
if (empty($datematch) and empty($timematch)) {
if (empty($datematch) && empty($timematch)) {
require_once 'Zend/Date/Exception.php';
throw new Zend_Date_Exception("unsupported ISO8601 format ($date)", 0, null, $date);
}
Expand Down Expand Up @@ -2630,7 +2630,7 @@ private function _calculate($calc, $date, $part, $locale)
}

$parsed = Zend_Locale_Format::getDate($date, array('date_format' => $part, 'locale' => $locale, 'fix_date' => true, 'format_type' => 'iso'));
if ((strpos(strtoupper($part), 'YY') !== false) and (strpos(strtoupper($part), 'YYYY') === false)) {
if ((strpos(strtoupper($part), 'YY') !== false) && (strpos(strtoupper($part), 'YYYY') === false)) {
$parsed['year'] = self::getFullYear($parsed['year']);
}

Expand Down Expand Up @@ -2781,7 +2781,7 @@ private function _time($calc, $time, $format, $locale)
$time = $time->toString('HH:mm:ss', 'iso');
} else {
if (is_array($time)) {
if ((isset($time['hour']) === true) or (isset($time['minute']) === true) or
if ((isset($time['hour']) === true) || (isset($time['minute']) === true) ||
(isset($time['second']) === true)) {
$parsed = $time;
} else {
Expand Down Expand Up @@ -2943,7 +2943,7 @@ private function _date($calc, $date, $format, $locale)
$date = $date->toString('d.M.y', 'iso');
} else {
if (is_array($date)) {
if ((isset($date['year']) === true) or (isset($date['month']) === true) or
if ((isset($date['year']) === true) || (isset($date['month']) === true) ||
(isset($date['day']) === true)) {
$parsed = $date;
} else {
Expand All @@ -2960,7 +2960,7 @@ private function _date($calc, $date, $format, $locale)
}

$parsed = Zend_Locale_Format::getDate($date, array('date_format' => $format, 'locale' => $locale, 'format_type' => 'iso'));
if ((strpos(strtoupper($format), 'YY') !== false) and (strpos(strtoupper($format), 'YYYY') === false)) {
if ((strpos(strtoupper($format), 'YY') !== false) && (strpos(strtoupper($format), 'YYYY') === false)) {
$parsed['year'] = self::getFullYear($parsed['year']);
}
} catch (Zend_Locale_Exception $e) {
Expand Down Expand Up @@ -3247,15 +3247,15 @@ public function compareArpa($date, $locale = null)
*/
private function _checkLocation($location)
{
if (!isset($location['longitude']) or !isset($location['latitude'])) {
if (!isset($location['longitude']) || !isset($location['latitude'])) {
require_once 'Zend/Date/Exception.php';
throw new Zend_Date_Exception('Location must include \'longitude\' and \'latitude\'', 0, null, $location);
}
if (($location['longitude'] > 180) or ($location['longitude'] < -180)) {
if (($location['longitude'] > 180) || ($location['longitude'] < -180)) {
require_once 'Zend/Date/Exception.php';
throw new Zend_Date_Exception('Longitude must be between -180 and 180', 0, null, $location);
}
if (($location['latitude'] > 90) or ($location['latitude'] < -90)) {
if (($location['latitude'] > 90) || ($location['latitude'] < -90)) {
require_once 'Zend/Date/Exception.php';
throw new Zend_Date_Exception('Latitude must be between -90 and 90', 0, null, $location);
}
Expand Down Expand Up @@ -4440,7 +4440,7 @@ public function getFractionalPrecision()
*/
public function setFractionalPrecision($precision)
{
if (!(int)$precision or ($precision < 0) or ($precision > 9)) {
if (!(int)$precision || ($precision < 0) || ($precision > 9)) {
require_once 'Zend/Date/Exception.php';
throw new Zend_Date_Exception("precision ($precision) must be a positive integer less than 10", 0, null, $precision);
}
Expand Down Expand Up @@ -4786,34 +4786,34 @@ public static function isDate($date, $format = null, $locale = null)
$parsed = $date;
}

if (((strpos($format, 'Y') !== false) or (strpos($format, 'y') !== false)) and
if (((strpos($format, 'Y') !== false) || (strpos($format, 'y') !== false)) &&
(!isset($parsed['year']))) {
// Year expected but not found
return false;
}

if ((strpos($format, 'M') !== false) and (!isset($parsed['month']))) {
if ((strpos($format, 'M') !== false) && (!isset($parsed['month']))) {
// Month expected but not found
return false;
}

if ((strpos($format, 'd') !== false) and (!isset($parsed['day']))) {
if ((strpos($format, 'd') !== false) && (!isset($parsed['day']))) {
// Day expected but not found
return false;
}

if (((strpos($format, 'H') !== false) or (strpos($format, 'h') !== false)) and
if (((strpos($format, 'H') !== false) || (strpos($format, 'h') !== false)) &&
(!isset($parsed['hour']))) {
// Hour expected but not found
return false;
}

if ((strpos($format, 'm') !== false) and (!isset($parsed['minute']))) {
if ((strpos($format, 'm') !== false) && (!isset($parsed['minute']))) {
// Minute expected but not found
return false;
}

if ((strpos($format, 's') !== false) and (!isset($parsed['second']))) {
if ((strpos($format, 's') !== false) && (!isset($parsed['second']))) {
// Second expected but not found
return false;
}
Expand Down
Loading

0 comments on commit 273916d

Please sign in to comment.