Skip to content

Commit 24f67ea

Browse files
authored
Merge pull request #6187 from kenjis/refactor-CompleteDynamicPropertiesRector
refactor: add CompleteDynamicPropertiesRector
2 parents adf2dc6 + e49c0bd commit 24f67ea

22 files changed

+75
-5
lines changed

rector.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
*/
1111

1212
use Rector\CodeQuality\Rector\BooleanAnd\SimplifyEmptyArrayCheckRector;
13+
use Rector\CodeQuality\Rector\Class_\CompleteDynamicPropertiesRector;
1314
use Rector\CodeQuality\Rector\Expression\InlineIfToExplicitIfRector;
1415
use Rector\CodeQuality\Rector\For_\ForToForeachRector;
1516
use Rector\CodeQuality\Rector\Foreach_\UnusedForeachValueToArrayKeysRector;
@@ -160,4 +161,5 @@
160161
'SQLite3',
161162
]);
162163
$rectorConfig->rule(PrivatizeFinalClassPropertyRector::class);
164+
$rectorConfig->rule(CompleteDynamicPropertiesRector::class);
163165
};

tests/system/CLI/ConsoleTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
*/
2525
final class ConsoleTest extends CIUnitTestCase
2626
{
27+
private DotEnv $env;
2728
private $stream_filter;
2829

2930
protected function setUp(): void

tests/system/CommonFunctionsTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace CodeIgniter;
1313

1414
use CodeIgniter\Config\BaseService;
15+
use CodeIgniter\HTTP\IncomingRequest;
1516
use CodeIgniter\HTTP\RedirectResponse;
1617
use CodeIgniter\HTTP\Response;
1718
use CodeIgniter\HTTP\URI;
@@ -43,6 +44,9 @@
4344
*/
4445
final class CommonFunctionsTest extends CIUnitTestCase
4546
{
47+
private ?App $config = null;
48+
private IncomingRequest $request;
49+
4650
protected function setUp(): void
4751
{
4852
unset($_ENV['foo'], $_SERVER['foo']);

tests/system/Config/DotEnvTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use CodeIgniter\Test\CIUnitTestCase;
1515
use org\bovigo\vfs\vfsStream;
16+
use org\bovigo\vfs\vfsStreamDirectory;
1617

1718
/**
1819
* @backupGlobals enabled
@@ -23,6 +24,8 @@
2324
*/
2425
final class DotEnvTest extends CIUnitTestCase
2526
{
27+
private ?vfsStreamDirectory $root;
28+
private string $path;
2629
private $fixturesFolder;
2730

2831
protected function setUp(): void

tests/system/ControllerTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
*/
3434
final class ControllerTest extends CIUnitTestCase
3535
{
36+
private App $config;
37+
3638
/**
3739
* @var Controller
3840
*/

tests/system/Database/Live/MetadataTest.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace CodeIgniter\Database\Live;
1313

14+
use CodeIgniter\Database\Forge;
1415
use CodeIgniter\Test\CIUnitTestCase;
1516
use CodeIgniter\Test\DatabaseTestTrait;
1617
use Config\Database;
@@ -25,8 +26,9 @@ final class MetadataTest extends CIUnitTestCase
2526
{
2627
use DatabaseTestTrait;
2728

28-
protected $refresh = true;
29-
protected $seed = CITestSeeder::class;
29+
private ?Forge $forge = null;
30+
protected $refresh = true;
31+
protected $seed = CITestSeeder::class;
3032

3133
/**
3234
* Array of expected tables.

tests/system/Events/EventsTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ final class EventsTest extends CIUnitTestCase
2525
/**
2626
* Accessible event manager instance
2727
*/
28-
private MockEvents $manager;
28+
private Events $manager;
2929

3030
protected function setUp(): void
3131
{

tests/system/HTTP/CURLRequestDoNotShareOptionsTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
*/
2626
final class CURLRequestDoNotShareOptionsTest extends CIUnitTestCase
2727
{
28-
private MockCURLRequest $request;
28+
private CURLRequest $request;
2929

3030
protected function setUp(): void
3131
{

tests/system/HTTP/CURLRequestTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
*/
2626
final class CURLRequestTest extends CIUnitTestCase
2727
{
28-
private MockCURLRequest $request;
28+
private CURLRequest $request;
2929

3030
protected function setUp(): void
3131
{

tests/system/HTTP/ContentSecurityPolicyTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
*/
2828
final class ContentSecurityPolicyTest extends CIUnitTestCase
2929
{
30+
private ?Response $response = null;
31+
private ?ContentSecurityPolicy $csp = null;
32+
3033
// Having this method as setUp() doesn't work - can't find Config\App !?
3134
protected function prepare(bool $CSPEnabled = true)
3235
{

0 commit comments

Comments
 (0)