Skip to content

Commit

Permalink
Release v4.4.4
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Dec 28, 2023
1 parent a033985 commit 7c170c4
Show file tree
Hide file tree
Showing 202 changed files with 1,320 additions and 1,001 deletions.
3 changes: 1 addition & 2 deletions app/Config/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ class App extends BaseConfig
* 'http://accounts.example.com/':
* ['media.example.com', 'accounts.example.com']
*
* @var string[]
* @phpstan-var list<string>
* @var list<string>
*/
public array $allowedHostnames = [];

Expand Down
9 changes: 3 additions & 6 deletions app/Config/Autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ class Autoload extends AutoloadConfig
* 'App' => APPPATH
* ];
*
* @var array<string, array<int, string>|string>
* @phpstan-var array<string, string|list<string>>
* @var array<string, list<string>|string>
*/
public $psr4 = [
APP_NAMESPACE => APPPATH, // For custom app namespace
Expand Down Expand Up @@ -81,8 +80,7 @@ class Autoload extends AutoloadConfig
* '/path/to/my/file.php',
* ];
*
* @var string[]
* @phpstan-var list<string>
* @var list<string>
*/
public $files = [];

Expand All @@ -95,8 +93,7 @@ class Autoload extends AutoloadConfig
* 'form',
* ];
*
* @var string[]
* @phpstan-var list<string>
* @var list<string>
*/
public $helpers = [];
}
2 changes: 1 addition & 1 deletion app/Config/Boot/development.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
|
| If you set 'display_errors' to '1', CI4's detailed error report will show.
*/
error_reporting(-1);
error_reporting(E_ALL);
ini_set('display_errors', '1');

/*
Expand Down
2 changes: 1 addition & 1 deletion app/Config/Boot/testing.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
| make sure they don't make it to production. And save us hours of
| painful debugging.
*/
error_reporting(-1);
error_reporting(E_ALL);
ini_set('display_errors', '1');

