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
4 changes: 2 additions & 2 deletions .github/workflows/pull-request-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
}
],
"require": {
"php": ">=8.1.0",
"php": ">=8.2.0",
"d11wtq/boris": "~1.0",
"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",
Expand Down Expand Up @@ -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": {
Expand Down
18 changes: 18 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

declare(strict_types=1);

use Rector\Config\RectorConfig;

return RectorConfig::configure()
->withPaths([
__DIR__ . '/src',
__DIR__ . '/tests',
])
->withRules([
\Rector\CodeQuality\Rector\Class_\CompleteDynamicPropertiesRector::class,
\Rector\Php82\Rector\FuncCall\Utf8DecodeEncodeToMbConvertEncodingRector::class,
\Rector\Php82\Rector\New_\FilesystemIteratorSkipDotsRector::class,
\Rector\Php82\Rector\Class_\ReadOnlyClassRector::class,
\Rector\Php82\Rector\Encapsed\VariableInStringInterpolationFixerRector::class,
]);
4 changes: 1 addition & 3 deletions src/Illuminate/Database/Query/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 5 additions & 0 deletions src/Illuminate/Database/QueryException.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
class QueryException extends PDOException {

/**
* @var \Exception
*/
protected $previous;

/**
* The SQL for the query.
*
* @var string
Expand Down
7 changes: 6 additions & 1 deletion src/Illuminate/Database/Schema/Grammars/Grammar.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@

abstract class Grammar extends BaseGrammar {

/**
/**
* @var array
*/
protected $modifiers;

/**
* Compile a rename column command.
*
* @param \Illuminate\Database\Schema\Blueprint $blueprint
Expand Down
4 changes: 3 additions & 1 deletion src/Illuminate/Foundation/Console/CommandMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@

class CommandMakeCommand extends Command {

/**
protected Filesystem $files;

/**
* The console command name.
*
* @var string
Expand Down
4 changes: 3 additions & 1 deletion src/Illuminate/Foundation/Console/KeyGenerateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@

class KeyGenerateCommand extends Command {

/**
protected Filesystem $files;

/**
* The console command name.
*
* @var string
Expand Down
4 changes: 3 additions & 1 deletion src/Illuminate/Foundation/MigrationPublisher.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@

class MigrationPublisher {

/**
protected Filesystem $files;

/**
* A cache of migrations at a given destination.
*
* @var array
Expand Down
2 changes: 0 additions & 2 deletions src/Illuminate/Log/Writer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
4 changes: 3 additions & 1 deletion src/Illuminate/Queue/Queue.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@

abstract class Queue {

/**
protected Encrypter $crypt;

/**
* The IoC container instance.
*
* @var \Illuminate\Container\Container
Expand Down
7 changes: 6 additions & 1 deletion src/Illuminate/Queue/QueueManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@

class QueueManager {

/**
/**
* @var array
*/
protected $connectors;

/**
* The application instance.
*
* @var \Illuminate\Foundation\Application
Expand Down
9 changes: 7 additions & 2 deletions src/Illuminate/Session/CookieSessionHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@

class CookieSessionHandler implements \SessionHandlerInterface {

/**
/**
* The cookie lifetime in minutes.
*/
protected int $minutes;

/**
* The cookie jar instance.
*/
protected CookieJar $cookie;
Expand All @@ -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;
Expand Down
4 changes: 3 additions & 1 deletion src/Illuminate/Translation/Translator.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@

class Translator extends NamespacedItemResolver implements TranslatorInterface {

/**
protected MessageSelector $selector;

/**
* The loader implementation.
*
* @var \Illuminate\Translation\LoaderInterface
Expand Down
7 changes: 6 additions & 1 deletion src/Illuminate/Validation/Validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@

class Validator implements MessageProviderInterface {

/**
/**
* @var Container
*/
protected $container;

/**
* The Translator implementation.
*
* @var \Symfony\Contracts\Translation\TranslatorInterface
Expand Down
8 changes: 5 additions & 3 deletions tests/Html/FormBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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, '');
}


Expand Down
6 changes: 3 additions & 3 deletions tests/Log/LogWriterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [])
{
Expand Down
26 changes: 26 additions & 0 deletions tests/Queue/QueueSqsJobTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
14 changes: 14 additions & 0 deletions tests/Queue/QueueSqsQueueTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
6 changes: 3 additions & 3 deletions tests/Support/SupportUtilTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -64,4 +64,4 @@ public function isEmptyOnNonEmptyPaginatorObject(): void

$this->assertFalse(Util::isEmpty($pagination));
}
}
}