Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

strategy:
matrix:
php-version: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
php-version: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5']

steps:
- name: Checkout
Expand Down Expand Up @@ -63,7 +63,7 @@ jobs:

strategy:
matrix:
php-version: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
php-version: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5']

steps:
- name: Checkout
Expand Down Expand Up @@ -114,7 +114,7 @@ jobs:

strategy:
matrix:
php-version: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
php-version: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5']

steps:
- name: Checkout
Expand Down
2 changes: 1 addition & 1 deletion src/xPDO/Cache/xPDOCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function __construct(& $xpdo, $options = array()) {
* @return boolean true if the implementation was initialized successfully.
*/
public function isInitialized() {
return (boolean) $this->initialized;
return (bool) $this->initialized;
}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/xPDO/Cache/xPDOCacheManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,8 @@ public function writeFile($filename, $content, $mode= 'wb', $options= array()) {
} else {
$locked = false;
$attempt = 1;
$attempts = (integer) $this->getOption(xPDO::OPT_CACHE_ATTEMPTS, $options, 1);
$attemptDelay = (integer) $this->getOption(xPDO::OPT_CACHE_ATTEMPT_DELAY, $options, 1000);
$attempts = (int) $this->getOption(xPDO::OPT_CACHE_ATTEMPTS, $options, 1);
$attemptDelay = (int) $this->getOption(xPDO::OPT_CACHE_ATTEMPT_DELAY, $options, 1000);
while (!$locked && ($attempts === 0 || $attempt <= $attempts)) {
if ($this->getOption('use_flock', $options, true)) {
$locked = flock($file, LOCK_EX | LOCK_NB);
Expand Down Expand Up @@ -466,7 +466,7 @@ public function deleteTree($dirname, $options= array('deleteTop' => false, 'skip
if (!is_array($options)) {
$numArgs = func_num_args();
$options = array(
'deleteTop' => is_scalar($options) ? (boolean) $options : false
'deleteTop' => is_scalar($options) ? (bool) $options : false
,'skipDirs' => $numArgs > 2 ? func_get_arg(2) : false
,'extensions' => $numArgs > 3 ? func_get_arg(3) : array('.cache.php')
);
Expand Down
4 changes: 2 additions & 2 deletions src/xPDO/Cache/xPDOFileCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function set($key, $var, $expire= 0, $options= array()) {
$expireContent= 'if(time() > ' . $expirationTS . '){return null;}';
}
$fileName= $this->getCacheKey($key, $options);
$format = (integer) $this->getOption(xPDO::OPT_CACHE_FORMAT, $options, xPDOCacheManager::CACHE_PHP);
$format = (int) $this->getOption(xPDO::OPT_CACHE_FORMAT, $options, xPDOCacheManager::CACHE_PHP);
switch ($format) {
case xPDOCacheManager::CACHE_SERIALIZE:
$content= serialize(array('expires' => $expirationTS, 'content' => $var));
Expand Down Expand Up @@ -107,7 +107,7 @@ public function get($key, $options= array()) {
$cacheKey= $this->getCacheKey($key, $options);
if (file_exists($cacheKey)) {
if ($file = @fopen($cacheKey, 'rb')) {
$format = (integer) $this->getOption(xPDO::OPT_CACHE_FORMAT, $options, xPDOCacheManager::CACHE_PHP);
$format = (int) $this->getOption(xPDO::OPT_CACHE_FORMAT, $options, xPDOCacheManager::CACHE_PHP);
if (flock($file, LOCK_SH)) {
switch ($format) {
case xPDOCacheManager::CACHE_PHP:
Expand Down
4 changes: 2 additions & 2 deletions src/xPDO/Cache/xPDOMemCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ public function __construct(& $xpdo, $options = array()) {
$servers = explode(',', $this->getOption($this->key . '_memcached_server', $options, $this->getOption('memcached_server', $options, 'localhost:11211')));
foreach ($servers as $server) {
$server = explode(':', $server);
$this->memcache->addServer($server[0], (integer) $server[1]);
$this->memcache->addServer($server[0], (int) $server[1]);
}
$compressThreshold = $this->getOption($this->key . '_memcached_compress_threshold', $options, $this->getOption('memcached_compress_threshold', array(), '20000:0.2'));
if (!empty($compressThreshold)) {
$threshold = explode(':', $compressThreshold);
if (count($threshold) == 2) {
$minValue = (integer) $threshold[0];
$minValue = (int) $threshold[0];
$minSaving = (float) $threshold[1];
if ($minSaving >= 0 && $minSaving <= 1) {
$this->memcache->setCompressThreshold($minValue, $minSaving);
Expand Down
4 changes: 2 additions & 2 deletions src/xPDO/Cache/xPDOMemCached.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ public function __construct(& $xpdo, $options = array()) {
$servers = explode(',', $this->getOption($this->key . '_memcached_server', $options, $this->getOption('memcached_server', $options, 'localhost:11211')));
foreach ($servers as $server) {
$server = explode(':', $server);
$this->memcached->addServer($server[0], (integer) $server[1]);
$this->memcached->addServer($server[0], (int) $server[1]);
}
$this->memcached->setOption(Memcached::OPT_COMPRESSION, (boolean) $this->getOption($this->key . '_memcached_compression', $options, $this->getOption('memcached_compression', $options, $this->getOption(Memcached::OPT_COMPRESSION, $options, true))));
$this->memcached->setOption(Memcached::OPT_COMPRESSION, (bool) $this->getOption($this->key . '_memcached_compression', $options, $this->getOption('memcached_compression', $options, $this->getOption(Memcached::OPT_COMPRESSION, $options, true))));
$this->initialized = true;
} else {
$this->memcached = null;
Expand Down
4 changes: 2 additions & 2 deletions src/xPDO/Cache/xPDORedisCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ public function __construct(&$xpdo, $options = [])
$this->getOption('redis_server', $options, 'localhost:6379')
)
);
if ($this->redis->pconnect($server[0], (integer)$server[1])) {
if ($this->redis->pconnect($server[0], (int)$server[1])) {
$redis_auth = $this->getOption('redis_auth', $options, '');
if (!empty($redis_auth)) {
$this->redis->auth($redis_auth);
}
$this->redis->select((integer)$this->getOption('redis_db', $options, 0));
$this->redis->select((int)$this->getOption('redis_db', $options, 0));
$this->redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_PHP);
$this->initialized = true;
}
Expand Down
2 changes: 1 addition & 1 deletion src/xPDO/Om/sqlsrv/xPDOQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public function parseConditions($conditions, $conjunction = xPDOQuery::SQL_AND)
foreach ($val as $v) {
switch ($type) {
case \PDO::PARAM_INT:
$vals[] = (integer) $v;
$vals[] = (int) $v;
break;
case \PDO::PARAM_STR:
$vals[] = $this->xpdo->quote($v);
Expand Down
10 changes: 5 additions & 5 deletions src/xPDO/Om/xPDOGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -240,12 +240,12 @@ abstract public function writeSchema(string $schemaFile, string $package = '', s
public function parseSchema($schemaFile, $outputDir= '', $options = array()) {
$this->_reset();
if (!is_array($options)) {
$compile = (boolean) $options;
$compile = (bool) $options;
} else {
$compile = array_key_exists('compile', $options) ? (boolean) $options['compile'] : false;
$compile = array_key_exists('compile', $options) ? (bool) $options['compile'] : false;
}
$regenerate = array_key_exists('regenerate', $options) ? (integer) $options['regenerate'] : 0;
$update = array_key_exists('update', $options) ? (integer) $options['update'] : 2;
$regenerate = array_key_exists('regenerate', $options) ? (int) $options['regenerate'] : 0;
$update = array_key_exists('update', $options) ? (int) $options['update'] : 2;
$namespacePrefix = array_key_exists('namespacePrefix', $options) ? trim($options['namespacePrefix'], '\\') : '';

$this->schemaFile= $schemaFile;
Expand Down Expand Up @@ -307,7 +307,7 @@ public function parseSchema($schemaFile, $outputDir= '', $options = array()) {
case 'integer':
case 'boolean':
case 'bit':
$fldAttrValue = (integer) $fldAttrValue;
$fldAttrValue = (int) $fldAttrValue;
break;
case 'float':
case 'numeric':
Expand Down
22 changes: 11 additions & 11 deletions src/xPDO/Om/xPDOObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ public static function loadCollection(xPDO & $xpdo, $className, $criteria= null,
if (!$className= $xpdo->loadClass($className)) return $objCollection;
$rows= false;
$fromCache= false;
$collectionCaching = (integer) $xpdo->getOption(xPDO::OPT_CACHE_DB_COLLECTIONS, array(), 1);
$collectionCaching = (int) $xpdo->getOption(xPDO::OPT_CACHE_DB_COLLECTIONS, array(), 1);
if (!is_object($criteria)) {
$criteria= $xpdo->getCriteria($className, $criteria, $cacheFlag);
}
Expand Down Expand Up @@ -516,7 +516,7 @@ public static function loadCollectionGraph(xPDO & $xpdo, $className, $graph, $cr
$query->bindGraph($graph);
$rows = array();
$fromCache = false;
$collectionCaching = (integer) $xpdo->getOption(xPDO::OPT_CACHE_DB_COLLECTIONS, array(), 1);
$collectionCaching = (int) $xpdo->getOption(xPDO::OPT_CACHE_DB_COLLECTIONS, array(), 1);
if ($collectionCaching > 0 && $xpdo->_cacheEnabled && $cacheFlag) {
$rows= $xpdo->fromCache($query);
$fromCache = !empty($rows);
Expand Down Expand Up @@ -797,7 +797,7 @@ public function set($k, $v= null, $vType= '') {
//type validation
$phptype= $this->_fieldMeta[$k]['phptype'];
$dbtype= $this->_fieldMeta[$k]['dbtype'];
$allowNull= isset($this->_fieldMeta[$k]['null']) ? (boolean) $this->_fieldMeta[$k]['null'] : true;
$allowNull= isset($this->_fieldMeta[$k]['null']) ? (bool) $this->_fieldMeta[$k]['null'] : true;
if ($v === null) {
if ($allowNull) {
$this->_fields[$k]= null;
Expand All @@ -813,7 +813,7 @@ public function set($k, $v= null, $vType= '') {
$ts= false;
if (preg_match('/int/i', $dbtype)) {
if (strtolower($vType) == 'integer' || is_int($v) || $v == '0') {
$ts= (integer) $v;
$ts= (int) $v;
} else {
$ts= strtotime($v);
}
Expand Down Expand Up @@ -842,7 +842,7 @@ public function set($k, $v= null, $vType= '') {
case 'date' :
if (preg_match('/int/i', $dbtype)) {
if (strtolower($vType) == 'integer' || is_int($v) || $v == '0') {
$ts= (integer) $v;
$ts= (int) $v;
} else {
$ts= strtotime($v);
}
Expand Down Expand Up @@ -974,7 +974,7 @@ public function get($k, $format = null, $formatTemplate= null) {
if ($value !== null) {
switch ($fieldType) {
case 'boolean' :
$value= (boolean) $value;
$value= (bool) $value;
break;
case 'integer' :
$value= intval($value);
Expand Down Expand Up @@ -1707,8 +1707,8 @@ public function remove(array $ancestors= array ()) {
array(
xPDO::OPT_CACHE_KEY => $this->getOption('cache_db_key', null, 'db'),
xPDO::OPT_CACHE_HANDLER => $this->getOption(xPDO::OPT_CACHE_DB_HANDLER, null, $this->getOption(xPDO::OPT_CACHE_HANDLER, null, 'xPDO\\Cache\\xPDOFileCache')),
xPDO::OPT_CACHE_FORMAT => (integer) $this->getOption('cache_db_format', null, $this->getOption(xPDO::OPT_CACHE_FORMAT, null, xPDOCacheManager::CACHE_PHP)),
xPDO::OPT_CACHE_EXPIRES => (integer) $this->getOption(xPDO::OPT_CACHE_DB_EXPIRES, null, $this->getOption(xPDO::OPT_CACHE_EXPIRES, null, 0)),
xPDO::OPT_CACHE_FORMAT => (int) $this->getOption('cache_db_format', null, $this->getOption(xPDO::OPT_CACHE_FORMAT, null, xPDOCacheManager::CACHE_PHP)),
xPDO::OPT_CACHE_EXPIRES => (int) $this->getOption(xPDO::OPT_CACHE_DB_EXPIRES, null, $this->getOption(xPDO::OPT_CACHE_EXPIRES, null, 0)),
xPDO::OPT_CACHE_PREFIX => $this->getOption('cache_db_prefix', null, xPDOCacheManager::CACHE_DIR)
)
);
Expand Down Expand Up @@ -2402,7 +2402,7 @@ public function setDirty($key= '') {
* the database.
*/
public function isNew() {
return (boolean) $this->_new;
return (bool) $this->_new;
}

/**
Expand Down Expand Up @@ -2481,7 +2481,7 @@ protected function _setRaw($key, $val) {
case 'int':
case 'integer':
case 'boolean':
$this->_fields[$key] = (integer) $val;
$this->_fields[$key] = (int) $val;
$set = true;
break;
case 'float':
Expand Down Expand Up @@ -2519,7 +2519,7 @@ protected function _setRaw($key, $val) {
case 'datetime':
case 'timestamp':
if (preg_match('/int/i', $dbtype)) {
$this->_fields[$key] = (integer) $val;
$this->_fields[$key] = (int) $val;
$set = true;
break;
}
Expand Down
2 changes: 1 addition & 1 deletion src/xPDO/Om/xPDOQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,7 @@ public function parseConditions($conditions, $conjunction = xPDOQuery::SQL_AND)
} else {
switch ($type) {
case \PDO::PARAM_INT:
$vals[] = (integer) $v;
$vals[] = (int) $v;
break;
case \PDO::PARAM_STR:
$vals[] = $this->xpdo->quote($v);
Expand Down
4 changes: 2 additions & 2 deletions src/xPDO/Transport/xPDOFileVehicle.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ protected function _installFiles(& $transport, $options) {
$fileTargetPath = $fileTarget . $fileName;
$preExistingMode = xPDOTransport::PRESERVE_PREEXISTING;
if (isset ($vOptions[xPDOTransport::PREEXISTING_MODE])) {
$preExistingMode = (integer) $vOptions[xPDOTransport::PREEXISTING_MODE];
$preExistingMode = (int) $vOptions[xPDOTransport::PREEXISTING_MODE];
}
$cacheManager = $transport->xpdo->getCacheManager();
if ($this->validate($transport, $object, $vOptions)) {
Expand Down Expand Up @@ -120,7 +120,7 @@ protected function _uninstallFiles(& $transport, $options) {
$fileTarget = eval ($object['target']);
$preExistingMode = xPDOTransport::PRESERVE_PREEXISTING;
if (isset ($vOptions[xPDOTransport::PREEXISTING_MODE])) {
$preExistingMode = (integer) $vOptions[xPDOTransport::PREEXISTING_MODE];
$preExistingMode = (int) $vOptions[xPDOTransport::PREEXISTING_MODE];
}
$cacheManager = $transport->xpdo->getCacheManager();
$path = $fileTarget . $fileName;
Expand Down
2 changes: 1 addition & 1 deletion src/xPDO/Transport/xPDOObjectVehicle.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function get(& $transport, $options = array (), $element = null) {
$options = array_merge($options, $element);
$setKeys = false;
if (isset ($options[xPDOTransport::PRESERVE_KEYS])) {
$setKeys = (boolean) $options[xPDOTransport::PRESERVE_KEYS];
$setKeys = (bool) $options[xPDOTransport::PRESERVE_KEYS];
}
$object->fromJSON($element['object'], '', $setKeys, true);
}
Expand Down
2 changes: 1 addition & 1 deletion src/xPDO/Validation/xPDOValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function validate(array $parameters = array()) {
if (is_null($this->object->_fields[$column])) {
$result = false;
} else {
$result = (boolean)preg_match($rule['rule'], $this->object->_fields[$column]);
$result = (bool)preg_match($rule['rule'], $this->object->_fields[$column]);
}
if (!$result) $this->addMessage($column, $ruleName, isset($rule['parameters']['message']) ? $rule['parameters']['message'] : $ruleName . ' failed');
if ($this->object->xpdo->getDebug() === true)
Expand Down
Loading