Skip to content

Commit c32a6e5

Browse files
authored
chore: Bump structarmed to ^0.17 and enable CodeQuality preset (#10520)
* chore: Bump structarmed to ^0.17 and enable CodeQuality preset * chore: skip Cell for static closure
1 parent 322c33a commit c32a6e5

7 files changed

Lines changed: 14 additions & 10 deletions

File tree

‎composer.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"psr/log": "^3.0"
1818
},
1919
"require-dev": {
20-
"boundwize/structarmed": "^0.16",
20+
"boundwize/structarmed": "^0.17",
2121
"codeigniter/phpstan-codeigniter": "^2.1",
2222
"fakerphp/faker": "^1.24",
2323
"kint-php/kint": "^6.1",

‎structarmed.php‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
* the LICENSE file that was distributed with this source code.
1212
*/
1313

14+
use Boundwize\StructArmed\Preset\Presets\CodeQualityPreset;
1415
use CodeIgniter\Cache\ResponseCache;
1516
use CodeIgniter\HTTP\CLIRequest;
1617
use CodeIgniter\HTTP\Header;
@@ -45,9 +46,12 @@
4546
__DIR__ . '/tests/system/Config/fixtures',
4647
],
4748
__DIR__ . '/system/ThirdParty',
49+
CodeQualityPreset::ANONYMOUS_FUNCTIONS_MUST_BE_STATIC => [
50+
__DIR__ . '/system/View/Cells/Cell.php',
51+
],
4852
])
4953
->cacheDirectory(is_dir('/tmp') ? '/tmp/structarmed' : null)
50-
->withPreset(Preset::PSR4())
54+
->withPresets(Preset::PSR4(), Preset::CODEQUALITY())
5155
// Resolve CodeIgniter layers from class names because several layers share directories.
5256
->layerPattern('API', '/^CodeIgniter\\\\API\\\\.*$/')
5357
->layerPattern('Cache', '/^CodeIgniter\\\\Cache\\\\.*$/')

‎system/Autoloader/Autoloader.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ private function autoloadKint(): void
531531
{
532532
// If we have KINT_DIR it means it's already loaded via composer
533533
if (! defined('KINT_DIR')) {
534-
spl_autoload_register(function ($class): void {
534+
spl_autoload_register(static function ($class): void {
535535
$class = explode('\\', $class);
536536

537537
if (array_shift($class) !== 'Kint') {

‎system/CodeIgniter.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ private function autoloadKint(): void
261261
{
262262
// If we have KINT_DIR it means it's already loaded via composer
263263
if (! defined('KINT_DIR')) {
264-
spl_autoload_register(function ($class): void {
264+
spl_autoload_register(static function ($class): void {
265265
$class = explode('\\', $class);
266266

267267
if (array_shift($class) !== 'Kint') {

‎tests/system/Entity/EntityTest.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ public function testCastDateTimeWithTimestampTimezone(): void
507507

508508
$entity = $this->getCastEntity();
509509

510-
$entity->eighth = 1722988800; // 2024-08-07 00:00:00 UTC
510+
$entity->eighth = 1_722_988_800; // 2024-08-07 00:00:00 UTC
511511

512512
$this->assertInstanceOf(Time::class, $entity->eighth);
513513
// The timezone is the default timezone, not UTC.

‎tests/system/I18n/TimeTest.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ public function testCreateFromTimestamp(): void
290290

291291
public function testCreateFromTimestampWithMicroseconds(): void
292292
{
293-
$timestamp = 1489762800.654321;
293+
$timestamp = 1_489_762_800.654321;
294294
$locale = setlocale(LC_NUMERIC, '0');
295295

296296
setlocale(LC_NUMERIC, 'de_DE.UTF-8', 'de_DE');

‎tests/system/SuperglobalsTest.php‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,16 +57,16 @@ public function testServerSetWithArray(): void
5757

5858
public function testServerSetWithInt(): void
5959
{
60-
$this->superglobals->setServer('REQUEST_TIME', 1234567890);
60+
$this->superglobals->setServer('REQUEST_TIME', 1_234_567_890);
6161

62-
$this->assertSame(1234567890, $this->superglobals->server('REQUEST_TIME'));
62+
$this->assertSame(1_234_567_890, $this->superglobals->server('REQUEST_TIME'));
6363
}
6464

6565
public function testServerSetWithFloat(): void
6666
{
67-
$this->superglobals->setServer('REQUEST_TIME_FLOAT', 1234567890.123);
67+
$this->superglobals->setServer('REQUEST_TIME_FLOAT', 1_234_567_890.123);
6868

69-
$this->assertEqualsWithDelta(1234567890.123, $this->superglobals->server('REQUEST_TIME_FLOAT'), PHP_FLOAT_EPSILON);
69+
$this->assertEqualsWithDelta(1_234_567_890.123, $this->superglobals->server('REQUEST_TIME_FLOAT'), PHP_FLOAT_EPSILON);
7070
}
7171

7272
public function testServerUnset(): void

0 commit comments

Comments
 (0)