Skip to content

Commit

Permalink
php-cs-fixer fix --rules=modernize_types_casting
Browse files Browse the repository at this point in the history
  • Loading branch information
Jimbolino committed Jul 12, 2020
1 parent 9620fff commit 24dc176
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 13 deletions.
1 change: 1 addition & 0 deletions .php_cs.dist
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ return PhpCsFixer\Config::create()
->setRules([
'array_syntax' => ['syntax' => 'long'],
'list_syntax' => ['syntax' => 'long'],
'modernize_types_casting' => true,
]);
2 changes: 1 addition & 1 deletion library/Zend/Barcode/Object/Code25.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public function getChecksum($text)
$checksum = 0;

for ($i = strlen($text); $i > 0; $i --) {
$checksum += intval($text[$i - 1]) * $factor;
$checksum += (int) ($text[$i - 1]) * $factor;
$factor = 4 - $factor;
}

Expand Down
6 changes: 3 additions & 3 deletions library/Zend/Date.php
Original file line number Diff line number Diff line change
Expand Up @@ -1481,8 +1481,8 @@ private function _calculate($calc, $date, $part, $locale)

case self::DAY_SHORT:
if (is_numeric($date)) {
return $this->_assign($calc, $this->mktime(0, 0, 0, 1, 1 + intval($date), 1970, true),
$this->mktime(0, 0, 0, 1, 1 + intval($day), 1970, true), $hour);
return $this->_assign($calc, $this->mktime(0, 0, 0, 1, 1 + (int) $date, 1970, true),
$this->mktime(0, 0, 0, 1, 1 + (int) $day, 1970, true), $hour);
}

require_once 'Zend/Date/Exception.php';
Expand Down Expand Up @@ -1516,7 +1516,7 @@ private function _calculate($calc, $date, $part, $locale)
case self::WEEKDAY_8601:
$weekday = (int) $this->toString(self::WEEKDAY_8601, 'iso', $locale);
if ((int)$date < 8 && (int)$date > 0) {
return $this->_assign($calc, $this->mktime(0, 0, 0, 1, 1 + intval($date), 1970, true),
return $this->_assign($calc, $this->mktime(0, 0, 0, 1, 1 + (int) $date, 1970, true),
$this->mktime(0, 0, 0, 1, 1 + $weekday, 1970, true), $hour);
}

Expand Down
2 changes: 1 addition & 1 deletion library/Zend/Date/DateObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -882,7 +882,7 @@ protected function weekNumber($year, $month, $day)
return 1;
}

return intval (((self::dayOfWeek($year, 1, 1) < 5) and (self::dayOfWeek($year, 1, 1) > 0)) +
return (int) (((self::dayOfWeek($year, 1, 1) < 5) and (self::dayOfWeek($year, 1, 1) > 0)) +
4 * ($month - 1) + (2 * ($month - 1) + ($day - 1) + $firstday - $dayofweek + 6) * 36 / 256);
}

Expand Down
2 changes: 1 addition & 1 deletion library/Zend/Db/Adapter/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,7 @@ public function quote($value, $type = null)
$quotedValue = '0';
switch ($this->_numericDataTypes[$type]) {
case Zend_Db::INT_TYPE: // 32-bit integer
$quotedValue = (string) intval($value);
$quotedValue = (string) (int) $value;
break;
case Zend_Db::BIGINT_TYPE: // 64-bit integer
// ANSI SQL-style hex literals (e.g. x'[\dA-F]+')
Expand Down
4 changes: 2 additions & 2 deletions library/Zend/Db/Select.php
Original file line number Diff line number Diff line change
Expand Up @@ -1259,12 +1259,12 @@ protected function _renderOrder($sql)
$order = array();
foreach ($this->_parts[self::ORDER] as $term) {
if (is_array($term)) {
if(is_numeric($term[0]) && strval(intval($term[0])) == $term[0]) {
if(is_numeric($term[0]) && (string) ((int) ($term[0])) == $term[0]) {
$order[] = (int)trim($term[0]) . ' ' . $term[1];
} else {
$order[] = $this->_adapter->quoteIdentifier($term[0], true) . ' ' . $term[1];
}
} elseif (is_numeric($term) && strval(intval($term)) == $term) {
} elseif (is_numeric($term) && (string) ((int) $term) == $term) {
$order[] = (int)trim($term);
} else {
$order[] = $this->_adapter->quoteIdentifier($term, true);
Expand Down
2 changes: 1 addition & 1 deletion library/Zend/Json.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ protected static function _getXmlValue($simpleXmlElementObject) {
if ($match) {
return new Zend_Json_Expr($matchings[1]);
} else {
return (trim(strval($simpleXmlElementObject)));
return (trim((string) $simpleXmlElementObject));
}
}
/**
Expand Down
6 changes: 3 additions & 3 deletions library/Zend/Service/Amazon/Ec2/Ebs.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,9 @@ public function detachVolume($volumeId, $instanceId = null, $device = null, $for
$params = array();
$params['Action'] = 'DetachVolume';
$params['VolumeId'] = $volumeId;
$params['InstanceId'] = strval($instanceId);
$params['Device'] = strval($device);
$params['Force'] = strval($force);
$params['InstanceId'] = (string) $instanceId;
$params['Device'] = (string) $device;
$params['Force'] = (string) $force;

$response = $this->sendRequest($params);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function getName()
*/
public function decorate($content, $lineLength)
{
if((int)strval($lineLength) != $lineLength) {
if((int)(string) $lineLength != $lineLength) {
$lineLength = 72;
}

Expand Down

0 comments on commit 24dc176

Please sign in to comment.