Skip to content

Commit b8a036d

Browse files
committed
Merge remote-tracking branch 'upstream/develop' into 4.7
2 parents 15f56bb + a54e627 commit b8a036d

File tree

118 files changed

+1575
-1914
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

118 files changed

+1575
-1914
lines changed

.github/workflows/test-coding-standards.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,5 +65,3 @@ jobs:
6565

6666
- name: Run lint
6767
run: composer cs
68-
env:
69-
PHP_CS_FIXER_IGNORE_ENV: ${{ matrix.php-version == '8.4' }}

.php-cs-fixer.dist.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313

1414
use CodeIgniter\CodingStandard\CodeIgniter4;
1515
use Nexus\CsConfig\Factory;
16-
use Nexus\CsConfig\Fixer\Comment\NoCodeSeparatorCommentFixer;
17-
use Nexus\CsConfig\FixerGenerator;
1816
use PhpCsFixer\Finder;
1917

2018
$finder = Finder::create()
@@ -44,12 +42,8 @@
4442
];
4543

4644
$options = [
47-
'cacheFile' => 'build/.php-cs-fixer.cache',
48-
'finder' => $finder,
49-
'customFixers' => FixerGenerator::create('utils/vendor/nexusphp/cs-config/src/Fixer', 'Nexus\\CsConfig\\Fixer'),
50-
'customRules' => [
51-
NoCodeSeparatorCommentFixer::name() => true,
52-
],
45+
'cacheFile' => 'build/.php-cs-fixer.cache',
46+
'finder' => $finder,
5347
];
5448

