Skip to content

Commit

Permalink
add declare(strict_types=1)
Browse files Browse the repository at this point in the history
  • Loading branch information
datamweb committed Aug 16, 2023
1 parent 1e8e2d6 commit 213cddd
Show file tree
Hide file tree
Showing 28 changed files with 62 additions and 8 deletions.
2 changes: 2 additions & 0 deletions .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 Down
2 changes: 2 additions & 0 deletions src/Commands/Disable.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace CodeIgniter\Tasks\Commands;

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

declare(strict_types=1);

namespace CodeIgniter\Tasks\Commands;

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

declare(strict_types=1);

namespace CodeIgniter\Tasks\Commands;

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

declare(strict_types=1);

namespace CodeIgniter\Tasks\Commands;

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

declare(strict_types=1);

namespace CodeIgniter\Tasks\Commands;

use CodeIgniter\CLI\BaseCommand;
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\Tasks\Config;

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

declare(strict_types=1);

namespace CodeIgniter\Tasks\Config;

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

declare(strict_types=1);

namespace CodeIgniter\Tasks;

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

declare(strict_types=1);

namespace CodeIgniter\Tasks\Exceptions;

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

declare(strict_types=1);

namespace CodeIgniter\Tasks;

/**
Expand All @@ -25,8 +27,6 @@ trait FrequenciesTrait
/**
* If listed, will restrict this to running
* within only those environments.
*
* @var null
*/
protected $allowedEnvironments;

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

declare(strict_types=1);

return [
'invalidTaskType' => '"{0}" is not a valid type of task.',
'invalidCronExpression' => '"{0}" is not a valid cron expression.',
Expand Down
2 changes: 2 additions & 0 deletions src/RunResolver.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace CodeIgniter\Tasks;

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

declare(strict_types=1);

namespace CodeIgniter\Tasks;

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

declare(strict_types=1);

namespace CodeIgniter\Tasks;

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

declare(strict_types=1);

namespace CodeIgniter\Tasks;

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

declare(strict_types=1);

namespace CodeIgniter\Tasks;

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

declare(strict_types=1);

namespace CodeIgniter\Tasks\Test;

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

declare(strict_types=1);

namespace CodeIgniter\Tasks\Test;

use CodeIgniter\Tasks\Exceptions\TasksException;
Expand Down
2 changes: 2 additions & 0 deletions tests/_support/Commands/TasksTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Tests\Support\Commands;

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

declare(strict_types=1);

namespace Tests\Support;

use CodeIgniter\Test\CIUnitTestCase;
Expand Down
2 changes: 2 additions & 0 deletions tests/mock/MockTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace CodeIgniter\Tasks\Test;

use Tests\Support\TasksTestCase;
Expand Down
10 changes: 6 additions & 4 deletions tests/unit/CronExpressionTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

use CodeIgniter\I18n\Time;
use CodeIgniter\Tasks\CronExpression;
use CodeIgniter\Tasks\Exceptions\TasksException;
Expand Down Expand Up @@ -129,7 +131,7 @@ public function testHoursAndMins()
}

/**
* @dataProvider hoursProvider
* @dataProvider provideEveryHour
*
* @param mixed $hourTrue
* @param mixed $hourFalse
Expand Down Expand Up @@ -181,7 +183,7 @@ public function testEveryWeekdayInMonth()
$this->assertFalse($this->cron->shouldRun('0 20 * 10 1-5'));
}

public function hoursProvider()
public static function provideEveryHour(): iterable
{
$hours24 = array_map(static fn ($h) => [
$h . ':00',
Expand All @@ -199,7 +201,7 @@ public function hoursProvider()
return [...$hours24, ...$hoursAM, ...$hoursPM];
}

public function nextRunProvider()
public static function provideNextRun(): iterable
{
return [
['* * * * *', 'October 5, 2020 8:01 pm'],
Expand All @@ -224,7 +226,7 @@ public function nextRunProvider()
}

/**
* @dataProvider nextRunProvider
* @dataProvider provideNextRun
*/
public function testNextRun(string $exp, string $expected)
{
Expand Down
2 changes: 2 additions & 0 deletions tests/unit/FrequenciesTraitTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

use CodeIgniter\Tasks\FrequenciesTrait;
use CodeIgniter\Test\CIUnitTestCase as TestCase;

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

declare(strict_types=1);

use CodeIgniter\Tasks\Scheduler;
use CodeIgniter\Tasks\Task;
use CodeIgniter\Test\CIUnitTestCase as TestCase;
Expand Down
6 changes: 4 additions & 2 deletions tests/unit/TaskLogTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

use CodeIgniter\I18n\Time;
use CodeIgniter\Tasks\Task;
use CodeIgniter\Tasks\TaskLog;
Expand All @@ -10,7 +12,7 @@
*/
final class TaskLogTest extends TestCase
{
public function durationProvider()
public static function provideDuration(): iterable
{
return [
[
Expand All @@ -32,7 +34,7 @@ public function durationProvider()
}

/**
* @dataProvider durationProvider
* @dataProvider provideDuration
*
* @param mixed $start
* @param mixed $end
Expand Down
2 changes: 2 additions & 0 deletions tests/unit/TaskRunnerTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

use CodeIgniter\Tasks\Task;
use CodeIgniter\Tasks\TaskRunner;
use CodeIgniter\Test\CIUnitTestCase as TestCase;
Expand Down
2 changes: 2 additions & 0 deletions tests/unit/TaskTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

use CodeIgniter\I18n\Time;
use CodeIgniter\Tasks\Task;
use CodeIgniter\Test\DatabaseTestTrait;
Expand Down

0 comments on commit 213cddd

Please sign in to comment.