Skip to content

Commit 024ac14

Browse files
committed
Apply Rector
1 parent 1de303c commit 024ac14

5 files changed

Lines changed: 9 additions & 14 deletions

File tree

rector.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@
8282
// Ignore files that should not be namespaced
8383
NormalizeNamespaceByPSR4ComposerAutoloadRector::class => [
8484
__DIR__ . '/src/Helpers',
85+
__DIR__ . '/tests/_support',
8586
],
8687

8788
// May load view files directly when detecting classes

src/Handlers/ArrayHandler.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ class ArrayHandler extends BaseHandler
1717
*
1818
* @var array<string,array<string,array>>
1919
*/
20-
private $general = [];
20+
private array $general = [];
2121

2222
/**
2323
* Storage for context settings.
2424
* Format: ['context' => ['class' => ['property' => ['value', 'type']]]]
2525
*
2626
* @var array<string,array|null>
2727
*/
28-
private $contexts = [];
28+
private array $contexts = [];
2929

3030
public function has(string $class, string $property, ?string $context = null): bool
3131
{
@@ -53,14 +53,10 @@ public function forget(string $class, string $property, ?string $context = null)
5353
protected function hasStored(string $class, string $property, ?string $context): bool
5454
{
5555
if ($context === null) {
56-
return isset($this->general[$class])
57-
? array_key_exists($property, $this->general[$class])
58-
: false;
56+
return isset($this->general[$class]) && array_key_exists($property, $this->general[$class]);
5957
}
6058

61-
return isset($this->contexts[$context][$class])
62-
? array_key_exists($property, $this->contexts[$context][$class])
63-
: false;
59+
return isset($this->contexts[$context][$class]) && array_key_exists($property, $this->contexts[$context][$class]);
6460
}
6561

6662
/**

src/Handlers/DatabaseHandler.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,8 @@ class DatabaseHandler extends ArrayHandler
1313
{
1414
/**
1515
* The database table to use.
16-
*
17-
* @var string
1816
*/
19-
private $table;
17+
private string $table;
2018

2119
/**
2220
* Array of contexts that have been stored.

src/Settings.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class Settings
1919
*
2020
* @var BaseHandler[]
2121
*/
22-
private $handlers = [];
22+
private array $handlers = [];
2323

2424
/**
2525
* An array of the config options for each handler.
@@ -55,7 +55,7 @@ public function get(string $key, ?string $context = null)
5555
[$class, $property, $config] = $this->prepareClassAndProperty($key);
5656

5757
// Check each of our handlers
58-
foreach ($this->handlers as $name => $handler) {
58+
foreach ($this->handlers as $handler) {
5959
if ($handler->has($class, $property, $context)) {
6060
return $handler->get($class, $property, $context);
6161
}

tests/HelperTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace CodeIgniter4\Tests;
3+
namespace Tests;
44

55
use CodeIgniter\Settings\Settings;
66
use CodeIgniter\Test\DatabaseTestTrait;

0 commit comments

Comments
 (0)