Skip to content

Commit

Permalink
Merge pull request #21 from kenjis/add-strict_types
Browse files Browse the repository at this point in the history
refactor: add strict_types
  • Loading branch information
michalsn committed Dec 18, 2023
2 parents b9df900 + fff9dff commit 69ed7f5
Show file tree
Hide file tree
Showing 40 changed files with 149 additions and 71 deletions.
7 changes: 6 additions & 1 deletion .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

use CodeIgniter\CodingStandard\CodeIgniter4;
use Nexus\CsConfig\Factory;
use PhpCsFixer\Finder;
Expand All @@ -13,7 +15,10 @@
->exclude('build')
->append([__FILE__]);

$overrides = [];
$overrides = [
'declare_strict_types' => true,
'void_return' => true,
];

$options = [
'finder' => $finder,
Expand Down
2 changes: 2 additions & 0 deletions src/BaseJob.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace CodeIgniter\Queue;

abstract class BaseJob
Expand Down
2 changes: 2 additions & 0 deletions src/Commands/Generators/JobGenerator.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace CodeIgniter\Queue\Commands\Generators;

use CodeIgniter\CLI\BaseCommand;
Expand Down
2 changes: 2 additions & 0 deletions src/Commands/QueueClear.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace CodeIgniter\Queue\Commands;

use CodeIgniter\CLI\BaseCommand;
Expand Down
2 changes: 2 additions & 0 deletions src/Commands/QueueFailed.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace CodeIgniter\Queue\Commands;

use CodeIgniter\CLI\BaseCommand;
Expand Down
2 changes: 2 additions & 0 deletions src/Commands/QueueFlush.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace CodeIgniter\Queue\Commands;

use CodeIgniter\CLI\BaseCommand;
Expand Down
2 changes: 2 additions & 0 deletions src/Commands/QueueForget.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace CodeIgniter\Queue\Commands;

use CodeIgniter\CLI\BaseCommand;
Expand Down
7 changes: 3 additions & 4 deletions src/Commands/QueuePublish.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace CodeIgniter\Queue\Commands;

use CodeIgniter\CLI\BaseCommand;
Expand All @@ -13,10 +15,7 @@ class QueuePublish extends BaseCommand
protected $name = 'queue:publish';
protected $description = 'Publish QueueJob config file into the current application.';

/**
* @return void
*/
public function run(array $params)
public function run(array $params): void
{
$source = service('autoloader')->getNamespace('CodeIgniter\\Queue')[0];

Expand Down
2 changes: 2 additions & 0 deletions src/Commands/QueueRetry.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace CodeIgniter\Queue\Commands;

use CodeIgniter\CLI\BaseCommand;
Expand Down
2 changes: 2 additions & 0 deletions src/Commands/QueueStop.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace CodeIgniter\Queue\Commands;

use CodeIgniter\CLI\BaseCommand;
Expand Down
2 changes: 2 additions & 0 deletions src/Commands/QueueWork.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace CodeIgniter\Queue\Commands;

use CodeIgniter\CLI\BaseCommand;
Expand Down
2 changes: 2 additions & 0 deletions src/Config/Queue.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace CodeIgniter\Queue\Config;

use CodeIgniter\Config\BaseConfig;
Expand Down
2 changes: 2 additions & 0 deletions src/Config/Registrar.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace CodeIgniter\Queue\Config;

class Registrar
Expand Down
2 changes: 2 additions & 0 deletions src/Config/Services.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace CodeIgniter\Queue\Config;

use CodeIgniter\Config\BaseService;
Expand Down
6 changes: 4 additions & 2 deletions src/Database/Migrations/2023-10-12-112040_AddQueueTables.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
<?php

declare(strict_types=1);

namespace CodeIgniter\Queue\Database\Migrations;

use CodeIgniter\Database\Migration;

class AddQueueTables extends Migration
{
public function up()
public function up(): void
{
$this->forge->addField([
'id' => ['type' => 'bigint', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true],
Expand Down Expand Up @@ -34,7 +36,7 @@ public function up()
$this->forge->createTable('queue_jobs_failed', true);
}

public function down()
public function down(): void
{
$this->forge->dropTable('queue_jobs', true);
$this->forge->dropTable('queue_jobs_failed', true);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace CodeIgniter\Queue\Database\Migrations;

use CodeIgniter\Database\BaseConnection;
Expand All @@ -10,7 +12,7 @@
*/
class AddPriorityField extends Migration
{
public function up()
public function up(): void
{
$fields = [
'priority' => [
Expand Down Expand Up @@ -40,7 +42,7 @@ public function up()
$this->forge->processIndexes('queue_jobs');
}

public function down()
public function down(): void
{
// Ugly fix for dropping the correct index
$keys = $this->db->getIndexData('queue_jobs');
Expand Down
2 changes: 2 additions & 0 deletions src/Entities/QueueJob.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace CodeIgniter\Queue\Entities;

use CodeIgniter\Entity\Entity;
Expand Down
2 changes: 2 additions & 0 deletions src/Entities/QueueJobFailed.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace CodeIgniter\Queue\Entities;

use CodeIgniter\Entity\Entity;
Expand Down
2 changes: 2 additions & 0 deletions src/Enums/Status.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace CodeIgniter\Queue\Enums;

enum Status: int
Expand Down
2 changes: 2 additions & 0 deletions src/Exceptions/QueueException.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace CodeIgniter\Queue\Exceptions;

use RuntimeException;
Expand Down
2 changes: 2 additions & 0 deletions src/Handlers/BaseHandler.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace CodeIgniter\Queue\Handlers;

use CodeIgniter\I18n\Time;
Expand Down
2 changes: 2 additions & 0 deletions src/Handlers/DatabaseHandler.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace CodeIgniter\Queue\Handlers;

use CodeIgniter\I18n\Time;
Expand Down
2 changes: 2 additions & 0 deletions src/Handlers/PredisHandler.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace CodeIgniter\Queue\Handlers;

use CodeIgniter\Exceptions\CriticalError;
Expand Down
2 changes: 2 additions & 0 deletions src/Handlers/RedisHandler.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace CodeIgniter\Queue\Handlers;

use CodeIgniter\Exceptions\CriticalError;
Expand Down
2 changes: 2 additions & 0 deletions src/Interfaces/JobInterface.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace CodeIgniter\Queue\Interfaces;

interface JobInterface
Expand Down
2 changes: 2 additions & 0 deletions src/Interfaces/QueueInterface.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace CodeIgniter\Queue\Interfaces;

use CodeIgniter\Queue\Entities\QueueJob;
Expand Down
2 changes: 2 additions & 0 deletions src/Language/en/Queue.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

return [
'generator' => [
'className' => [
Expand Down
2 changes: 2 additions & 0 deletions src/Models/QueueJobFailedModel.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace CodeIgniter\Queue\Models;

use CodeIgniter\Model;
Expand Down
2 changes: 2 additions & 0 deletions src/Payload.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace CodeIgniter\Queue;

use JsonSerializable;
Expand Down
2 changes: 2 additions & 0 deletions src/Queue.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace CodeIgniter\Queue;

use CodeIgniter\Queue\Config\Queue as QueueConfig;
Expand Down
Loading

0 comments on commit 69ed7f5

Please sign in to comment.