5549
return Factory::create(new CodeIgniter4(), $overrides, $options)->forLibrary(

admin/framework/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ writable/uploads/*
6161
!writable/uploads/index.html
6262

6363
writable/debugbar/*
64-
!writable/debugbar/.gitkeep
64+
!writable/debugbar/index.html
6565

6666
php_errors.log
6767

admin/starter/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ writable/uploads/*
6161
!writable/uploads/index.html
6262

6363
writable/debugbar/*
64-
!writable/debugbar/.gitkeep
64+
!writable/debugbar/index.html
6565

6666
php_errors.log
6767

app/Config/Cache.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class Cache extends BaseConfig
7878
* Your file storage preferences can be specified below, if you are using
7979
* the File driver.
8080
*
81-
* @var array<string, int|string|null>
81+
* @var array{storePath?: string, mode?: int}
8282
*/
8383
public array $file = [
8484
'storePath' => WRITEPATH . 'cache/',
@@ -95,7 +95,7 @@ class Cache extends BaseConfig
9595
*
9696
* @see https://codeigniter.com/user_guide/libraries/caching.html#memcached
9797
*
98-
* @var array<string, bool|int|string>
98+
* @var array{host?: string, port?: int, weight?: int, raw?: bool}
9999
*/
100100
public array $memcached = [
101101
'host' => '127.0.0.1',
@@ -112,7 +112,7 @@ class Cache extends BaseConfig
112112
* Your Redis server can be specified below, if you are using
113113
* the Redis or Predis drivers.
114114
*
115-
* @var array<string, int|string|null>
115+
* @var array{host?: string, password?: string|null, port?: int, timeout?: int, database?: int}
116116
*/
117117
public array $redis = [
118118
'host' => '127.0.0.1',

app/Views/errors/html/error_exception.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<!-- Header -->
2525
<div class="header">
2626
<div class="environment">
27-
Displayed at <?= esc(date('H:i:sa')) ?> &mdash;
27+
Displayed at <?= esc(date('H:i:s')) ?> &mdash;
2828
PHP: <?= esc(PHP_VERSION) ?> &mdash;
2929
CodeIgniter: <?= esc(CodeIgniter::CI_VERSION) ?> --
3030
Environment: <?= ENVIRONMENT ?>

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"phpunit/phpcov": "^9.0.2 || ^10.0",
2929
"phpunit/phpunit": "^10.5.16 || ^11.2",
3030
"predis/predis": "^3.0",
31-
"rector/rector": "2.0.17",
31+
"rector/rector": "2.1.0",
3232
"shipmonk/phpstan-baseline-per-identifier": "^2.0"
3333
},
3434
"replace": {

phpstan-bootstrap.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,17 @@
22

33
require __DIR__ . '/system/util_bootstrap.php';
44

5-
if (! defined('OCI_COMMIT_ON_SUCCESS')) {
6-
define('OCI_COMMIT_ON_SUCCESS', 32);
5+
defined('OCI_COMMIT_ON_SUCCESS') || define('OCI_COMMIT_ON_SUCCESS', 32);
6+
7+
foreach ([
8+
'app/Config',
9+
] as $directory) {
10+
$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory));
11+
12+
/** @var SplFileInfo $file */
13+
foreach ($iterator as $file) {
14+
if ($file->isFile() && $file->getExtension() === 'php') {
15+
require_once $file->getRealPath();
16+
}
17+
}
718
}

rector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
])
7272
// do you need to include constants, class aliases or custom autoloader? files listed will be executed
7373
->withBootstrapFiles([
74-
__DIR__ . '/system/util_bootstrap.php',
74+
__DIR__ . '/phpstan-bootstrap.php',
7575
])
7676
->withPHPStanConfigs([
7777
__DIR__ . '/phpstan.neon.dist',

system/Autoloader/Autoloader.php

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
use Config\Autoload;
2222
use Config\Kint as KintConfig;
2323
use Config\Modules;
24-
use Kint;
24+
use Kint\Kint;
2525
use Kint\Renderer\CliRenderer;
2626
use Kint\Renderer\RichRenderer;
2727

@@ -67,29 +67,29 @@ class Autoloader
6767
/**
6868
* Stores namespaces as key, and path as values.
6969
*
70-
* @var array<string, list<string>>
70+
* @var array<non-empty-string, list<non-empty-string>>
7171
*/
7272
protected $prefixes = [];
7373

7474
/**
7575
* Stores class name as key, and path as values.
7676
*
77-
* @var array<class-string, string>
77+
* @var array<class-string, non-empty-string>
7878
*/
7979
protected $classmap = [];
8080

8181
/**
8282
* Stores files as a list.
8383
*
84-
* @var list<string>
84+
* @var list<non-empty-string>
8585
*/
8686
protected $files = [];
8787

8888
/**
8989
* Stores helper list.
9090
* Always load the URL helper, it should be used in most apps.
9191
*
92-
* @var list<string>
92+
* @var list<non-empty-string>
9393
*/
9494
protected $helpers = ['url'];
9595

@@ -147,36 +147,35 @@ private function loadComposerAutoloader(Modules $modules): void
147147

148148
// Should we load through Composer's namespaces, also?
149149
if ($modules->discoverInComposer) {
150-
// @phpstan-ignore-next-line
151-
$this->loadComposerNamespaces($composer, $modules->composerPackages ?? []);
150+
$composerPackages = $modules->composerPackages;
151+
$this->loadComposerNamespaces($composer, $composerPackages ?? []);
152152
}
153153

154154
unset($composer);
155155
}
156156

157157
/**
158-
* Register the loader with the SPL autoloader stack.
158+
* Register the loader with the SPL autoloader stack
159+
* in the following order:
160+
*
161+
* 1. Classmap loader
162+
* 2. PSR-4 autoloader
163+
* 3. Non-class files
159164
*
160165
* @return void
161166
*/
162167
public function register()
163168
{
164-
// Register classmap loader for the files in our class map.
165169
spl_autoload_register($this->loadClassmap(...), true);
166-
167-
// Register the PSR-4 autoloader.
168170
spl_autoload_register($this->loadClass(...), true);
169171

170-
// Load our non-class files
171172
foreach ($this->files as $file) {
172173
$this->includeFile($file);
173174
}
174175
}
175176

176177
/**
177-
* Unregister autoloader.
178-
*
179-
* This method is for testing.
178+
* Unregisters the autoloader from the SPL autoload stack.
180179
*/
181180
public function unregister(): void
182181
{
@@ -187,7 +186,7 @@ public function unregister(): void
187186
/**
188187
* Registers namespaces with the autoloader.
189188
*
190-
* @param array<string, list<string>|string>|string $namespace
189+
* @param array<non-empty-string, list<non-empty-string>|non-empty-string>|non-empty-string $namespace
191190
*
192191
* @return $this
193192
*/
@@ -219,7 +218,7 @@ public function addNamespace($namespace, ?string $path = null)
219218
*
220219
* If a prefix param is set, returns only paths to the given prefix.
221220
*
222-
* @return ($prefix is null ? array<string, list<string>> : list<string>)
221+
* @return ($prefix is null ? array<non-empty-string, list<non-empty-string>> : list<non-empty-string>)
223222
*/
224223
public function getNamespace(?string $prefix = null)
225224
{
@@ -247,6 +246,8 @@ public function removeNamespace(string $namespace)
247246
/**
248247
* Load a class using available class mapping.
249248
*
249+
* @param class-string $class The fully qualified class name.
250+
*
250251
* @internal For `spl_autoload_register` use.
251252
*/
252253
public function loadClassmap(string $class): void
@@ -261,9 +262,9 @@ public function loadClassmap(string $class): void
261262
/**
262263
* Loads the class file for a given class name.
263264
*
264-
* @internal For `spl_autoload_register` use.
265+
* @param class-string $class The fully qualified class name.
265266
*
266-
* @param string $class The fully qualified class name.
267+
* @internal For `spl_autoload_register` use.
267268
*/
268269
public function loadClass(string $class): void
269270
{
@@ -273,9 +274,9 @@ public function loadClass(string $class): void
273274
/**
274275
* Loads the class file for a given class name.
275276
*
276-
* @param string $class The fully-qualified class name
277+
* @param class-string $class The fully qualified class name.
277278
*
278-
* @return false|string The mapped file name on success, or boolean false on fail
279+
* @return false|non-empty-string The mapped file name on success, or boolean false on fail
279280
*/
280281
protected function loadInNamespace(string $class)
281282
{
@@ -293,21 +294,20 @@ protected function loadInNamespace(string $class)
293294
$filePath = $directory . $relativeClassPath . '.php';
294295
$filename = $this->includeFile($filePath);
295296

296-
if ($filename) {
297+
if ($filename !== false) {
297298
return $filename;
298299
}
299300
}
300301
}
301302
}
302303

303-
// never found a mapped file
304304
return false;
305305
}
306306

307307
/**
308308
* A central way to include a file. Split out primarily for testing purposes.
309309
*
310-
* @return false|string The filename on success, false if the file is not loaded
310+
* @return false|non-empty-string The filename on success, false if the file is not loaded
311311
*/
312312
protected function includeFile(string $file)
313313
{

0 commit comments

Comments
 (0)