Skip to content
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
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"psr/log": "^3.0"
},
"require-dev": {
"boundwize/structarmed": "^0.16",
"boundwize/structarmed": "^0.17",
"codeigniter/phpstan-codeigniter": "^2.1",
"fakerphp/faker": "^1.24",
"kint-php/kint": "^6.1",
Expand Down
6 changes: 5 additions & 1 deletion structarmed.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
* the LICENSE file that was distributed with this source code.
*/

use Boundwize\StructArmed\Preset\Presets\CodeQualityPreset;
use CodeIgniter\Cache\ResponseCache;
use CodeIgniter\HTTP\CLIRequest;
use CodeIgniter\HTTP\Header;
Expand Down Expand Up @@ -45,9 +46,12 @@
__DIR__ . '/tests/system/Config/fixtures',
],
__DIR__ . '/system/ThirdParty',
CodeQualityPreset::ANONYMOUS_FUNCTIONS_MUST_BE_STATIC => [
__DIR__ . '/system/View/Cells/Cell.php',
],
])
->cacheDirectory(is_dir('/tmp') ? '/tmp/structarmed' : null)
->withPreset(Preset::PSR4())
->withPresets(Preset::PSR4(), Preset::CODEQUALITY())
// Resolve CodeIgniter layers from class names because several layers share directories.
->layerPattern('API', '/^CodeIgniter\\\\API\\\\.*$/')
->layerPattern('Cache', '/^CodeIgniter\\\\Cache\\\\.*$/')
Expand Down
2 changes: 1 addition & 1 deletion system/Autoloader/Autoloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ private function autoloadKint(): void
{
// If we have KINT_DIR it means it's already loaded via composer
if (! defined('KINT_DIR')) {
spl_autoload_register(function ($class): void {
spl_autoload_register(static function ($class): void {
$class = explode('\\', $class);

if (array_shift($class) !== 'Kint') {
Expand Down
2 changes: 1 addition & 1 deletion system/CodeIgniter.php
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ private function autoloadKint(): void
{
// If we have KINT_DIR it means it's already loaded via composer
if (! defined('KINT_DIR')) {
spl_autoload_register(function ($class): void {
spl_autoload_register(static function ($class): void {
$class = explode('\\', $class);

if (array_shift($class) !== 'Kint') {
Expand Down
2 changes: 1 addition & 1 deletion tests/system/Entity/EntityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ public function testCastDateTimeWithTimestampTimezone(): void

$entity = $this->getCastEntity();

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

$this->assertInstanceOf(Time::class, $entity->eighth);
// The timezone is the default timezone, not UTC.
Expand Down
2 changes: 1 addition & 1 deletion tests/system/I18n/TimeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ public function testCreateFromTimestamp(): void

public function testCreateFromTimestampWithMicroseconds(): void
{
$timestamp = 1489762800.654321;
$timestamp = 1_489_762_800.654321;
$locale = setlocale(LC_NUMERIC, '0');

setlocale(LC_NUMERIC, 'de_DE.UTF-8', 'de_DE');
Expand Down
8 changes: 4 additions & 4 deletions tests/system/SuperglobalsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,16 @@ public function testServerSetWithArray(): void

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

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

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

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

public function testServerUnset(): void
Expand Down
Loading