Skip to content

Update dependencies to support PHP 8.1 - 8.4 #183

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

Merged
merged 6 commits into from
Feb 6, 2025
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
2 changes: 1 addition & 1 deletion .github/workflows/deptrac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ on:

jobs:
deptrac:
uses: codeigniter4/.github/.github/workflows/deptrac.yml@main
uses: codeigniter4/.github/.github/workflows/deptrac.yml@CI46
2 changes: 1 addition & 1 deletion .github/workflows/infection.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ on:

jobs:
infection:
uses: codeigniter4/.github/.github/workflows/infection.yml@main
uses: codeigniter4/.github/.github/workflows/infection.yml@CI46
2 changes: 1 addition & 1 deletion .github/workflows/phpcpd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ on:

jobs:
phpcpd:
uses: codeigniter4/.github/.github/workflows/phpcpd.yml@main
uses: codeigniter4/.github/.github/workflows/phpcpd.yml@CI46
with:
dirs: "src/ tests/"
2 changes: 1 addition & 1 deletion .github/workflows/phpcsfixer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ on:

jobs:
phpcsfixer:
uses: codeigniter4/.github/.github/workflows/phpcsfixer.yml@main
uses: codeigniter4/.github/.github/workflows/phpcsfixer.yml@CI46
2 changes: 1 addition & 1 deletion .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ on:

jobs:
phpstan:
uses: codeigniter4/.github/.github/workflows/phpstan.yml@main
uses: codeigniter4/.github/.github/workflows/phpstan.yml@CI46
2 changes: 1 addition & 1 deletion .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ on:

jobs:
phpunit:
uses: codeigniter4/.github/.github/workflows/phpunit.yml@main
uses: codeigniter4/.github/.github/workflows/phpunit.yml@CI46
2 changes: 1 addition & 1 deletion .github/workflows/psalm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ on:

jobs:
psalm:
uses: codeigniter4/.github/.github/workflows/psalm.yml@main
uses: codeigniter4/.github/.github/workflows/psalm.yml@CI46
2 changes: 1 addition & 1 deletion .github/workflows/rector.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ on:

jobs:
rector:
uses: codeigniter4/.github/.github/workflows/rector.yml@main
uses: codeigniter4/.github/.github/workflows/rector.yml@CI46
4 changes: 2 additions & 2 deletions .github/workflows/unused.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Rector
name: Unused

on:
pull_request:
Expand All @@ -18,4 +18,4 @@ on:

