diff --git a/app/Views/errors/html/error_exception.php b/app/Views/errors/html/error_exception.php
index 7052e53b950a..09fddcbd31ea 100644
--- a/app/Views/errors/html/error_exception.php
+++ b/app/Views/errors/html/error_exception.php
@@ -132,7 +132,7 @@
+ } ?>
$= $var ?>
@@ -235,7 +235,7 @@
+ } ?>
@@ -287,15 +287,15 @@
- $value) : ?>
+
+ } ?>
+ } ?>
= esc($h->getName(), 'html') ?> |
diff --git a/system/CLI/CLI.php b/system/CLI/CLI.php
index e60036c79d0a..23e68c4c6d4f 100644
--- a/system/CLI/CLI.php
+++ b/system/CLI/CLI.php
@@ -437,7 +437,7 @@ public static function newLine(int $num = 1)
// Do it once or more, write with empty string gives us a new line
for ($i = 0; $i < $num; $i ++)
{
- static::write('');
+ static::write();
}
}
@@ -504,9 +504,7 @@ public static function color(string $text, string $foreground, string $backgroun
$string .= "\033[4m";
}
- $string .= $text . "\033[0m";
-
- return $string;
+ return $string . ($text . "\033[0m");
}
//--------------------------------------------------------------------
@@ -702,24 +700,17 @@ public static function wrap(string $string = null, int $max = 0, int $pad_left =
*/
protected static function parseCommandLine()
{
- $optionsFound = false;
-
// start picking segments off from #1, ignoring the invoking program
for ($i = 1; $i < $_SERVER['argc']; $i ++)
{
// If there's no '-' at the beginning of the argument
// then add it to our segments.
- if (! $optionsFound && mb_strpos($_SERVER['argv'][$i], '-') === false)
+ if (mb_strpos($_SERVER['argv'][$i], '-') === false)
{
static::$segments[] = $_SERVER['argv'][$i];
continue;
}
- // We set $optionsFound here so that we know to
- // skip the next argument since it's likely the
- // value belonging to this option.
- $optionsFound = true;
-
$arg = str_replace('-', '', $_SERVER['argv'][$i]);
$value = null;
@@ -731,10 +722,6 @@ protected static function parseCommandLine()
}
static::$options[$arg] = $value;
-
- // Reset $optionsFound so it can collect segments
- // past any options.
- $optionsFound = false;
}
}
diff --git a/system/Cache/Handlers/FileHandler.php b/system/Cache/Handlers/FileHandler.php
index 737db09e3dbc..86e70903e622 100644
--- a/system/Cache/Handlers/FileHandler.php
+++ b/system/Cache/Handlers/FileHandler.php
@@ -154,7 +154,7 @@ public function delete(string $key)
{
$key = $this->prefix . $key;
- return is_file($this->path . $key) ? unlink($this->path . $key) : false;
+ return is_file($this->path . $key) && unlink($this->path . $key);
}
//--------------------------------------------------------------------
diff --git a/system/CodeIgniter.php b/system/CodeIgniter.php
index 639fee96d24d..862902e6c3d3 100644
--- a/system/CodeIgniter.php
+++ b/system/CodeIgniter.php
@@ -749,9 +749,7 @@ public function displayPerformanceMetrics(string $output): string
{
$this->totalTime = $this->benchmark->getElapsedTime('total_execution');
- $output = str_replace('{elapsed_time}', $this->totalTime, $output);
-
- return $output;
+ return str_replace('{elapsed_time}', $this->totalTime, $output);
}
//--------------------------------------------------------------------
diff --git a/system/Commands/ListCommands.php b/system/Commands/ListCommands.php
index bae8e73dfff3..c20fe3220035 100644
--- a/system/Commands/ListCommands.php
+++ b/system/Commands/ListCommands.php
@@ -188,9 +188,8 @@ protected function padTitle(string $item, int $max, int $extra = 2, int $indent
$max += $extra + $indent;
$item = str_repeat(' ', $indent) . $item;
- $item = str_pad($item, $max);
- return $item;
+ return str_pad($item, $max);
}
//--------------------------------------------------------------------
diff --git a/system/Common.php b/system/Common.php
index ef9d85a49869..43bea7be0ad9 100644
--- a/system/Common.php
+++ b/system/Common.php
@@ -319,7 +319,7 @@ function esc($data, string $context = 'html', string $encoding = null)
{
if (is_array($data))
{
- foreach ($data as $key => &$value)
+ foreach ($data as &$value)
{
$value = esc($value, $context);
}
diff --git a/system/Config/BaseConfig.php b/system/Config/BaseConfig.php
index 9a0100f10028..ceec8baa49b6 100644
--- a/system/Config/BaseConfig.php
+++ b/system/Config/BaseConfig.php
@@ -164,16 +164,12 @@ protected function getEnvValue(string $property, string $prefix, string $shortPr
{
case array_key_exists("{$shortPrefix}.{$property}", $_ENV):
return $_ENV["{$shortPrefix}.{$property}"];
- break;
case array_key_exists("{$shortPrefix}.{$property}", $_SERVER):
return $_SERVER["{$shortPrefix}.{$property}"];
- break;
case array_key_exists("{$prefix}.{$property}", $_ENV):
return $_ENV["{$prefix}.{$property}"];
- break;
case array_key_exists("{$prefix}.{$property}", $_SERVER):
return $_SERVER["{$prefix}.{$property}"];
- break;
default:
$value = getenv($property);
return $value === false ? null : $value;
diff --git a/system/Config/DotEnv.php b/system/Config/DotEnv.php
index 541334a46496..4220d77f27be 100644
--- a/system/Config/DotEnv.php
+++ b/system/Config/DotEnv.php
@@ -128,7 +128,7 @@ public function parse(): ?array
if (strpos($line, '=') !== false)
{
list($name, $value) = $this->normaliseVariable($line);
- $vars[$name] = $value;
+ $vars[$name] = $value;
}
}
@@ -314,10 +314,8 @@ protected function getVariable(string $name)
{
case array_key_exists($name, $_ENV):
return $_ENV[$name];
- break;
case array_key_exists($name, $_SERVER):
return $_SERVER[$name];
- break;
default:
$value = getenv($name);
diff --git a/system/Config/Services.php b/system/Config/Services.php
index 6f166a64d61c..0161ca5e88a8 100644
--- a/system/Config/Services.php
+++ b/system/Config/Services.php
@@ -207,8 +207,7 @@ public static function email($config = null, bool $getShared = true)
{
$config = new \Config\Email();
}
- $email = new \CodeIgniter\Email\Email($config);
- return $email;
+ return new \CodeIgniter\Email\Email($config);
}
/**
@@ -232,8 +231,7 @@ public static function encrypter($config = null, $getShared = false)
}
$encryption = new Encryption($config);
- $encrypter = $encryption->initialize($config);
- return $encrypter;
+ return $encryption->initialize($config);
}
//--------------------------------------------------------------------
@@ -542,7 +540,7 @@ public static function parser(string $viewPath = null, $config = null, bool $get
$viewPath = $paths->viewDirectory;
}
- return new Parser($config, $viewPath, static::locator(true), CI_DEBUG, static::logger(true));
+ return new Parser($config, $viewPath, static::locator(), CI_DEBUG, static::logger());
}
//--------------------------------------------------------------------
@@ -577,7 +575,7 @@ public static function renderer(string $viewPath = null, $config = null, bool $g
$viewPath = $paths->viewDirectory;
}
- return new \CodeIgniter\View\View($config, $viewPath, static::locator(true), CI_DEBUG, static::logger(true));
+ return new \CodeIgniter\View\View($config, $viewPath, static::locator(), CI_DEBUG, static::logger());
}
//--------------------------------------------------------------------
@@ -705,7 +703,7 @@ public static function router(RouteCollectionInterface $routes = null, Request $
if (empty($routes))
{
- $routes = static::routes(true);
+ $routes = static::routes();
}
return new Router($routes, $request);
@@ -759,7 +757,7 @@ public static function session(App $config = null, bool $getShared = true)
$config = config(App::class);
}
- $logger = static::logger(true);
+ $logger = static::logger();
$driverName = $config->sessionDriver;
$driver = new $driverName($config, static::request()->getIpAddress());
diff --git a/system/Controller.php b/system/Controller.php
index 4dff9f4d1fcd..72ed399c826d 100644
--- a/system/Controller.php
+++ b/system/Controller.php
@@ -213,12 +213,10 @@ protected function validate($rules, array $messages = []): bool
$rules = $validation->$rules;
}
- $success = $this->validator
+ return $this->validator
->withRequest($this->request)
->setRules($rules, $messages)
->run();
-
- return $success;
}
//--------------------------------------------------------------------
diff --git a/system/Database/BaseBuilder.php b/system/Database/BaseBuilder.php
index 271a2d883e91..1237aa0135b1 100644
--- a/system/Database/BaseBuilder.php
+++ b/system/Database/BaseBuilder.php
@@ -396,7 +396,7 @@ public function select($select = '*', bool $escape = null)
*/
public function selectMax(string $select = '', string $alias = '')
{
- return $this->maxMinAvgSum($select, $alias, 'MAX');
+ return $this->maxMinAvgSum($select, $alias);
}
//--------------------------------------------------------------------
@@ -981,12 +981,12 @@ public function orHavingNotIn(string $key = null, $values = null, bool $escape =
* @used-by whereNotIn()
* @used-by orWhereNotIn()
*
- * @param string $key The field to search
- * @param array|Closure $values The values searched on, or anonymous function with subquery
- * @param boolean $not If the statement would be IN or NOT IN
- * @param string $type
- * @param boolean $escape
- * @param string $clause (Internal use only)
+ * @param string $key The field to search
+ * @param array|Closure $values The values searched on, or anonymous function with subquery
+ * @param boolean $not If the statement would be IN or NOT IN
+ * @param string $type
+ * @param boolean $escape
+ * @param string $clause (Internal use only)
* @throws InvalidArgumentException
*
* @return BaseBuilder
@@ -998,8 +998,8 @@ protected function _whereIn(string $key = null, $values = null, bool $not = fals
if (CI_DEBUG)
{
throw new InvalidArgumentException(sprintf('%s() expects $key to be a non-empty string', debug_backtrace(0, 2)[1]['function']));
- }
-
+ }
+
return $this;
}
@@ -1009,7 +1009,7 @@ protected function _whereIn(string $key = null, $values = null, bool $not = fals
{
throw new InvalidArgumentException(sprintf('%s() expects $values to be of type array or closure', debug_backtrace(0, 2)[1]['function']));
}
-
+
return $this;
}
@@ -1325,7 +1325,7 @@ protected function _like_statement(string $prefix = null, string $column, string
*/
public function groupStart()
{
- return $this->groupStartPrepare('', 'AND ', 'QBWhere');
+ return $this->groupStartPrepare();
}
//--------------------------------------------------------------------
@@ -1337,7 +1337,7 @@ public function groupStart()
*/
public function orGroupStart()
{
- return $this->groupStartPrepare('', 'OR ', 'QBWhere');
+ return $this->groupStartPrepare('', 'OR ');
}
//--------------------------------------------------------------------
@@ -1349,7 +1349,7 @@ public function orGroupStart()
*/
public function notGroupStart()
{
- return $this->groupStartPrepare('NOT ', 'AND ', 'QBWhere');
+ return $this->groupStartPrepare('NOT ');
}
//--------------------------------------------------------------------
@@ -1361,7 +1361,7 @@ public function notGroupStart()
*/
public function orNotGroupStart()
{
- return $this->groupStartPrepare('NOT ', 'OR ', 'QBWhere');
+ return $this->groupStartPrepare('NOT ', 'OR ');
}
//--------------------------------------------------------------------
@@ -1373,7 +1373,7 @@ public function orNotGroupStart()
*/
public function groupEnd()
{
- return $this->groupEndPrepare('QBWhere');
+ return $this->groupEndPrepare();
}
// --------------------------------------------------------------------
@@ -2597,7 +2597,7 @@ protected function _updateBatch(string $table, array $values, string $index): st
$ids = [];
$final = [];
- foreach ($values as $key => $val)
+ foreach ($values as $val)
{
$ids[] = $val[$index];
@@ -2646,7 +2646,7 @@ public function setUpdateBatch($key, string $index = '', bool $escape = null)
is_bool($escape) || $escape = $this->db->protectIdentifiers;
- foreach ($key as $k => $v)
+ foreach ($key as $v)
{
$index_set = false;
$clean = [];
@@ -3426,7 +3426,7 @@ protected function setBind(string $key, $value = null, bool $escape = true): str
return $key;
}
- if (!array_key_exists($key, $this->bindsKeyCount))
+ if (! array_key_exists($key, $this->bindsKeyCount))
{
$this->bindsKeyCount[$key] = 0;
}
diff --git a/system/Database/BaseConnection.php b/system/Database/BaseConnection.php
index de9d510b088b..7c434f66a4cd 100644
--- a/system/Database/BaseConnection.php
+++ b/system/Database/BaseConnection.php
@@ -1002,7 +1002,7 @@ public function prepare(\Closure $func, array $options = [])
$this->initialize();
}
- $this->pretend(true);
+ $this->pretend();
$sql = $func($this);
@@ -1381,9 +1381,7 @@ public function escape($str)
{
if (is_array($str))
{
- $str = array_map([&$this, 'escape'], $str);
-
- return $str;
+ return array_map([&$this, 'escape'], $str);
}
else if (is_string($str) || ( is_object($str) && method_exists($str, '__toString')))
{
diff --git a/system/Database/BaseResult.php b/system/Database/BaseResult.php
index 787f0ff48423..5e6abe357863 100644
--- a/system/Database/BaseResult.php
+++ b/system/Database/BaseResult.php
@@ -189,7 +189,7 @@ public function getCustomResultObject(string $className)
return $this->customResultObject[$className];
}
- is_null($this->rowData) || $this->dataSeek(0);
+ is_null($this->rowData) || $this->dataSeek();
$this->customResultObject[$className] = [];
while ($row = $this->fetchObject($className))
@@ -239,7 +239,7 @@ public function getResultArray(): array
return $this->resultArray;
}
- is_null($this->rowData) || $this->dataSeek(0);
+ is_null($this->rowData) || $this->dataSeek();
while ($row = $this->fetchAssoc())
{
$this->resultArray[] = $row;
@@ -282,7 +282,7 @@ public function getResultObject(): array
return $this->resultObject;
}
- is_null($this->rowData) || $this->dataSeek(0);
+ is_null($this->rowData) || $this->dataSeek();
while ($row = $this->fetchObject())
{
if (! is_subclass_of($row, Entity::class) && method_exists($row, 'syncOriginal'))
@@ -314,7 +314,7 @@ public function getRow($n = 0, string $type = 'object')
if (! is_numeric($n))
{
// We cache the row data for subsequent uses
- is_array($this->rowData) || $this->rowData = $this->getRowArray(0);
+ is_array($this->rowData) || $this->rowData = $this->getRowArray();
// array_key_exists() instead of isset() to allow for NULL values
if (empty($this->rowData) || ! array_key_exists($n, $this->rowData))
@@ -435,7 +435,7 @@ public function setRow($key, $value = null)
// We cache the row data for subsequent uses
if (! is_array($this->rowData))
{
- $this->rowData = $this->getRowArray(0);
+ $this->rowData = $this->getRowArray();
}
if (is_array($key))
diff --git a/system/Database/Database.php b/system/Database/Database.php
index a8d26b10032c..adb0063cd5f5 100644
--- a/system/Database/Database.php
+++ b/system/Database/Database.php
@@ -109,9 +109,7 @@ public function loadForge(ConnectionInterface $db)
$db->initialize();
}
- $class = new $className($db);
-
- return $class;
+ return new $className($db);
}
//--------------------------------------------------------------------
@@ -133,9 +131,7 @@ public function loadUtils(ConnectionInterface $db)
$db->initialize();
}
- $class = new $className($db);
-
- return $class;
+ return new $className($db);
}
//--------------------------------------------------------------------
diff --git a/system/Database/Forge.php b/system/Database/Forge.php
index b40dc5ebf930..e38d505cfea9 100644
--- a/system/Database/Forge.php
+++ b/system/Database/Forge.php
@@ -110,14 +110,14 @@ class Forge
*
* @var string
*/
- protected $createDatabaseIfStr = null;
+ protected $createDatabaseIfStr;
/**
* CHECK DATABASE EXIST statement
*
* @var string
*/
- protected $checkDatabaseExistStr = null;
+ protected $checkDatabaseExistStr;
/**
* DROP DATABASE statement
@@ -717,9 +717,7 @@ protected function _dropTable(string $table, bool $if_exists, bool $cascade): st
}
}
- $sql = $sql . ' ' . $this->db->escapeIdentifiers($table);
-
- return $sql;
+ return $sql . ' ' . $this->db->escapeIdentifiers($table);
}
//--------------------------------------------------------------------
diff --git a/system/Database/ModelFactory.php b/system/Database/ModelFactory.php
index 6b7d514e8cc2..b2b43620ea0d 100644
--- a/system/Database/ModelFactory.php
+++ b/system/Database/ModelFactory.php
@@ -12,14 +12,6 @@ class ModelFactory
*/
static private $instances = [];
- /**
- * The Database connection to use,
- * if other than default.
- *
- * @var ConnectionInterface
- */
- static private $connection = null;
-
/**
* Create new configuration instances or return
* a shared instance
diff --git a/system/Database/MySQLi/Connection.php b/system/Database/MySQLi/Connection.php
index 26b213ce9a20..6067d3029b95 100644
--- a/system/Database/MySQLi/Connection.php
+++ b/system/Database/MySQLi/Connection.php
@@ -424,8 +424,6 @@ public function escapeLikeStringDirect($str)
'\\' . '_',
], $str
);
-
- return $str;
}
//--------------------------------------------------------------------
diff --git a/system/Database/MySQLi/PreparedQuery.php b/system/Database/MySQLi/PreparedQuery.php
index 35d87b127a36..dbb1378b6b94 100644
--- a/system/Database/MySQLi/PreparedQuery.php
+++ b/system/Database/MySQLi/PreparedQuery.php
@@ -116,9 +116,7 @@ public function _execute(array $data): bool
// Bind it
$this->statement->bind_param($bindTypes, ...$data);
- $success = $this->statement->execute();
-
- return $success;
+ return $this->statement->execute();
}
//--------------------------------------------------------------------
diff --git a/system/Database/Postgre/Builder.php b/system/Database/Postgre/Builder.php
index bf20a3d129fa..92cfd329a877 100644
--- a/system/Database/Postgre/Builder.php
+++ b/system/Database/Postgre/Builder.php
@@ -316,7 +316,7 @@ protected function _update(string $table, array $values): string
protected function _updateBatch(string $table, array $values, string $index): string
{
$ids = [];
- foreach ($values as $key => $val)
+ foreach ($values as $val)
{
$ids[] = $val[$index];
diff --git a/system/Database/Postgre/PreparedQuery.php b/system/Database/Postgre/PreparedQuery.php
index 7b3bff3390f1..f48b5f993dea 100644
--- a/system/Database/Postgre/PreparedQuery.php
+++ b/system/Database/Postgre/PreparedQuery.php
@@ -148,12 +148,10 @@ public function parameterize(string $sql): string
// Track our current value
$count = 0;
- $sql = preg_replace_callback('/\?/', function ($matches) use (&$count) {
+ return preg_replace_callback('/\?/', function ($matches) use (&$count) {
$count ++;
return "\${$count}";
}, $sql);
-
- return $sql;
}
//--------------------------------------------------------------------
diff --git a/system/Database/Query.php b/system/Database/Query.php
index 301185b425c7..650a7da93193 100644
--- a/system/Database/Query.php
+++ b/system/Database/Query.php
@@ -440,9 +440,7 @@ protected function matchNamedBinds(string $sql, array $binds): string
$replacers[":{$placeholder}:"] = $escapedValue;
}
- $sql = strtr($sql, $replacers);
-
- return $sql;
+ return strtr($sql, $replacers);
}
//--------------------------------------------------------------------
diff --git a/system/Database/SQLite3/Connection.php b/system/Database/SQLite3/Connection.php
index ae83cfc1c03f..f9ddfa1020f8 100644
--- a/system/Database/SQLite3/Connection.php
+++ b/system/Database/SQLite3/Connection.php
@@ -323,8 +323,8 @@ public function _fieldData(string $table): array
$retVal[$i]->type = $query[$i]->type;
$retVal[$i]->max_length = null;
$retVal[$i]->default = $query[$i]->dflt_value;
- $retVal[$i]->primary_key = isset($query[$i]->pk) ? (bool)$query[$i]->pk : false;
- $retVal[$i]->nullable = isset($query[$i]->notnull) ? ! (bool)$query[$i]->notnull : false;
+ $retVal[$i]->primary_key = isset($query[$i]->pk) && (bool)$query[$i]->pk;
+ $retVal[$i]->nullable = isset($query[$i]->notnull) && ! (bool)$query[$i]->notnull;
}
return $retVal;
diff --git a/system/Database/SQLite3/Forge.php b/system/Database/SQLite3/Forge.php
index 338c6e4ec3d6..bb6f48262a18 100644
--- a/system/Database/SQLite3/Forge.php
+++ b/system/Database/SQLite3/Forge.php
@@ -167,7 +167,6 @@ protected function _alterTable(string $alter_type, string $table, $field)
->run();
return '';
- break;
case 'CHANGE':
$sqlTable = new Table($this->db, $this);
@@ -176,7 +175,6 @@ protected function _alterTable(string $alter_type, string $table, $field)
->run();
return null;
- break;
default:
return parent::_alterTable($alter_type, $table, $field);
}
diff --git a/system/Debug/Exceptions.php b/system/Debug/Exceptions.php
index 7cc3043b2396..dac978cb6f33 100644
--- a/system/Debug/Exceptions.php
+++ b/system/Debug/Exceptions.php
@@ -186,11 +186,10 @@ public function exceptionHandler(Throwable $exception)
* @param string $message
* @param string|null $file
* @param integer|null $line
- * @param null $context
*
* @throws \ErrorException
*/
- public function errorHandler(int $severity, string $message, string $file = null, int $line = null, $context = null)
+ public function errorHandler(int $severity, string $message, string $file = null, int $line = null)
{
if (! (error_reporting() & $severity))
{
diff --git a/system/Debug/Toolbar.php b/system/Debug/Toolbar.php
index b601fbfea3df..ff2be35cb617 100644
--- a/system/Debug/Toolbar.php
+++ b/system/Debug/Toolbar.php
@@ -118,7 +118,7 @@ public function run(float $startTime, float $totalTime, RequestInterface $reques
$data['startTime'] = $startTime;
$data['totalTime'] = $totalTime * 1000;
$data['totalMemory'] = number_format((memory_get_peak_usage()) / 1024 / 1024, 3);
- $data['segmentDuration'] = $this->roundTo($data['totalTime'] / 7, 5);
+ $data['segmentDuration'] = $this->roundTo($data['totalTime'] / 7);
$data['segmentCount'] = (int) ceil($data['totalTime'] / $data['segmentDuration']);
$data['CI_VERSION'] = \CodeIgniter\CodeIgniter::CI_VERSION;
$data['collectors'] = [];
@@ -167,7 +167,7 @@ public function run(float $startTime, float $totalTime, RequestInterface $reques
$data['vars']['post'][esc($name)] = is_array($value) ? '' . esc(print_r($value, true)) . '
' : esc($value);
}
- foreach ($request->getHeaders() as $header => $value)
+ foreach ($request->getHeaders() as $value)
{
if (empty($value))
{
diff --git a/system/Debug/Toolbar/Collectors/Events.php b/system/Debug/Toolbar/Collectors/Events.php
index 285d87d8e709..4681fc17a1a8 100644
--- a/system/Debug/Toolbar/Collectors/Events.php
+++ b/system/Debug/Toolbar/Collectors/Events.php
@@ -111,7 +111,7 @@ protected function formatTimelineData(): array
$rows = $this->viewer->getPerformanceData();
- foreach ($rows as $name => $info)
+ foreach ($rows as $info)
{
$data[] = [
'name' => 'View: ' . $info['view'],
diff --git a/system/Debug/Toolbar/Collectors/Views.php b/system/Debug/Toolbar/Collectors/Views.php
index 8bcec5698340..1e8a308a36d2 100644
--- a/system/Debug/Toolbar/Collectors/Views.php
+++ b/system/Debug/Toolbar/Collectors/Views.php
@@ -126,7 +126,7 @@ protected function formatTimelineData(): array
$rows = $this->viewer->getPerformanceData();
- foreach ($rows as $name => $info)
+ foreach ($rows as $info)
{
$data[] = [
'name' => 'View: ' . $info['view'],
diff --git a/system/Encryption/Handlers/OpenSSLHandler.php b/system/Encryption/Handlers/OpenSSLHandler.php
index aa9480857258..50622d1f0d9f 100644
--- a/system/Encryption/Handlers/OpenSSLHandler.php
+++ b/system/Encryption/Handlers/OpenSSLHandler.php
@@ -114,9 +114,8 @@ public function encrypt($data, $params = null)
$result = $iv . $data;
$hmacKey = \hash_hmac($this->digest, $result, $secret, true);
- $result = $hmacKey . $result;
- return $result;
+ return $hmacKey . $result;
}
// --------------------------------------------------------------------
diff --git a/system/Entity.php b/system/Entity.php
index 8cb01dd8d87e..c8135a850655 100644
--- a/system/Entity.php
+++ b/system/Entity.php
@@ -570,17 +570,15 @@ protected function castAs($value, string $type)
$value = (array)$value;
break;
case 'json':
- $value = $this->castAsJson($value, false);
+ $value = $this->castAsJson($value);
break;
case 'json-array':
$value = $this->castAsJson($value, true);
break;
case 'datetime':
return $this->mutateDate($value);
- break;
case 'timestamp':
return strtotime($value);
- break;
}
return $value;
diff --git a/system/Exceptions/CastException.php b/system/Exceptions/CastException.php
index a5bb06594e2e..47d91de82d7f 100644
--- a/system/Exceptions/CastException.php
+++ b/system/Exceptions/CastException.php
@@ -20,19 +20,14 @@ public static function forInvalidJsonFormatException(int $error)
{
case JSON_ERROR_DEPTH:
throw new static(lang('Cast.jsonErrorDepth'));
- break;
case JSON_ERROR_STATE_MISMATCH:
throw new static(lang('Cast.jsonErrorStateMismatch'));
- break;
case JSON_ERROR_CTRL_CHAR:
throw new static(lang('Cast.jsonErrorCtrlChar'));
- break;
case JSON_ERROR_SYNTAX:
throw new static(lang('Cast.jsonErrorSyntax'));
- break;
case JSON_ERROR_UTF8:
throw new static(lang('Cast.jsonErrorUtf8'));
- break;
default:
throw new static(lang('Cast.jsonErrorUnknown'));
}
diff --git a/system/HTTP/CURLRequest.php b/system/HTTP/CURLRequest.php
index c5506accbfeb..d1a8e94428d1 100644
--- a/system/HTTP/CURLRequest.php
+++ b/system/HTTP/CURLRequest.php
@@ -536,9 +536,7 @@ protected function applyMethod(string $method, array $curl_options): array
// Have content?
if ($size === null || $size > 0)
{
- $curl_options = $this->applyBody($curl_options);
-
- return $curl_options;
+ return $this->applyBody($curl_options);
}
if ($method === 'PUT' || $method === 'POST')
diff --git a/system/HTTP/ContentSecurityPolicy.php b/system/HTTP/ContentSecurityPolicy.php
index 713312f9e5bf..910f700287cb 100644
--- a/system/HTTP/ContentSecurityPolicy.php
+++ b/system/HTTP/ContentSecurityPolicy.php
@@ -136,7 +136,7 @@ class ContentSecurityPolicy
*
* @var string
*/
- protected $reportURI = null;
+ protected $reportURI;
/**
* Used for security enforcement
diff --git a/system/HTTP/UserAgent.php b/system/HTTP/UserAgent.php
index 6e5b5965a8a7..c6873fd5b45b 100644
--- a/system/HTTP/UserAgent.php
+++ b/system/HTTP/UserAgent.php
@@ -51,7 +51,7 @@ class UserAgent
*
* @var string
*/
- protected $agent = null;
+ protected $agent;
/**
* Flag for if the user-agent belongs to a browser
diff --git a/system/Helpers/array_helper.php b/system/Helpers/array_helper.php
index 71d3aceeadc1..c114df9fa97c 100644
--- a/system/Helpers/array_helper.php
+++ b/system/Helpers/array_helper.php
@@ -90,7 +90,7 @@ function _array_search_dot(array $indexes, array $array)
// If $array has more than 1 item, we have to loop over each.
if (is_array($array))
{
- foreach ($array as $key => $value)
+ foreach ($array as $value)
{
$answer = _array_search_dot($indexes, $value);
diff --git a/system/Helpers/cookie_helper.php b/system/Helpers/cookie_helper.php
index d85f644d0994..50ab39272a2d 100755
--- a/system/Helpers/cookie_helper.php
+++ b/system/Helpers/cookie_helper.php
@@ -96,9 +96,8 @@ function get_cookie($index, bool $xssClean = false)
$request = \Config\Services::request();
$filter = true === $xssClean ? FILTER_SANITIZE_STRING : null;
- $cookie = $request->getCookie($prefix . $index, $filter);
- return $cookie;
+ return $request->getCookie($prefix . $index, $filter);
}
}
diff --git a/system/Helpers/date_helper.php b/system/Helpers/date_helper.php
index 6cf362ad49b5..1951d2535350 100644
--- a/system/Helpers/date_helper.php
+++ b/system/Helpers/date_helper.php
@@ -96,8 +96,7 @@ function timezone_select(string $class = '', string $default = '', int $what = \
$selected = ($timezone === $default) ? 'selected' : '';
$buffer .= "" . PHP_EOL;
}
- $buffer .= '' . PHP_EOL;
- return $buffer;
+ return $buffer . ('' . PHP_EOL);
}
}
diff --git a/system/Helpers/form_helper.php b/system/Helpers/form_helper.php
index 7f39ebe03bc8..cf55d06c7698 100644
--- a/system/Helpers/form_helper.php
+++ b/system/Helpers/form_helper.php
@@ -180,7 +180,7 @@ function form_hidden($name, $value = '', bool $recursing = false): string
if (! is_array($value))
{
- $form .= '\n";
+ $form .= '\n";
}
else
{
@@ -408,7 +408,7 @@ function form_dropdown($data = '', $options = [], $selected = [], $extra = ''):
{
$sel = in_array($optgroup_key, $selected) ? ' selected="selected"' : '';
$form .= '\n";
+ . $optgroup_val . "\n";
}
$form .= "\n";
}
@@ -416,7 +416,7 @@ function form_dropdown($data = '', $options = [], $selected = [], $extra = ''):
{
$form .= '\n";
+ . $val . "\n";
}
}
@@ -645,9 +645,7 @@ function form_datalist(string $name, string $value, array $options): string
$out .= "