Skip to content

Enable blank_line_before_statement #4790

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
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
3 changes: 3 additions & 0 deletions app/Views/errors/cli/error_exception.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,13 @@
{
case is_object($value):
return 'Object(' . get_class($value) . ')';

case is_array($value):
return count($value) ? '[...]' : '[]';

case is_null($value):
return 'null'; // return the lowercased version

default:
return var_export($value, true);
}
Expand Down
1 change: 1 addition & 0 deletions app/Views/errors/html/error_exception.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
$mirror = isset($row['class']) ? new \ReflectionMethod($row['class'], $row['function']) : new \ReflectionFunction($row['function']);
$params = $mirror->getParameters();
}

foreach ($row['args'] as $key => $value) : ?>
<tr>
<td><code><?= esc(isset($params[$key]) ? '$' . $params[$key]->name : "#$key") ?></code></td>
Expand Down
1 change: 1 addition & 0 deletions spark
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ $console->showHeader($suppress);

// fire off the command in the main framework.
$response = $console->run();

if ($response->getStatusCode() >= 300)
{
exit($response->getStatusCode());
Expand Down
1 change: 1 addition & 0 deletions system/Autoloader/Autoloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ protected function discoverComposerNamespaces()
}

$newPaths = [];

foreach ($paths as $key => $value)
{
// Composer stores namespaces with trailing slash. We don't.
Expand Down
10 changes: 10 additions & 0 deletions system/BaseModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,7 @@ public function save($data): bool
$response = true;
}
}

return $response;
}

Expand Down Expand Up @@ -1228,6 +1229,7 @@ protected function doProtectFields(array $data): array
protected function setDate(?int $userData = null)
{
$currentDate = $userData ?? time();

return $this->intToDate($currentDate);
}

Expand All @@ -1254,10 +1256,13 @@ protected function intToDate(int $value)
{
case 'int':
return $value;

case 'datetime':
return date('Y-m-d H:i:s', $value);

case 'date':
return date('Y-m-d', $value);

default:
throw ModelException::forNoDateFormat(static::class);
}
Expand All @@ -1281,10 +1286,13 @@ protected function timeToDate(Time $value)
{
case 'datetime':
return $value->format('Y-m-d H:i:s');

case 'date':
return $value->format('Y-m-d');

case 'int':
return $value->getTimestamp();

default:
return (string) $value;
}
Expand Down Expand Up @@ -1599,6 +1607,7 @@ protected function objectToArray($data, bool $onlyChanged = true, bool $recursiv
{
return $this->timeToDate($value);
}

return $value;
}, $properties);
}
Expand Down Expand Up @@ -1728,6 +1737,7 @@ public function __isset(string $name): bool
{
return true;
}

return isset($this->db->$name);
}