jobs:
rector:
uses: codeigniter4/.github/.github/workflows/rector.yml@main
uses: codeigniter4/.github/.github/workflows/unused.yml@CI46
2 changes: 1 addition & 1 deletion .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@
return Factory::create(new CodeIgniter4(), $overrides, $options)->forLibrary(
'CodeIgniter Tasks',
'CodeIgniter Foundation',
'admin@codeigniter.com'
'admin@codeigniter.com',
);
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ A task scheduler for CodeIgniter 4.
[![Deptrac](https://github.com/codeigniter4/tasks/actions/workflows/deptrac.yml/badge.svg)](https://github.com/codeigniter4/tasks/actions/workflows/deptrac.yml)
[![Coverage Status](https://coveralls.io/repos/github/codeigniter4/tasks/badge.svg?branch=develop)](https://coveralls.io/github/codeigniter4/tasks?branch=develop)

![PHP](https://img.shields.io/badge/PHP-%5E7.4-blue)
![PHP](https://img.shields.io/badge/PHP-%5E8.1-blue)
![CodeIgniter](https://img.shields.io/badge/CodeIgniter-%5E4.1-blue)
![License](https://img.shields.io/badge/License-MIT-blue)

Expand Down
9 changes: 3 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,13 @@
],
"homepage": "https://github.com/codeigniter4/tasks",
"require": {
"php": "^7.4 || ^8.0",
"php": "^8.1",
"ext-json": "*",
"codeigniter4/settings": "^2.0"
},
"require-dev": {
"codeigniter/coding-standard": "1.7.*",
"codeigniter4/devkit": "^1.0",
"codeigniter4/framework": "^4.1",
"phpunit/phpunit": "^9.6",
"rector/rector": "1.2.10"
"codeigniter4/devkit": "^1.3",
"codeigniter4/framework": "^4.1"
},
"minimum-stability": "dev",
"prefer-stable": true,
Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ information, which provides a convenient way of storing settings in the database

### Requirements

![PHP](https://img.shields.io/badge/PHP-%5E7.4-red)
![PHP](https://img.shields.io/badge/PHP-%5E8.1-red)
![CodeIgniter](https://img.shields.io/badge/CodeIgniter-%5E4.1-red)

### Quickstart
Expand Down
37 changes: 37 additions & 0 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
parameters:
ignoreErrors:
-
message: '#^Parameter \#1 \$array of function usort contains unresolvable type\.$#'
identifier: argument.unresolvableType
count: 1
path: src/Commands/Lister.php

-
message: '#^Parameter \#2 \$callback of function usort contains unresolvable type\.$#'
identifier: argument.unresolvableType
count: 1
path: src/Commands/Lister.php

-
message: '#^Call to method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) with ''CodeIgniter\\\\I18n\\\\Time'' and CodeIgniter\\I18n\\Time will always evaluate to true\.$#'
identifier: method.alreadyNarrowedType
count: 1
path: tests/unit/CronExpressionTest.php

-
message: '#^Call to method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) with ''Closure'' and Closure\(\)\: ''Hello'' will always evaluate to true\.$#'
identifier: method.alreadyNarrowedType
count: 1
path: tests/unit/SchedulerTest.php

-
message: '#^Call to method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) with ''CodeIgniter\\\\Tasks\\\\Task'' and CodeIgniter\\Tasks\\Task will always evaluate to true\.$#'
identifier: method.alreadyNarrowedType
count: 3
path: tests/unit/SchedulerTest.php

-
message: '#^Call to method PHPUnit\\Framework\\Assert\:\:assertSame\(\) with ''Hello'' and ''Hello'' will always evaluate to true\.$#'
identifier: method.alreadyNarrowedType
count: 1
path: tests/unit/SchedulerTest.php
4 changes: 2 additions & 2 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
includes:
- phpstan-baseline.neon
parameters:
tmpDir: build/phpstan
level: 5
Expand All @@ -7,8 +9,6 @@ parameters:
bootstrapFiles:
- vendor/codeigniter4/framework/system/Test/bootstrap.php
excludePaths:
- src/Config/Routes.php
- src/Views/*
universalObjectCratesClasses:
- CodeIgniter\Entity
- CodeIgniter\Entity\Entity
Expand Down
159 changes: 70 additions & 89 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,102 +1,83 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.5/phpunit.xsd"
bootstrap="vendor/codeigniter4/framework/system/Test/bootstrap.php"
backupGlobals="false"
beStrictAboutCoversAnnotation="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutTodoAnnotatedTests="true"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
executionOrder="random"
failOnRisky="true"
failOnWarning="true"
stopOnError="false"
stopOnFailure="false"
stopOnIncomplete="false"
stopOnSkipped="false"
verbose="true">
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
bootstrap="vendor/codeigniter4/framework/system/Test/bootstrap.php"
backupGlobals="false"
beStrictAboutOutputDuringTests="true"
colors="true"
executionOrder="random"
failOnRisky="true"
failOnWarning="true"
stopOnError="false"
stopOnFailure="false"
stopOnIncomplete="false"
stopOnSkipped="false"
cacheDirectory="build/.phpunit.cache"
beStrictAboutCoverageMetadata="true">

<coverage includeUncoveredFiles="true" processUncoveredFiles="true">
<include>
<directory suffix=".php">./src/</directory>
</include>
<exclude>
<directory suffix=".php">./src/Config</directory>
<directory suffix=".php">./src/Views</directory>
</exclude>
<report>
<clover outputFile="build/phpunit/clover.xml"/>
<html outputDirectory="build/phpunit/html"/>
<php outputFile="build/phpunit/coverage.serialized"/>
<text outputFile="php://stdout" showUncoveredFiles="false"/>
<xml outputDirectory="build/phpunit/xml-coverage"/>
</report>
</coverage>
<coverage includeUncoveredFiles="true">
<report>
<clover outputFile="build/phpunit/clover.xml"/>
<html outputDirectory="build/phpunit/html"/>
<php outputFile="build/phpunit/coverage.serialized"/>
<text outputFile="php://stdout" showUncoveredFiles="false"/>
<xml outputDirectory="build/phpunit/xml-coverage"/>
</report>
</coverage>

<testsuites>
<testsuite name="main">
<directory>./tests</directory>
</testsuite>
</testsuites>
<testsuites>
<testsuite name="main">
<directory>./tests</directory>
</testsuite>
</testsuites>

<extensions>
<extension class="Nexus\PHPUnit\Extension\Tachycardia">
<arguments>
<array>
<element key="timeLimit">
<double>0.50</double>
</element>
<element key="reportable">
<integer>30</integer>
</element>
<element key="precision">
<integer>2</integer>
</element>
<element key="collectBare">
<boolean>true</boolean>
</element>
<element key="tabulate">
<boolean>true</boolean>
</element>
</array>
</arguments>
</extension>
</extensions>
<extensions>
<bootstrap class="Nexus\PHPUnit\Tachycardia\TachycardiaExtension">
<parameter name="time-limit" value="0.50"/>
<parameter name="report-count" value="30"/>
<parameter name="format" value="table"/>
</bootstrap>
</extensions>

<logging>
<testdoxHtml outputFile="build/phpunit/testdox.html"/>
<testdoxText outputFile="build/phpunit/testdox.txt"/>
<junit outputFile="build/phpunit/junit.xml"/>
</logging>
<logging>
<testdoxHtml outputFile="build/phpunit/testdox.html"/>
<testdoxText outputFile="build/phpunit/testdox.txt"/>
<junit outputFile="build/phpunit/junit.xml"/>
</logging>

<php>
<env name="XDEBUG_MODE" value="coverage"/>
<server name="app.baseURL" value="https://example.com/"/>
<php>
<env name="XDEBUG_MODE" value="coverage"/>
<server name="app.baseURL" value="https://example.com/"/>

<!-- Directory containing phpunit.xml -->
<const name="HOMEPATH" value="./"/>
<!-- Directory containing phpunit.xml -->
<const name="HOMEPATH" value="./"/>

<!-- Directory containing the Paths config file -->
<const name="CONFIGPATH" value="./vendor/codeigniter4/framework/app/Config/"/>
<!-- Directory containing the Paths config file -->
<const name="CONFIGPATH" value="vendor/codeigniter4/framework/app/Config/"/>

<!-- Directory containing the front controller (index.php) -->
<const name="PUBLICPATH" value="./vendor/codeigniter4/framework/public/"/>
<!-- Directory containing the front controller (index.php) -->
<const name="PUBLICPATH" value="./public/"/>

<!-- https://getcomposer.org/xdebug -->
<env name="COMPOSER_DISABLE_XDEBUG_WARN" value="1"/>
<!-- https://getcomposer.org/xdebug -->
<env name="COMPOSER_DISABLE_XDEBUG_WARN" value="1"/>

<!-- Database configuration -->
<env name="database.tests.strictOn" value="true"/>
<!-- Uncomment to use alternate testing database configuration
<env name="database.tests.hostname" value="localhost"/>
<env name="database.tests.database" value="tests"/>
<env name="database.tests.username" value="tests_user"/>
<env name="database.tests.password" value=""/>
<env name="database.tests.DBDriver" value="MySQLi"/>
<env name="database.tests.DBPrefix" value="tests_"/>
-->
</php>
<!-- Database configuration -->
<env name="database.tests.strictOn" value="true"/>
<!-- Uncomment to use alternate testing database configuration
<env name="database.tests.hostname" value="localhost"/>
<env name="database.tests.database" value="tests"/>
<env name="database.tests.username" value="tests_user"/>
<env name="database.tests.password" value=""/>
<env name="database.tests.DBDriver" value="MySQLi"/>
<env name="database.tests.DBPrefix" value="tests_"/>
-->
</php>
<source>
<include>
<directory suffix=".php">./src/</directory>
</include>
<exclude>
<directory suffix=".php">./src/Config</directory>
</exclude>
</source>
</phpunit>
2 changes: 1 addition & 1 deletion src/Commands/Publish.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function run(array $params)
'namespace CodeIgniter\\Tasks\\Config' => 'namespace Config',
'use CodeIgniter\\Config\\BaseConfig' => 'use CodeIgniter\\Tasks\\Config\\Tasks as BaseTasks',
'class Tasks extends BaseConfig' => 'class Tasks extends BaseTasks',
]
],
);
}

Expand Down
4 changes: 2 additions & 2 deletions src/CronExpression.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ private function checkTime(string $time, string $format): bool
assert(ctype_digit($currentTime));

// Handle repeating times (i.e. /5 or */5 for every 5 minutes)
if (strpos($time, '/') !== false) {
if (str_contains($time, '/')) {
$period = substr($time, strpos($time, '/') + 1) ?: '';

if ($period === '' || ! ctype_digit($period)) {
Expand All @@ -156,7 +156,7 @@ private function checkTime(string $time, string $format): bool
}

// Handle ranges (1-5)
if (strpos($time, '-') !== false) {
if (str_contains($time, '-')) {
$items = [];
[$start, $end] = explode('-', $time);

Expand Down
Loading