mirror of
https://github.com/yiisoft/yii.git
synced 2026-02-19 17:11:23 +01:00
Fix deprecated non-canonical casts to canonical forms
Replace deprecated non-canonical PHP casts with their canonical equivalents: - (integer) → (int) - (boolean) → (bool) - (double) / (real) → (float) - (binary) → (string) This addresses PHP 8.5 deprecation warnings for non-canonical cast syntax.
This commit is contained in:
@@ -144,8 +144,8 @@ class CDbColumnSchema extends CComponent
|
||||
switch($this->type)
|
||||
{
|
||||
case 'string': return (string)$value;
|
||||
case 'integer': return (integer)$value;
|
||||
case 'boolean': return (boolean)$value;
|
||||
case 'integer': return (int)$value;
|
||||
case 'boolean': return (bool)$value;
|
||||
case 'double':
|
||||
default: return $value;
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ class CPropertyValue
|
||||
if (is_string($value))
|
||||
return !strcasecmp($value,'true') || ($value!=0 && $value!=='' && is_numeric($value));
|
||||
else
|
||||
return (boolean)$value;
|
||||
return (bool)$value;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -80,7 +80,7 @@ class CPropertyValue
|
||||
*/
|
||||
public static function ensureInteger($value)
|
||||
{
|
||||
return (integer)$value;
|
||||
return (int)$value;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -112,8 +112,8 @@ class CTimestamp
|
||||
protected static function digitCheck($y)
|
||||
{
|
||||
if ($y < 100){
|
||||
$yr = (integer) date("Y");
|
||||
$century = (integer) ($yr /100);
|
||||
$yr = (int) date("Y");
|
||||
$century = (int) ($yr /100);
|
||||
|
||||
if ($yr%100 > 50) {
|
||||
$c1 = $century + 1;
|
||||
|
||||
@@ -117,9 +117,9 @@ class CTypeValidator extends CValidator
|
||||
return false;
|
||||
|
||||
if($type==='integer')
|
||||
return (boolean)preg_match('/^[-+]?[0-9]+$/',trim($value));
|
||||
return (bool)preg_match('/^[-+]?[0-9]+$/',trim($value));
|
||||
elseif($type==='double')
|
||||
return (boolean)preg_match('/^[-+]?([0-9]*\.)?[0-9]+([eE][-+]?[0-9]+)?$/',trim($value));
|
||||
return (bool)preg_match('/^[-+]?([0-9]*\.)?[0-9]+([eE][-+]?[0-9]+)?$/',trim($value));
|
||||
elseif($type==='date')
|
||||
return CDateTimeParser::parse($value,$this->dateFormat,array('month'=>1,'day'=>1,'hour'=>0,'minute'=>0,'second'=>0))!==false;
|
||||
elseif($type==='time')
|
||||
|
||||
2
framework/vendors/Net_IDNA2/Net/IDNA2.php
vendored
2
framework/vendors/Net_IDNA2/Net/IDNA2.php
vendored
@@ -3351,7 +3351,7 @@ class Net_IDNA2
|
||||
if (self::$_mb_string_overload) {
|
||||
return mb_strlen($string, '8bit');
|
||||
}
|
||||
return strlen((binary)$string);
|
||||
return strlen((string)$string);
|
||||
}
|
||||
|
||||
// }}}}
|
||||
|
||||
@@ -972,11 +972,11 @@ class CHttpRequest extends CApplicationComponent
|
||||
if($matches[4][$i]==='q')
|
||||
{
|
||||
// sanity check on q value
|
||||
$q=(double)$matches[5][$i];
|
||||
$q=(float)$matches[5][$i];
|
||||
if($q>1)
|
||||
$q=(double)1;
|
||||
$q=(float)1;
|
||||
elseif($q<0)
|
||||
$q=(double)0;
|
||||
$q=(float)0;
|
||||
$accept['params'][$matches[4][$i]]=$q;
|
||||
}
|
||||
else
|
||||
@@ -987,7 +987,7 @@ class CHttpRequest extends CApplicationComponent
|
||||
}
|
||||
// q defaults to 1 if not explicitly given
|
||||
if(!isset($accept['params']['q']))
|
||||
$accept['params']['q']=(double)1;
|
||||
$accept['params']['q']=(float)1;
|
||||
$accepts[] = $accept;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -362,8 +362,8 @@ class CJSON
|
||||
// return (float)$str;
|
||||
|
||||
// Return float or int, as appropriate
|
||||
return ((float)$str == (integer)$str)
|
||||
? (integer)$str
|
||||
return ((float)$str == (int)$str)
|
||||
? (int)$str
|
||||
: (float)$str;
|
||||
|
||||
} elseif (preg_match('/^("|\').+(\1)$/s', $str, $m) && $m[1] == $m[2]) {
|
||||
|
||||
@@ -2775,11 +2775,11 @@ class CHttpRequest extends CApplicationComponent
|
||||
if($matches[4][$i]==='q')
|
||||
{
|
||||
// sanity check on q value
|
||||
$q=(double)$matches[5][$i];
|
||||
$q=(float)$matches[5][$i];
|
||||
if($q>1)
|
||||
$q=(double)1;
|
||||
$q=(float)1;
|
||||
elseif($q<0)
|
||||
$q=(double)0;
|
||||
$q=(float)0;
|
||||
$accept['params'][$matches[4][$i]]=$q;
|
||||
}
|
||||
else
|
||||
@@ -2790,7 +2790,7 @@ class CHttpRequest extends CApplicationComponent
|
||||
}
|
||||
// q defaults to 1 if not explicitly given
|
||||
if(!isset($accept['params']['q']))
|
||||
$accept['params']['q']=(double)1;
|
||||
$accept['params']['q']=(float)1;
|
||||
$accepts[] = $accept;
|
||||
}
|
||||
}
|
||||
@@ -10327,8 +10327,8 @@ class CDbColumnSchema extends CComponent
|
||||
switch($this->type)
|
||||
{
|
||||
case 'string': return (string)$value;
|
||||
case 'integer': return (integer)$value;
|
||||
case 'boolean': return (boolean)$value;
|
||||
case 'integer': return (int)$value;
|
||||
case 'boolean': return (bool)$value;
|
||||
case 'double':
|
||||
default: return $value;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user