Expand Down
5 changes: 5 additions & 0 deletions system/CLI/CLI.php
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,7 @@ public static function wait(int $seconds, bool $countdown = false)
if ($countdown === true)
{
$time = $seconds;

while ($time > 0)
{
static::fwrite(STDOUT, $time . '... ');
Expand Down Expand Up @@ -1087,6 +1088,7 @@ public static function table(array $tbody, array $thead = [])
for ($row = 0; $row < $totalRows; $row ++)
{
$column = 0; // Current column index

foreach ($tableRows[$row] as $col)
{
// Sets the size of this column in the current row
Expand All @@ -1110,6 +1112,7 @@ public static function table(array $tbody, array $thead = [])
for ($row = 0; $row < $totalRows; $row ++)
{
$column = 0;

foreach ($tableRows[$row] as $col)
{
$diff = $maxColsLengths[$column] - static::strlen($col);
Expand All @@ -1130,6 +1133,7 @@ public static function table(array $tbody, array $thead = [])
if ($row === 0)
{
$cols = '+';

foreach ($tableRows[$row] as $col)
{
$cols .= str_repeat('-', static::strlen($col) + 2) . '+';
Expand Down Expand Up @@ -1171,6 +1175,7 @@ protected static function fwrite($handle, string $string)
{
// @codeCoverageIgnoreStart
echo $string;

return;
// @codeCoverageIgnoreEnd
}
Expand Down
7 changes: 7 additions & 0 deletions system/Cache/Handlers/FileHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -519,24 +519,31 @@ protected function getFileInfo(string $file, $returnedValues = ['name', 'server_
case 'name':
$fileInfo['name'] = basename($file);
break;

case 'server_path':
$fileInfo['server_path'] = $file;
break;

case 'size':
$fileInfo['size'] = filesize($file);
break;

case 'date':
$fileInfo['date'] = filemtime($file);
break;

case 'readable':
$fileInfo['readable'] = is_readable($file);
break;

case 'writable':
$fileInfo['writable'] = is_writable($file);
break;

case 'executable':
$fileInfo['executable'] = is_executable($file);
break;

case 'fileperms':
$fileInfo['fileperms'] = fileperms($file);
break;
Expand Down
4 changes: 4 additions & 0 deletions system/Cache/Handlers/PredisHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,14 @@ public function get(string $key)
case 'array':
case 'object':
return unserialize($data['__ci_value']);

case 'boolean':
case 'integer':
case 'double': // Yes, 'double' is returned and NOT 'float'
case 'string':
case 'NULL':
return settype($data['__ci_value'], $data['__ci_type']) ? $data['__ci_value'] : null;

case 'resource':
default:
return null;
Expand Down Expand Up @@ -146,12 +148,14 @@ public function save(string $key, $value, int $ttl = 60)
case 'object':
$value = serialize($value);
break;

case 'boolean':
case 'integer':
case 'double': // Yes, 'double' is returned and NOT 'float'
case 'string':
case 'NULL':
break;

case 'resource':
default:
return false;
Expand Down
7 changes: 7 additions & 0 deletions system/Cache/Handlers/RedisHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,18 +93,21 @@ public function initialize()
{
// Note:: I'm unsure if log_message() is necessary, however I'm not 100% comfortable removing it.
log_message('error', 'Cache: Redis connection failed. Check your configuration.');

throw new CriticalError('Cache: Redis connection failed. Check your configuration.');
}

if (isset($config['password']) && ! $this->redis->auth($config['password']))
{
log_message('error', 'Cache: Redis authentication failed.');

throw new CriticalError('Cache: Redis authentication failed.');
}

if (isset($config['database']) && ! $this->redis->select($config['database']))
{
log_message('error', 'Cache: Redis select database failed.');

throw new CriticalError('Cache: Redis select database failed.');
}
}
Expand Down Expand Up @@ -140,12 +143,14 @@ public function get(string $key)
case 'array':
case 'object':
return unserialize($data['__ci_value']);

case 'boolean':
case 'integer':
case 'double': // Yes, 'double' is returned and NOT 'float'
case 'string':
case 'NULL':
return settype($data['__ci_value'], $data['__ci_type']) ? $data['__ci_value'] : null;

case 'resource':
default:
return null;
Expand Down Expand Up @@ -173,12 +178,14 @@ public function save(string $key, $value, int $ttl = 60)
case 'object':
$value = serialize($value);
break;

case 'boolean':
case 'integer':
case 'double': // Yes, 'double' is returned and NOT 'float'
case 'string':
case 'NULL':
break;

case 'resource':
default:
return false;
Expand Down
6 changes: 6 additions & 0 deletions system/CodeIgniter.php
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ public function run(RouteCollectionInterface $routes = null, bool $returnRespons

$this->response->pretend($this->useSafeOutput)->send();
$this->callExit(EXIT_SUCCESS);

return;
}

Expand All @@ -346,6 +347,7 @@ public function run(RouteCollectionInterface $routes = null, bool $returnRespons
$this->sendResponse();

$this->callExit(EXIT_SUCCESS);

return;
}
catch (PageNotFoundException $e)
Expand Down Expand Up @@ -526,6 +528,7 @@ protected function bootstrapEnvironment()
// @codeCoverageIgnoreStart
header('HTTP/1.1 503 Service Unavailable.', true, 503);
echo 'The application environment is not set correctly.';

exit(EXIT_ERROR); // EXIT_ERROR
// @codeCoverageIgnoreEnd
}
Expand Down Expand Up @@ -707,6 +710,7 @@ public static function cache(int $time)
public function cachePage(Cache $config)
{
$headers = [];

foreach ($this->response->headers() as $header)
{
$headers[$header->getName()] = $header->getValueLine();
Expand Down Expand Up @@ -872,6 +876,7 @@ protected function startController()
if (is_object($this->controller) && (get_class($this->controller) === 'Closure'))
{
$controller = $this->controller;

return $controller(...$this->router->params());
}

Expand Down Expand Up @@ -1014,6 +1019,7 @@ protected function gatherOutput(Cache $cacheConfig = null, $returned = null)
if ($returned instanceof DownloadResponse)
{
$this->response = $returned;

return;
}
// If the controller returned a response object,
Expand Down
2 changes: 2 additions & 0 deletions system/Commands/Database/CreateDatabase.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ public function run(array $params)
// @codeCoverageIgnoreStart
CLI::error('Database creation failed.', 'light_gray', 'red');
CLI::newLine();

return;
// @codeCoverageIgnoreEnd
}
Expand All @@ -151,6 +152,7 @@ public function run(array $params)
// @codeCoverageIgnoreStart
CLI::error('Database creation failed.', 'light_gray', 'red');
CLI::newLine();

return;
// @codeCoverageIgnoreEnd
}
Expand Down
3 changes: 3 additions & 0 deletions system/Commands/Encryption/GenerateKey.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,15 @@ public function run(array $params)
{
CLI::write($encodedKey, 'yellow');
CLI::newLine();

return;
}

if (! $this->setNewEncryptionKey($encodedKey, $params))
{
CLI::write('Error in setting new encryption key to .env file.', 'light_gray', 'red');
CLI::newLine();

return;
}

Expand Down Expand Up @@ -189,6 +191,7 @@ protected function writeNewEncryptionKeyToFile(string $oldKey, string $newKey):
CLI::write('Both default shipped `env` file and custom `.env` are missing.', 'yellow');
CLI::write('Here\'s your new key instead: ' . CLI::color($newKey, 'yellow'));
CLI::newLine();

return false;
}

Expand Down
1 change: 1 addition & 0 deletions system/Commands/Housekeeping/ClearDebugbar.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public function run(array $params)
// @codeCoverageIgnoreStart
CLI::error('Error deleting the debugbar JSON files.');
CLI::newLine();

return;
// @codeCoverageIgnoreEnd
}
Expand Down
2 changes: 2 additions & 0 deletions system/Commands/Housekeeping/ClearLogs.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public function run(array $params)
CLI::error('Deleting logs aborted.', 'light_gray', 'red');
CLI::error('If you want, use the "-force" option to force delete all log files.', 'light_gray', 'red');
CLI::newLine();

return;
// @codeCoverageIgnoreEnd
}
Expand All @@ -83,6 +84,7 @@ public function run(array $params)
// @codeCoverageIgnoreStart
CLI::error('Error in deleting the logs files.', 'light_gray', 'red');
CLI::newLine();

return;
// @codeCoverageIgnoreEnd
}
Expand Down
1 change: 1 addition & 0 deletions system/Commands/ListCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ protected function listFull(array $commands)
foreach ($groups as $group => $commands)
{
CLI::write($group, 'yellow');

foreach ($commands as $name => $command)
{
$name = $this->setPad($name, $length, 2, 2);
Expand Down
1 change: 1 addition & 0 deletions system/Commands/Utilities/Namespaces.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ public function run(array $params)
$config = new Autoload();

$tbody = [];

foreach ($config->psr4 as $ns => $path)
{
$path = realpath($path) ?: $path;
Expand Down
1 change: 1 addition & 0 deletions system/Commands/Utilities/Routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ public function run(array $params)
];

$tbody = [];

foreach ($methods as $method)
{
$routes = $collection->getRoutes($method);
Expand Down
Loading