Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: add CompleteDynamicPropertiesRector #6187

Merged
Merged
Show file tree
Hide file tree
Changes from 2 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: 2 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
*/

use Rector\CodeQuality\Rector\BooleanAnd\SimplifyEmptyArrayCheckRector;
use Rector\CodeQuality\Rector\Class_\CompleteDynamicPropertiesRector;
use Rector\CodeQuality\Rector\Expression\InlineIfToExplicitIfRector;
use Rector\CodeQuality\Rector\For_\ForToForeachRector;
use Rector\CodeQuality\Rector\Foreach_\UnusedForeachValueToArrayKeysRector;
Expand Down Expand Up @@ -160,4 +161,5 @@
'SQLite3',
]);
$rectorConfig->rule(PrivatizeFinalClassPropertyRector::class);
$rectorConfig->rule(CompleteDynamicPropertiesRector::class);
};
5 changes: 5 additions & 0 deletions tests/system/CLI/ConsoleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
*/
final class ConsoleTest extends CIUnitTestCase
{
/**
* @var DotEnv|mixed
*/
public $env;

private $stream_filter;

protected function setUp(): void
Expand Down
7 changes: 7 additions & 0 deletions tests/system/CommonFunctionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@
*/
final class CommonFunctionsTest extends CIUnitTestCase
{
/**
* @var App|mixed
*/
public $config;

public MockIncomingRequest $request;

protected function setUp(): void
{
unset($_ENV['foo'], $_SERVER['foo']);
Expand Down
7 changes: 7 additions & 0 deletions tests/system/Config/DotEnvTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

use CodeIgniter\Test\CIUnitTestCase;
use org\bovigo\vfs\vfsStream;
use org\bovigo\vfs\vfsStreamDirectory;

/**
* @backupGlobals enabled
Expand All @@ -23,6 +24,12 @@
*/
final class DotEnvTest extends CIUnitTestCase
{
/**
* @var mixed|vfsStreamDirectory|null
*/
public $root;

public string $path;
private $fixturesFolder;

protected function setUp(): void
Expand Down
5 changes: 5 additions & 0 deletions tests/system/ControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@
*/
final class ControllerTest extends CIUnitTestCase
{
/**
* @var App|mixed
*/
public $config;

/**
* @var Controller
*/
Expand Down
6 changes: 6 additions & 0 deletions tests/system/Database/Live/MetadataTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace CodeIgniter\Database\Live;

use CodeIgniter\Database\Forge;
use CodeIgniter\Test\CIUnitTestCase;
use CodeIgniter\Test\DatabaseTestTrait;
use Config\Database;
Expand All @@ -25,6 +26,11 @@ final class MetadataTest extends CIUnitTestCase
{
use DatabaseTestTrait;

/**
* @var Forge|mixed
*/
public $forge;

protected $refresh = true;
protected $seed = CITestSeeder::class;

Expand Down
10 changes: 10 additions & 0 deletions tests/system/HTTP/ContentSecurityPolicyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,16 @@
*/
final class ContentSecurityPolicyTest extends CIUnitTestCase
{
/**
* @var mixed|Response
*/
public $response;

/**
* @var \CodeIgniter\HTTP\ContentSecurityPolicy|mixed
*/
public $csp;

// Having this method as setUp() doesn't work - can't find Config\App !?
protected function prepare(bool $CSPEnabled = true)
{
Expand Down
18 changes: 18 additions & 0 deletions tests/system/HTTP/Files/FileMovingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,30 @@
use CodeIgniter\HTTP\Exceptions\HTTPException;
use CodeIgniter\Test\CIUnitTestCase;
use org\bovigo\vfs\vfsStream;
use org\bovigo\vfs\vfsStreamDirectory;

/**
* @internal
*/
final class FileMovingTest extends CIUnitTestCase
{
/**
* @var mixed|vfsStreamDirectory|null
*/
public $root;

public string $path;

/**
* @var mixed|string
*/
public $start;

/**
* @var mixed|string
*/
public $destination;

protected function setUp(): void
{
parent::setUp();
Expand Down
1 change: 1 addition & 0 deletions tests/system/Helpers/CookieHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
*/
final class CookieHelperTest extends CIUnitTestCase
{
public IncomingRequest $request;
private $name;
private string $value;
private int $expire;
Expand Down
5 changes: 5 additions & 0 deletions tests/system/Helpers/FilesystemHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
*/
final class FilesystemHelperTest extends CIUnitTestCase
{
/**
* @var array<string, array<string, mixed[]>>|array<string, array<string, string>>|array<string, mixed>|array<string, mixed[]>|array<string, string>|mixed
*/
public $structure;

protected function setUp(): void
{
parent::setUp();
Expand Down
21 changes: 21 additions & 0 deletions tests/system/Images/BaseHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use CodeIgniter\Images\Handlers\BaseHandler;
use CodeIgniter\Test\CIUnitTestCase;
use org\bovigo\vfs\vfsStream;
use org\bovigo\vfs\vfsStreamDirectory;

/**
* Test the common image processing functionality.
Expand All @@ -30,6 +31,26 @@
*/
final class BaseHandlerTest extends CIUnitTestCase
{
/**
* @var mixed|vfsStreamDirectory
*/
public $root;

/**
* @var mixed|string
*/
public $origin;

/**
* @var mixed|string
*/
public $start;

/**
* @var mixed|string
*/
public $path;

protected function setUp(): void
{
if (! extension_loaded('gd')) {
Expand Down
27 changes: 27 additions & 0 deletions tests/system/Images/GDHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@

use CodeIgniter\Config\Services;
use CodeIgniter\Images\Exceptions\ImageException;
use CodeIgniter\Images\Handlers\BaseHandler;
use CodeIgniter\Test\CIUnitTestCase;
use org\bovigo\vfs\vfsStream;
use org\bovigo\vfs\vfsStreamDirectory;

/**
* Unit testing for the GD image handler.
Expand All @@ -29,6 +31,31 @@
*/
final class GDHandlerTest extends CIUnitTestCase
{
/**
* @var mixed|vfsStreamDirectory
*/
public $root;

/**
* @var mixed|string
*/
public $origin;

/**
* @var mixed|string
*/
public $start;

/**
* @var mixed|string
*/
public $path;

/**
* @var BaseHandler|mixed
*/
public $handler;

protected function setUp(): void
{
if (! extension_loaded('gd')) {
Expand Down
21 changes: 21 additions & 0 deletions tests/system/Images/ImageMagickHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

use CodeIgniter\Config\Services;
use CodeIgniter\Images\Exceptions\ImageException;
use CodeIgniter\Images\Handlers\BaseHandler;
use CodeIgniter\Test\CIUnitTestCase;
use Config\Images;
use Imagick;
Expand All @@ -30,6 +31,26 @@
*/
final class ImageMagickHandlerTest extends CIUnitTestCase
{
/**
* @var mixed|string
*/
public $root;

/**
* @var mixed|string
*/
public $origin;

/**
* @var mixed|string
*/
public $path;

/**
* @var BaseHandler|mixed
*/
public $handler;

protected function setUp(): void
{
if (! extension_loaded('imagick')) {
Expand Down
18 changes: 18 additions & 0 deletions tests/system/Images/ImageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,30 @@
use CodeIgniter\Images\Exceptions\ImageException;
use CodeIgniter\Test\CIUnitTestCase;
use org\bovigo\vfs\vfsStream;
use org\bovigo\vfs\vfsStreamDirectory;

/**
* @internal
*/
final class ImageTest extends CIUnitTestCase
{
/**
* @var mixed|vfsStreamDirectory
*/
public $root;

public string $origin;

/**
* @var mixed|string
*/
public $start;

/**
* @var Image|mixed
*/
public $image;

protected function setUp(): void
{
// create virtual file system
Expand Down
11 changes: 11 additions & 0 deletions tests/system/Log/Handlers/FileHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,24 @@
use CodeIgniter\Test\Mock\MockFileLogger;
use CodeIgniter\Test\Mock\MockLogger as LoggerConfig;
use org\bovigo\vfs\vfsStream;
use org\bovigo\vfs\vfsStreamDirectory;
use Tests\Support\Log\Handlers\TestHandler;

/**
* @internal
*/
final class FileHandlerTest extends CIUnitTestCase
{
/**
* @var mixed|vfsStreamDirectory
*/
public $root;

/**
* @var mixed|string
*/
public $start;

protected function setUp(): void
{
parent::setUp();
Expand Down
5 changes: 5 additions & 0 deletions tests/system/Pager/PagerRendererTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
*/
final class PagerRendererTest extends CIUnitTestCase
{
/**
* @var mixed|string
*/
public $expect;

private URI $uri;

protected function setUp(): void
Expand Down
5 changes: 5 additions & 0 deletions tests/system/Test/TestCaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
*/
final class TestCaseTest extends CIUnitTestCase
{
/**
* @var bool|mixed|resource
*/
public $stream_filter;

public function testGetPrivatePropertyWithObject()
{
$obj = new __TestForReflectionHelper();
Expand Down
5 changes: 5 additions & 0 deletions tests/system/Throttle/ThrottleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
*/
final class ThrottleTest extends CIUnitTestCase
{
/**
* @var mixed|MockCache
*/
public $cache;

protected function setUp(): void
{
parent::setUp();
Expand Down
5 changes: 5 additions & 0 deletions tests/system/View/TableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@
*/
final class TableTest extends CIUnitTestCase
{
/**
* @var mixed|MockTable
*/
public $table;

protected function setUp(): void
{
$this->table = new MockTable();
Expand Down