From 3fd8261398f30146fdea92c8071bcc57a8a39be7 Mon Sep 17 00:00:00 2001 From: Rizqy H Date: Wed, 2 Jul 2025 20:37:15 +0700 Subject: [PATCH 01/13] add `rector/rector` as dev dependency --- composer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 6fd1f052..f396de63 100755 --- a/composer.json +++ b/composer.json @@ -70,8 +70,9 @@ }, "require-dev": { "mockery/mockery": "~1.3", - "phpunit/phpunit": "~9.6", "phpspec/prophecy-phpunit": "~2.0", + "phpunit/phpunit": "~9.6", + "rector/rector": "^2.1", "symfony/var-dumper": "~6.4" }, "autoload": { From d8f8179f0e1c8b42ae7488671144f23468e320b2 Mon Sep 17 00:00:00 2001 From: Rizqy H Date: Wed, 2 Jul 2025 20:37:31 +0700 Subject: [PATCH 02/13] set base PHP version to 8.2 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index f396de63..745066bf 100755 --- a/composer.json +++ b/composer.json @@ -10,7 +10,7 @@ } ], "require": { - "php": ">=8.1.0", + "php": ">=8.2.0", "d11wtq/boris": "~1.0", "filp/whoops": "~2.11", "ircmaxell/password-compat": "~1.0", From 83618eebc2b416c48e1dab4cafe128df51cae008 Mon Sep 17 00:00:00 2001 From: Rizqy H Date: Tue, 16 Sep 2025 17:28:03 +0700 Subject: [PATCH 03/13] fix dynamic properties --- rector.php | 11 +++++++++++ src/Illuminate/Database/QueryException.php | 5 +++++ src/Illuminate/Database/Schema/Grammars/Grammar.php | 7 ++++++- .../Foundation/Console/CommandMakeCommand.php | 4 +++- .../Foundation/Console/KeyGenerateCommand.php | 4 +++- src/Illuminate/Foundation/MigrationPublisher.php | 4 +++- src/Illuminate/Queue/Queue.php | 4 +++- src/Illuminate/Queue/QueueManager.php | 7 ++++++- src/Illuminate/Session/CookieSessionHandler.php | 9 +++++++-- src/Illuminate/Translation/Translator.php | 4 +++- src/Illuminate/Validation/Validator.php | 7 ++++++- 11 files changed, 56 insertions(+), 10 deletions(-) create mode 100644 rector.php diff --git a/rector.php b/rector.php new file mode 100644 index 00000000..9a9f673c --- /dev/null +++ b/rector.php @@ -0,0 +1,11 @@ +withPaths([ + __DIR__ . '/src', + ]) + ->withRules([\Rector\CodeQuality\Rector\Class_\CompleteDynamicPropertiesRector::class]); diff --git a/src/Illuminate/Database/QueryException.php b/src/Illuminate/Database/QueryException.php index e3f9cf2f..9b5adaea 100644 --- a/src/Illuminate/Database/QueryException.php +++ b/src/Illuminate/Database/QueryException.php @@ -5,6 +5,11 @@ class QueryException extends PDOException { /** + * @var \Exception + */ + protected $previous; + + /** * The SQL for the query. * * @var string diff --git a/src/Illuminate/Database/Schema/Grammars/Grammar.php b/src/Illuminate/Database/Schema/Grammars/Grammar.php index 96c6fb21..1cda678a 100755 --- a/src/Illuminate/Database/Schema/Grammars/Grammar.php +++ b/src/Illuminate/Database/Schema/Grammars/Grammar.php @@ -11,7 +11,12 @@ abstract class Grammar extends BaseGrammar { - /** + /** + * @var array + */ + protected $modifiers; + + /** * Compile a rename column command. * * @param \Illuminate\Database\Schema\Blueprint $blueprint diff --git a/src/Illuminate/Foundation/Console/CommandMakeCommand.php b/src/Illuminate/Foundation/Console/CommandMakeCommand.php index 0882792c..ad97016f 100755 --- a/src/Illuminate/Foundation/Console/CommandMakeCommand.php +++ b/src/Illuminate/Foundation/Console/CommandMakeCommand.php @@ -7,7 +7,9 @@ class CommandMakeCommand extends Command { - /** + protected Filesystem $files; + + /** * The console command name. * * @var string diff --git a/src/Illuminate/Foundation/Console/KeyGenerateCommand.php b/src/Illuminate/Foundation/Console/KeyGenerateCommand.php index 564b5db6..32cb73d0 100755 --- a/src/Illuminate/Foundation/Console/KeyGenerateCommand.php +++ b/src/Illuminate/Foundation/Console/KeyGenerateCommand.php @@ -6,7 +6,9 @@ class KeyGenerateCommand extends Command { - /** + protected Filesystem $files; + + /** * The console command name. * * @var string diff --git a/src/Illuminate/Foundation/MigrationPublisher.php b/src/Illuminate/Foundation/MigrationPublisher.php index 75faab39..44a1f82a 100644 --- a/src/Illuminate/Foundation/MigrationPublisher.php +++ b/src/Illuminate/Foundation/MigrationPublisher.php @@ -5,7 +5,9 @@ class MigrationPublisher { - /** + protected Filesystem $files; + + /** * A cache of migrations at a given destination. * * @var array diff --git a/src/Illuminate/Queue/Queue.php b/src/Illuminate/Queue/Queue.php index e6cd428f..6eb7a8b3 100755 --- a/src/Illuminate/Queue/Queue.php +++ b/src/Illuminate/Queue/Queue.php @@ -8,7 +8,9 @@ abstract class Queue { - /** + protected Encrypter $crypt; + + /** * The IoC container instance. * * @var \Illuminate\Container\Container diff --git a/src/Illuminate/Queue/QueueManager.php b/src/Illuminate/Queue/QueueManager.php index 22313273..c66efdc1 100755 --- a/src/Illuminate/Queue/QueueManager.php +++ b/src/Illuminate/Queue/QueueManager.php @@ -4,7 +4,12 @@ class QueueManager { - /** + /** + * @var array + */ + protected $connectors; + + /** * The application instance. * * @var \Illuminate\Foundation\Application diff --git a/src/Illuminate/Session/CookieSessionHandler.php b/src/Illuminate/Session/CookieSessionHandler.php index ab87162b..84f66dae 100755 --- a/src/Illuminate/Session/CookieSessionHandler.php +++ b/src/Illuminate/Session/CookieSessionHandler.php @@ -5,7 +5,12 @@ class CookieSessionHandler implements \SessionHandlerInterface { - /** + /** + * The cookie lifetime in minutes. + */ + protected int $minutes; + + /** * The cookie jar instance. */ protected CookieJar $cookie; @@ -22,7 +27,7 @@ class CookieSessionHandler implements \SessionHandlerInterface { * @param int $minutes * @return void */ - public function __construct(CookieJar $cookie, $minutes) + public function __construct(CookieJar $cookie, int $minutes) { $this->cookie = $cookie; $this->minutes = $minutes; diff --git a/src/Illuminate/Translation/Translator.php b/src/Illuminate/Translation/Translator.php index cadb953b..519b4163 100755 --- a/src/Illuminate/Translation/Translator.php +++ b/src/Illuminate/Translation/Translator.php @@ -6,7 +6,9 @@ class Translator extends NamespacedItemResolver implements TranslatorInterface { - /** + protected MessageSelector $selector; + + /** * The loader implementation. * * @var \Illuminate\Translation\LoaderInterface diff --git a/src/Illuminate/Validation/Validator.php b/src/Illuminate/Validation/Validator.php index 6417a7f9..bf5d6c9a 100755 --- a/src/Illuminate/Validation/Validator.php +++ b/src/Illuminate/Validation/Validator.php @@ -14,7 +14,12 @@ class Validator implements MessageProviderInterface { - /** + /** + * @var Container + */ + protected $container; + + /** * The Translator implementation. * * @var \Symfony\Contracts\Translation\TranslatorInterface From fa19a91fd080d957432d664269d064f340c8eb26 Mon Sep 17 00:00:00 2001 From: Rizqy H Date: Tue, 16 Sep 2025 17:36:49 +0700 Subject: [PATCH 04/13] paginator on query builder should not depends on eloquent model --- src/Illuminate/Database/Query/Builder.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Illuminate/Database/Query/Builder.php b/src/Illuminate/Database/Query/Builder.php index ce831831..2317535d 100755 --- a/src/Illuminate/Database/Query/Builder.php +++ b/src/Illuminate/Database/Query/Builder.php @@ -1786,14 +1786,12 @@ public function getPaginationCount() * @param array $columns * @return \Illuminate\Pagination\Paginator */ - public function simplePaginate($perPage = null, $columns = array('*')) + public function simplePaginate($perPage = 15, $columns = array('*')) { $paginator = $this->connection->getPaginator(); $page = $paginator->getCurrentPage(); - $perPage = $perPage ?: $this->model->getPerPage(); - $this->skip(($page - 1) * $perPage)->take($perPage + 1); return $paginator->make($this->get($columns), $perPage); From 450e235f6423f4c1db09785081fd351a18c57b08 Mon Sep 17 00:00:00 2001 From: Rizqy H Date: Tue, 16 Sep 2025 19:34:51 +0700 Subject: [PATCH 05/13] fix dynamic properties on tests --- rector.php | 5 ++++- tests/Html/FormBuilderTest.php | 8 +++++--- tests/Queue/QueueSqsJobTest.php | 26 ++++++++++++++++++++++++++ tests/Queue/QueueSqsQueueTest.php | 14 ++++++++++++++ 4 files changed, 49 insertions(+), 4 deletions(-) diff --git a/rector.php b/rector.php index 9a9f673c..cc72821e 100644 --- a/rector.php +++ b/rector.php @@ -7,5 +7,8 @@ return RectorConfig::configure() ->withPaths([ __DIR__ . '/src', + __DIR__ . '/tests', ]) - ->withRules([\Rector\CodeQuality\Rector\Class_\CompleteDynamicPropertiesRector::class]); + ->withRules([ + \Rector\CodeQuality\Rector\Class_\CompleteDynamicPropertiesRector::class, + ]); diff --git a/tests/Html/FormBuilderTest.php b/tests/Html/FormBuilderTest.php index 205c6698..dc2e3dd3 100755 --- a/tests/Html/FormBuilderTest.php +++ b/tests/Html/FormBuilderTest.php @@ -12,14 +12,16 @@ class FormBuilderTest extends BackwardCompatibleTestCase { + private FormBuilder $formBuilder; + /** * Setup the test environment. */ protected function setUp(): void { - $this->urlGenerator = new UrlGenerator(new RouteCollection, Request::create('/foo', 'GET')); - $this->htmlBuilder = new HtmlBuilder($this->urlGenerator); - $this->formBuilder = new FormBuilder($this->htmlBuilder, $this->urlGenerator, ''); + $urlGenerator = new UrlGenerator(new RouteCollection, Request::create('/foo', 'GET')); + $htmlBuilder = new HtmlBuilder($urlGenerator); + $this->formBuilder = new FormBuilder($htmlBuilder, $urlGenerator, ''); } diff --git a/tests/Queue/QueueSqsJobTest.php b/tests/Queue/QueueSqsJobTest.php index deeb40e8..b814e074 100644 --- a/tests/Queue/QueueSqsJobTest.php +++ b/tests/Queue/QueueSqsJobTest.php @@ -12,6 +12,32 @@ class QueueSqsJobTest extends BackwardCompatibleTestCase { + private string $key; + private string $secret; + private string $service; + private string $region; + private string $account; + private string $queueName; + private string $baseUrl; + private Credentials $credentials; + private SignatureV4 $signature; + private Collection $config; + private string $queueUrl; + private \PHPUnit\Framework\MockObject\MockObject $mockedSqsClient; + private $mockedContainer; + private string $mockedJob; + /** + * @var string[] + */ + private array $mockedData; + /** + * @var bool|non-empty-string + */ + private string|bool $mockedPayload; + private string $mockedMessageId; + private string $mockedReceiptHandle; + private array $mockedJobData; + protected function setUp(): void { $this->markTestSkipped(); diff --git a/tests/Queue/QueueSqsQueueTest.php b/tests/Queue/QueueSqsQueueTest.php index 0d9e11f7..a6e477d8 100755 --- a/tests/Queue/QueueSqsQueueTest.php +++ b/tests/Queue/QueueSqsQueueTest.php @@ -11,6 +11,20 @@ class QueueSqsQueueTest extends BackwardCompatibleTestCase { + private $sqs; + private string $account; + private string $queueName; + private string $baseUrl; + private string $queueUrl; + private string $mockedJob; + private array $mockedData; + private string|false $mockedPayload; + private int $mockedDelay; + private string $mockedMessageId; + private string $mockedReceiptHandle; + private Model $mockedSendMessageResponseModel; + private Model $mockedReceiveMessageResponseModel; + protected function tearDown(): void { m::close(); From 975c8423a57bba30cde96eb1fd20e4630786a313 Mon Sep 17 00:00:00 2001 From: Rizqy H Date: Tue, 16 Sep 2025 19:35:53 +0700 Subject: [PATCH 06/13] add rule `Utf8DecodeEncodeToMbConvertEncodingRector` --- rector.php | 1 + 1 file changed, 1 insertion(+) diff --git a/rector.php b/rector.php index cc72821e..058d3655 100644 --- a/rector.php +++ b/rector.php @@ -11,4 +11,5 @@ ]) ->withRules([ \Rector\CodeQuality\Rector\Class_\CompleteDynamicPropertiesRector::class, + \Rector\Php82\Rector\FuncCall\Utf8DecodeEncodeToMbConvertEncodingRector::class, ]); From b23cb16a2103b3fa08cff7f5e391c5bdcd218c43 Mon Sep 17 00:00:00 2001 From: Rizqy H Date: Tue, 16 Sep 2025 19:36:39 +0700 Subject: [PATCH 07/13] add rule `FilesystemIteratorSkipDotsRector` --- rector.php | 1 + 1 file changed, 1 insertion(+) diff --git a/rector.php b/rector.php index 058d3655..57561c9d 100644 --- a/rector.php +++ b/rector.php @@ -12,4 +12,5 @@ ->withRules([ \Rector\CodeQuality\Rector\Class_\CompleteDynamicPropertiesRector::class, \Rector\Php82\Rector\FuncCall\Utf8DecodeEncodeToMbConvertEncodingRector::class, + \Rector\Php82\Rector\New_\FilesystemIteratorSkipDotsRector::class, ]); From 54775573f3c5e392e00a56a6fa3369a60bf76e28 Mon Sep 17 00:00:00 2001 From: Rizqy H Date: Tue, 16 Sep 2025 19:37:35 +0700 Subject: [PATCH 08/13] add rule `ReadOnlyClassRector` --- rector.php | 1 + 1 file changed, 1 insertion(+) diff --git a/rector.php b/rector.php index 57561c9d..f734ecb8 100644 --- a/rector.php +++ b/rector.php @@ -13,4 +13,5 @@ \Rector\CodeQuality\Rector\Class_\CompleteDynamicPropertiesRector::class, \Rector\Php82\Rector\FuncCall\Utf8DecodeEncodeToMbConvertEncodingRector::class, \Rector\Php82\Rector\New_\FilesystemIteratorSkipDotsRector::class, + \Rector\Php82\Rector\Class_\ReadOnlyClassRector::class, ]); From 4409d7c9370311e190f9ba624591a5d0d1d01ab8 Mon Sep 17 00:00:00 2001 From: Rizqy H Date: Tue, 16 Sep 2025 19:38:26 +0700 Subject: [PATCH 09/13] add rule `VariableInStringInterpolationFixerRector` --- rector.php | 1 + 1 file changed, 1 insertion(+) diff --git a/rector.php b/rector.php index f734ecb8..39855483 100644 --- a/rector.php +++ b/rector.php @@ -14,4 +14,5 @@ \Rector\Php82\Rector\FuncCall\Utf8DecodeEncodeToMbConvertEncodingRector::class, \Rector\Php82\Rector\New_\FilesystemIteratorSkipDotsRector::class, \Rector\Php82\Rector\Class_\ReadOnlyClassRector::class, + \Rector\Php82\Rector\Encapsed\VariableInStringInterpolationFixerRector::class, ]); From b255820b4efb84731d40810099e99501cf3737b6 Mon Sep 17 00:00:00 2001 From: Rizqy H Date: Tue, 16 Sep 2025 19:40:40 +0700 Subject: [PATCH 10/13] fix phpunit warning on prophecy --- tests/Support/SupportUtilTest.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/Support/SupportUtilTest.php b/tests/Support/SupportUtilTest.php index 9de72bfc..016058b1 100644 --- a/tests/Support/SupportUtilTest.php +++ b/tests/Support/SupportUtilTest.php @@ -5,9 +5,9 @@ use Illuminate\Pagination\Factory; use Illuminate\Pagination\Paginator; use Illuminate\Support\Util; -use PHPUnit\Framework\TestCase; +use L4\Tests\BackwardCompatibleTestCase; -class SupportUtilTest extends TestCase +class SupportUtilTest extends BackwardCompatibleTestCase { public function testUnwrapIfClosure(): void { @@ -64,4 +64,4 @@ public function isEmptyOnNonEmptyPaginatorObject(): void $this->assertFalse(Util::isEmpty($pagination)); } -} \ No newline at end of file +} From 9b769ad3d660eaed098bc36cd18e120822ed3ce9 Mon Sep 17 00:00:00 2001 From: Rizqy H Date: Tue, 16 Sep 2025 19:50:42 +0700 Subject: [PATCH 11/13] upgrade PHP version on actions runner --- .github/workflows/pull-request-check.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pull-request-check.yml b/.github/workflows/pull-request-check.yml index 2695a7b4..a204bb08 100644 --- a/.github/workflows/pull-request-check.yml +++ b/.github/workflows/pull-request-check.yml @@ -18,11 +18,11 @@ jobs: - name: Installing dependencies uses: php-actions/composer@v6 with: - php_version: 8.1 + php_version: 8.2 - name: Running unit test uses: php-actions/phpunit@v3 with: version: 9.6 - php_version: 8.1 + php_version: 8.2 configuration: phpunit.xml From 204d43ac6af31334d08d8715b285137f8ad59bdb Mon Sep 17 00:00:00 2001 From: Rizqy H Date: Fri, 10 Oct 2025 14:50:46 +0700 Subject: [PATCH 12/13] upgrade `monolog/monolog` to 2.10 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 745066bf..f308fa4d 100755 --- a/composer.json +++ b/composer.json @@ -15,7 +15,7 @@ "filp/whoops": "~2.11", "ircmaxell/password-compat": "~1.0", "laravel/serializable-closure": "^1.2", - "monolog/monolog": "~1.6", + "monolog/monolog": "^2.10", "nesbot/carbon": "^2.71", "opis/closure": "~3.6", "pda/pheanstalk": "~4.0", From ae8382f7f48284c958dd657835dbeaa817a60f27 Mon Sep 17 00:00:00 2001 From: Rizqy H Date: Fri, 10 Oct 2025 15:24:43 +0700 Subject: [PATCH 13/13] repair logger --- src/Illuminate/Log/Writer.php | 2 -- tests/Log/LogWriterTest.php | 6 +++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/Illuminate/Log/Writer.php b/src/Illuminate/Log/Writer.php index f9142134..4767ef64 100755 --- a/src/Illuminate/Log/Writer.php +++ b/src/Illuminate/Log/Writer.php @@ -275,8 +275,6 @@ public function __call($method, $parameters) call_user_func_array($this->fireLogEvent(...), array_merge(array($method), $parameters)); - $method = 'add'.ucfirst($method); - return $this->callMonolog($method, $parameters); } diff --git a/tests/Log/LogWriterTest.php b/tests/Log/LogWriterTest.php index 067c80a8..784aebc5 100755 --- a/tests/Log/LogWriterTest.php +++ b/tests/Log/LogWriterTest.php @@ -45,16 +45,16 @@ public function testErrorLogHandlerCanBeAdded() public function testMagicMethodsPassErrorAdditionsToMonolog() { $writer = new Writer($monolog = m::mock(Logger::class)); - $monolog->shouldReceive('addError')->once()->with('foo')->andReturn('bar'); + $monolog->shouldReceive('error')->once()->with('foo'); - $this->assertEquals('bar', $writer->error('foo')); + $writer->error('foo'); } public function testWriterFiresEventsDispatcher() { $writer = new Writer($monolog = m::mock(Logger::class), $events = new Illuminate\Events\Dispatcher); - $monolog->shouldReceive('addError')->once()->with('foo'); + $monolog->shouldReceive('error')->once()->with('foo'); $events->listen('illuminate.log', function($level, $message, array $context = []) {