diff --git a/lib/Cake/Cache/Engine/ApcEngine.php b/lib/Cake/Cache/Engine/ApcEngine.php index 37548f33e..c2f0acfe1 100644 --- a/lib/Cake/Cache/Engine/ApcEngine.php +++ b/lib/Cake/Cache/Engine/ApcEngine.php @@ -75,7 +75,7 @@ class ApcEngine extends CacheEngine { */ public function read($key) { $time = time(); - $cachetime = intval(apc_fetch($key . '_expires')); + $cachetime = (int)apc_fetch($key . '_expires'); if ($cachetime !== 0 && ($cachetime < $time || ($time + $this->settings['duration']) < $cachetime)) { return false; } diff --git a/lib/Cake/Cache/Engine/FileEngine.php b/lib/Cake/Cache/Engine/FileEngine.php index 904dc0d2b..434191558 100644 --- a/lib/Cake/Cache/Engine/FileEngine.php +++ b/lib/Cake/Cache/Engine/FileEngine.php @@ -165,7 +165,7 @@ class FileEngine extends CacheEngine { $this->_File->rewind(); $time = time(); - $cachetime = intval($this->_File->current()); + $cachetime = (int)$this->_File->current(); if ($cachetime !== false && ($cachetime < $time || ($time + $this->settings['duration']) < $cachetime)) { if ($this->settings['lock']) { diff --git a/lib/Cake/Cache/Engine/WincacheEngine.php b/lib/Cake/Cache/Engine/WincacheEngine.php index df684f0bc..392955718 100644 --- a/lib/Cake/Cache/Engine/WincacheEngine.php +++ b/lib/Cake/Cache/Engine/WincacheEngine.php @@ -80,7 +80,7 @@ class WincacheEngine extends CacheEngine { */ public function read($key) { $time = time(); - $cachetime = intval(wincache_ucache_get($key . '_expires')); + $cachetime = (int)wincache_ucache_get($key . '_expires'); if ($cachetime < $time || ($time + $this->settings['duration']) < $cachetime) { return false; } diff --git a/lib/Cake/Cache/Engine/XcacheEngine.php b/lib/Cake/Cache/Engine/XcacheEngine.php index afa1613ba..9c1855605 100644 --- a/lib/Cake/Cache/Engine/XcacheEngine.php +++ b/lib/Cake/Cache/Engine/XcacheEngine.php @@ -80,7 +80,7 @@ class XcacheEngine extends CacheEngine { public function read($key) { if (xcache_isset($key)) { $time = time(); - $cachetime = intval(xcache_get($key . '_expires')); + $cachetime = (int)xcache_get($key . '_expires'); if ($cachetime < $time || ($time + $this->settings['duration']) < $cachetime) { return false; } diff --git a/lib/Cake/Console/Command/AclShell.php b/lib/Cake/Console/Command/AclShell.php index 622bc20ce..f5e493f7a 100644 --- a/lib/Cake/Console/Command/AclShell.php +++ b/lib/Cake/Console/Command/AclShell.php @@ -579,8 +579,8 @@ class AclShell extends AppShell { * @return array aro, aco, action */ protected function _getParams() { - $aro = is_numeric($this->args[0]) ? intval($this->args[0]) : $this->args[0]; - $aco = is_numeric($this->args[1]) ? intval($this->args[1]) : $this->args[1]; + $aro = is_numeric($this->args[0]) ? (int)$this->args[0] : $this->args[0]; + $aco = is_numeric($this->args[1]) ? (int)$this->args[1] : $this->args[1]; $aroName = $aro; $acoName = $aco; diff --git a/lib/Cake/Console/Command/Task/ModelTask.php b/lib/Cake/Console/Command/Task/ModelTask.php index 878fcded9..3b6282739 100644 --- a/lib/Cake/Console/Command/Task/ModelTask.php +++ b/lib/Cake/Console/Command/Task/ModelTask.php @@ -728,7 +728,7 @@ class ModelTask extends BakeTask { while (strtolower($wannaDoMoreAssoc) === 'y') { $assocs = array('belongsTo', 'hasOne', 'hasMany', 'hasAndBelongsToMany'); $this->out(__d('cake_console', 'What is the association type?')); - $assocType = intval($this->inOptions($assocs, __d('cake_console', 'Enter a number'))); + $assocType = (int)$this->inOptions($assocs, __d('cake_console', 'Enter a number')); $this->out(__d('cake_console', "For the following options be very careful to match your setup exactly.\n" . "Any spelling mistakes will cause errors.")); diff --git a/lib/Cake/Controller/Component/PaginatorComponent.php b/lib/Cake/Controller/Component/PaginatorComponent.php index 960484b40..82a322fec 100644 --- a/lib/Cake/Controller/Component/PaginatorComponent.php +++ b/lib/Cake/Controller/Component/PaginatorComponent.php @@ -211,7 +211,7 @@ class PaginatorComponent extends Component { } $count = $object->find('count', array_merge($parameters, $extra)); } - $pageCount = intval(ceil($count / $limit)); + $pageCount = (int)ceil($count / $limit); $requestedPage = $page; $page = max(min($page, $pageCount), 1); diff --git a/lib/Cake/Model/Datasource/Database/Sqlite.php b/lib/Cake/Model/Datasource/Database/Sqlite.php index b33f4d0f2..5e141a757 100644 --- a/lib/Cake/Model/Datasource/Database/Sqlite.php +++ b/lib/Cake/Model/Datasource/Database/Sqlite.php @@ -509,7 +509,7 @@ class Sqlite extends DboSource { $key['name'] = 'PRIMARY'; } $index[$key['name']]['column'] = $keyCol[0]['name']; - $index[$key['name']]['unique'] = intval($key['unique'] == 1); + $index[$key['name']]['unique'] = (int)$key['unique'] === 1; } else { if (!is_array($index[$key['name']]['column'])) { $col[] = $index[$key['name']]['column']; diff --git a/lib/Cake/Model/Datasource/Database/Sqlserver.php b/lib/Cake/Model/Datasource/Database/Sqlserver.php index 2d71b512a..393184460 100644 --- a/lib/Cake/Model/Datasource/Database/Sqlserver.php +++ b/lib/Cake/Model/Datasource/Database/Sqlserver.php @@ -537,9 +537,9 @@ class Sqlserver extends DboSource { if (version_compare($this->getVersion(), '11', '<') && preg_match('/FETCH\sFIRST\s+([0-9]+)/i', $limit, $offset)) { preg_match('/OFFSET\s*(\d+)\s*.*?(\d+)\s*ROWS/', $limit, $limitOffset); - $limit = 'TOP ' . intval($limitOffset[2]); - $page = intval($limitOffset[1] / $limitOffset[2]); - $offset = intval($limitOffset[2] * $page); + $limit = 'TOP ' . (int)$limitOffset[2]; + $page = (int)($limitOffset[1] / $limitOffset[2]); + $offset = (int)($limitOffset[2] * $page); $rowCounter = self::ROW_COUNTER; $sql = "SELECT {$limit} * FROM ( diff --git a/lib/Cake/Model/Model.php b/lib/Cake/Model/Model.php index a33b4a888..bb4a44ce1 100644 --- a/lib/Cake/Model/Model.php +++ b/lib/Cake/Model/Model.php @@ -2094,7 +2094,7 @@ class Model extends Object implements CakeEventListener { if (isset($keys['old'][$foreignKey]) && $keys['old'][$foreignKey] != $keys[$foreignKey]) { $conditions[$fkQuoted] = $keys['old'][$foreignKey]; - $count = intval($this->find('count', compact('conditions', 'recursive'))); + $count = (int)$this->find('count', compact('conditions', 'recursive')); $Model->updateAll( array($field => $count), @@ -2108,7 +2108,7 @@ class Model extends Object implements CakeEventListener { $conditions = array_merge($conditions, (array)$conditions); } - $count = intval($this->find('count', compact('conditions', 'recursive'))); + $count = (int)$this->find('count', compact('conditions', 'recursive')); $Model->updateAll( array($field => $count), @@ -2979,7 +2979,7 @@ class Model extends Object implements CakeEventListener { $query = $this->{'_find' . ucfirst($type)}('before', $query); } - if (!is_numeric($query['page']) || intval($query['page']) < 1) { + if (!is_numeric($query['page']) || (int)$query['page'] < 1) { $query['page'] = 1; } @@ -3092,7 +3092,7 @@ class Model extends Object implements CakeEventListener { return count($results); } - return intval($results[0][$key]['count']); + return (int)$results[0][$key]['count']; } } diff --git a/lib/Cake/Test/Case/Model/ModelWriteTest.php b/lib/Cake/Test/Case/Model/ModelWriteTest.php index cf125c76d..0cecb0156 100644 --- a/lib/Cake/Test/Case/Model/ModelWriteTest.php +++ b/lib/Cake/Test/Case/Model/ModelWriteTest.php @@ -2528,7 +2528,7 @@ class ModelWriteTest extends BaseModelTest { 'user' => 'some user', 'password' => 'some password' ))); - $this->assertTrue(is_int($TestModel->id) || (intval($TestModel->id) === 5)); + $this->assertTrue(is_int($TestModel->id) || ((int)$TestModel->id === 5)); $id = $TestModel->id; $TestModel->save(array( diff --git a/lib/Cake/Utility/CakeTime.php b/lib/Cake/Utility/CakeTime.php index 8b995feca..47ca44fe5 100644 --- a/lib/Cake/Utility/CakeTime.php +++ b/lib/Cake/Utility/CakeTime.php @@ -994,12 +994,12 @@ class CakeTime { $time = self::fromString($dateString); } return gmmktime( - intval(date('G', $time)), - intval(date('i', $time)), - intval(date('s', $time)), - intval(date('n', $time)), - intval(date('j', $time)), - intval(date('Y', $time)) + (int)date('G', $time), + (int)date('i', $time), + (int)date('s', $time), + (int)date('n', $time), + (int)date('j', $time), + (int)date('Y', $time) ); } diff --git a/lib/Cake/View/Helper/FormHelper.php b/lib/Cake/View/Helper/FormHelper.php index 7cbe69a88..815516ba9 100644 --- a/lib/Cake/View/Helper/FormHelper.php +++ b/lib/Cake/View/Helper/FormHelper.php @@ -2893,7 +2893,7 @@ class FormHelper extends AppHelper { } break; case 'year': - $current = intval(date('Y')); + $current = (int)date('Y'); $min = !isset($options['min']) ? $current - 20 : (int)$options['min']; $max = !isset($options['max']) ? $current + 20 : (int)$options['max']; diff --git a/lib/Cake/View/Helper/JsHelper.php b/lib/Cake/View/Helper/JsHelper.php index b3fe28103..e534b28ca 100644 --- a/lib/Cake/View/Helper/JsHelper.php +++ b/lib/Cake/View/Helper/JsHelper.php @@ -292,7 +292,7 @@ class JsHelper extends AppHelper { */ public function link($title, $url = null, $options = array()) { if (!isset($options['id'])) { - $options['id'] = 'link-' . intval(mt_rand()); + $options['id'] = 'link-' . (int)mt_rand(); } list($options, $htmlOptions) = $this->_getHtmlOptions($options); $out = $this->Html->link($title, $url, $htmlOptions); @@ -368,7 +368,7 @@ class JsHelper extends AppHelper { */ public function submit($caption = null, $options = array()) { if (!isset($options['id'])) { - $options['id'] = 'submit-' . intval(mt_rand()); + $options['id'] = 'submit-' . (int)mt_rand(); } $formOptions = array('div'); list($options, $htmlOptions) = $this->_getHtmlOptions($options, $formOptions); diff --git a/lib/Cake/View/Helper/PaginatorHelper.php b/lib/Cake/View/Helper/PaginatorHelper.php index aeedb5730..ccbcc4794 100644 --- a/lib/Cake/View/Helper/PaginatorHelper.php +++ b/lib/Cake/View/Helper/PaginatorHelper.php @@ -740,7 +740,7 @@ class PaginatorHelper extends AppHelper { $out = ''; if ($modulus && $params['pageCount'] > $modulus) { - $half = intval($modulus / 2); + $half = (int)($modulus / 2); $end = $params['page'] + $half; if ($end > $params['pageCount']) {