/*
Expand Down
3 changes: 1 addition & 2 deletions app/Config/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,7 @@ class Cache extends BaseConfig
* This is an array of cache engine alias' and class names. Only engines
* that are listed here are allowed to be used.
*
* @var array<string, string>
* @phpstan-var array<string, class-string<CacheInterface>>
* @var array<string, class-string<CacheInterface>>
*/
public array $validHandlers = [
'dummy' => DummyHandler::class,
Expand Down
2 changes: 1 addition & 1 deletion app/Config/Email.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Email extends BaseConfig
public string $mailPath = '/usr/sbin/sendmail';

/**
* SMTP Server Address
* SMTP Server Hostname
*/
public string $SMTPHost = '';

Expand Down
8 changes: 3 additions & 5 deletions app/Config/Filters.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ class Filters extends BaseConfig
* Configures aliases for Filter classes to
* make reading things nicer and simpler.
*
* @var array<string, array<int, string>|string> [filter_name => classname]
* or [filter_name => [classname1, classname2, ...]]
* @phpstan-var array<string, class-string|list<class-string>>
* @var array<string, class-string|list<class-string>> [filter_name => classname]
* or [filter_name => [classname1, classname2, ...]]
*/
public array $aliases = [
'csrf' => CSRF::class,
Expand All @@ -31,8 +30,7 @@ class Filters extends BaseConfig
* List of filter aliases that are always
* applied before and after every request.
*
* @var array<string, array<string, array<string, string>>>|array<string, array<string>>
* @phpstan-var array<string, list<string>>|array<string, array<string, array<string, string>>>
* @var array<string, array<string, array<string, string>>>|array<string, list<string>>
*/
public array $globals = [
'before' => [
Expand Down
9 changes: 3 additions & 6 deletions app/Config/Kint.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ class Kint extends BaseConfig
*/

/**
* @var array<int, ConstructablePluginInterface|string>
* @phpstan-var list<class-string<ConstructablePluginInterface>|ConstructablePluginInterface>
* @var list<class-string<ConstructablePluginInterface>|ConstructablePluginInterface>|null
*/
public $plugins;

Expand All @@ -46,14 +45,12 @@ class Kint extends BaseConfig
public int $richSort = AbstractRenderer::SORT_FULL;

/**
* @var array<string, string>
* @phpstan-var array<string, class-string<ValuePluginInterface>>
* @var array<string, class-string<ValuePluginInterface>>|null
*/
public $richObjectPlugins;

/**
* @var array<string, string>
* @phpstan-var array<string, class-string<TabPluginInterface>>
* @var array<string, class-string<TabPluginInterface>>|null
*/
public $richTabPlugins;

Expand Down
4 changes: 2 additions & 2 deletions app/Config/Modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class Modules extends BaseModules
* ],
* ]
*
* @var array
* @var array{only?: list<string>, exclude?: list<string>}
*/
public $composerPackages = [];

Expand All @@ -72,7 +72,7 @@ class Modules extends BaseModules
*
* If it is not listed, only the base application elements will be used.
*
* @var string[]
* @var list<string>
*/
public $aliases = [
'events',
Expand Down
2 changes: 1 addition & 1 deletion app/Config/Publisher.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Publisher extends BasePublisher
* result in a PublisherException. Files that do no fit the
* pattern will cause copy/merge to fail.
*
* @var array<string,string>
* @var array<string, string>
*/
public $restrictions = [
ROOTPATH => '*',
Expand Down
2 changes: 1 addition & 1 deletion app/Config/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Session extends BaseConfig
* - `CodeIgniter\Session\Handlers\MemcachedHandler`
* - `CodeIgniter\Session\Handlers\RedisHandler`
*
* @phpstan-var class-string<BaseHandler>
* @var class-string<BaseHandler>
*/
public string $driver = FileHandler::class;

Expand Down
17 changes: 13 additions & 4 deletions app/Views/errors/cli/error_exception.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,26 @@
use CodeIgniter\CLI\CLI;

// The main Exception
CLI::newLine();
CLI::write('[' . get_class($exception) . ']', 'light_gray', 'red');
CLI::newLine();
CLI::write($message);
CLI::newLine();
CLI::write('at ' . CLI::color(clean_path($exception->getFile()) . ':' . $exception->getLine(), 'green'));
CLI::newLine();

$last = $exception;

while ($prevException = $last->getPrevious()) {
$last = $prevException;

CLI::write(' Caused by:');
CLI::write(' [' . get_class($prevException) . ']', 'red');
CLI::write(' ' . $prevException->getMessage());
CLI::write(' at ' . CLI::color(clean_path($prevException->getFile()) . ':' . $prevException->getLine(), 'green'));
CLI::newLine();
}

// The backtrace
if (defined('SHOW_DEBUG_BACKTRACE') && SHOW_DEBUG_BACKTRACE) {
$backtraces = $exception->getTrace();
$backtraces = $last->getTrace();

if ($backtraces) {
CLI::write('Backtrace:', 'green');
Expand Down
23 changes: 23 additions & 0 deletions app/Views/errors/html/error_exception.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,29 @@
<?php endif; ?>
</div>

<div class="container">
<?php
$last = $exception;

while ($prevException = $last->getPrevious()) {
$last = $prevException;
?>

<pre>
Caused by:
<?= esc(get_class($prevException)), esc($prevException->getCode() ? ' #' . $prevException->getCode() : '') ?>

<?= nl2br(esc($prevException->getMessage())) ?>
<a href="https://www.duckduckgo.com/?q=<?= urlencode(get_class($prevException) . ' ' . preg_replace('#\'.*\'|".*"#Us', '', $prevException->getMessage())) ?>"
rel="noreferrer" target="_blank">search &rarr;</a>
<?= esc(clean_path($prevException->getFile()) . ':' . $prevException->getLine()) ?>
</pre>

<?php
}
?>
</div>

<?php if (defined('SHOW_DEBUG_BACKTRACE') && SHOW_DEBUG_BACKTRACE) : ?>
<div class="container">

Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"require-dev": {
"codeigniter/coding-standard": "^1.5",
"fakerphp/faker": "^1.9",
"friendsofphp/php-cs-fixer": "3.13.0",
"friendsofphp/php-cs-fixer": "~3.41.0",
"kint-php/kint": "^5.0.4",
"mikey179/vfsstream": "^1.6",
"nexusphp/cs-config": "^3.6",
Expand All @@ -43,6 +43,7 @@
"ext-readline": "Improves CLI::input() usability",
"ext-redis": "If you use Cache class RedisHandler",
"ext-simplexml": "If you format XML",
"ext-sodium": "If you use Encryption SodiumHandler",
"ext-sqlite3": "If you use SQLite3",
"ext-sqlsrv": "If you use SQL Server",
"ext-xdebug": "If you use CIUnitTestCase::assertHeaderEmitted()"
Expand Down
2 changes: 1 addition & 1 deletion env
Original file line number Diff line number Diff line change
Expand Up @@ -140,4 +140,4 @@
# CURLRequest
#--------------------------------------------------------------------

# curlrequest.shareOptions = true
# curlrequest.shareOptions = false
2 changes: 1 addition & 1 deletion spark
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ if (version_compare(PHP_VERSION, $minPhpVersion, '<')) {
}

// We want errors to be shown when using it from the CLI.
error_reporting(-1);
error_reporting(E_ALL);
ini_set('display_errors', '1');

/**
Expand Down
4 changes: 2 additions & 2 deletions system/API/ResponseTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ protected function respond($data = null, ?int $status = null, string $message =
$output = null;
$this->format($data);
} else {
$status = empty($status) ? 200 : $status;
$status ??= 200;
$output = $this->format($data);
}

Expand Down Expand Up @@ -318,7 +318,7 @@ protected function format($data = null)

// Determine correct response type through content negotiation if not explicitly declared
if (
(empty($this->format) || ! in_array($this->format, ['json', 'xml'], true))
! in_array($this->format, ['json', 'xml'], true)
&& $this->request instanceof IncomingRequest
) {
$mime = $this->request->negotiate(
Expand Down
11 changes: 4 additions & 7 deletions system/Autoloader/Autoloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,15 @@ class Autoloader
/**
* Stores files as a list.
*
* @var string[]
* @phpstan-var list<string>
* @var list<string>
*/
protected $files = [];

/**
* Stores helper list.
* Always load the URL helper, it should be used in most apps.
*
* @var string[]
* @phpstan-var list<string>
* @var list<string>
*/
protected $helpers = ['url'];

Expand Down Expand Up @@ -119,7 +117,7 @@ public function initialize(Autoload $config, Modules $modules)
$this->files = $config->files;
}

if (isset($config->helpers)) { // @phpstan-ignore-line
if (isset($config->helpers)) {
$this->helpers = [...$this->helpers, ...$config->helpers];
}

Expand Down Expand Up @@ -185,8 +183,7 @@ public function unregister(): void
/**
* Registers namespaces with the autoloader.
*
* @param array<string, array<int, string>|string>|string $namespace
* @phpstan-param array<string, list<string>|string>|string $namespace
* @param array<string, list<string>|string>|string $namespace
*
* @return $this
*/
Expand Down
Loading

0 comments on commit 7c170c4

Please sign in to comment.