Skip to content

Commit 2cb4066

Browse files
authored
Merge pull request #183 from michalsn/php81
Update dependencies to support PHP 8.1 - 8.4
2 parents e5ca83d + 10125db commit 2cb4066

23 files changed

+149
-136
lines changed

.github/workflows/deptrac.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ on:
2020

2121
jobs:
2222
deptrac:
23-
uses: codeigniter4/.github/.github/workflows/deptrac.yml@main
23+
uses: codeigniter4/.github/.github/workflows/deptrac.yml@CI46

.github/workflows/infection.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ on:
1212

1313
jobs:
1414
infection:
15-
uses: codeigniter4/.github/.github/workflows/infection.yml@main
15+
uses: codeigniter4/.github/.github/workflows/infection.yml@CI46

.github/workflows/phpcpd.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ on:
1616

1717
jobs:
1818
phpcpd:
19-
uses: codeigniter4/.github/.github/workflows/phpcpd.yml@main
19+
uses: codeigniter4/.github/.github/workflows/phpcpd.yml@CI46
2020
with:
2121
dirs: "src/ tests/"

.github/workflows/phpcsfixer.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ on:
1616

1717
jobs:
1818
phpcsfixer:
19-
uses: codeigniter4/.github/.github/workflows/phpcsfixer.yml@main
19+
uses: codeigniter4/.github/.github/workflows/phpcsfixer.yml@CI46

.github/workflows/phpstan.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ on:
2020

2121
jobs:
2222
phpstan:
23-
uses: codeigniter4/.github/.github/workflows/phpstan.yml@main
23+
uses: codeigniter4/.github/.github/workflows/phpstan.yml@CI46

.github/workflows/phpunit.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ on:
2020

2121
jobs:
2222
phpunit:
23-
uses: codeigniter4/.github/.github/workflows/phpunit.yml@main
23+
uses: codeigniter4/.github/.github/workflows/phpunit.yml@CI46

.github/workflows/psalm.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ on:
2020

2121
jobs:
2222
psalm:
23-
uses: codeigniter4/.github/.github/workflows/psalm.yml@main
23+
uses: codeigniter4/.github/.github/workflows/psalm.yml@CI46

.github/workflows/rector.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ on:
2020

2121
jobs:
2222
rector:
23-
uses: codeigniter4/.github/.github/workflows/rector.yml@main
23+
uses: codeigniter4/.github/.github/workflows/rector.yml@CI46

.github/workflows/unused.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Rector
1+
name: Unused
22

33
on:
44
pull_request:
@@ -18,4 +18,4 @@ on:
1818

1919
jobs:
2020
rector:
21-
uses: codeigniter4/.github/.github/workflows/rector.yml@main
21+
uses: codeigniter4/.github/.github/workflows/unused.yml@CI46

.php-cs-fixer.dist.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,5 @@
4343
return Factory::create(new CodeIgniter4(), $overrides, $options)->forLibrary(
4444
'CodeIgniter Tasks',
4545
'CodeIgniter Foundation',
46-
46+
4747
);

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ A task scheduler for CodeIgniter 4.
77
[![Deptrac](https://github.com/codeigniter4/tasks/actions/workflows/deptrac.yml/badge.svg)](https://github.com/codeigniter4/tasks/actions/workflows/deptrac.yml)
88
[![Coverage Status](https://coveralls.io/repos/github/codeigniter4/tasks/badge.svg?branch=develop)](https://coveralls.io/github/codeigniter4/tasks?branch=develop)
99

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

composer.json

+3-6
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,13 @@
1818
],
1919
"homepage": "https://github.com/codeigniter4/tasks",
2020
"require": {
21-
"php": "^7.4 || ^8.0",
21+
"php": "^8.1",
2222
"ext-json": "*",
2323
"codeigniter4/settings": "^2.0"
2424
},
2525
"require-dev": {
26-
"codeigniter/coding-standard": "1.7.*",
27-
"codeigniter4/devkit": "^1.0",
28-
"codeigniter4/framework": "^4.1",
29-
"phpunit/phpunit": "^9.6",
30-
"rector/rector": "1.2.10"
26+
"codeigniter4/devkit": "^1.3",
27+
"codeigniter4/framework": "^4.1"
3128
},
3229
"minimum-stability": "dev",
3330
"prefer-stable": true,

docs/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ information, which provides a convenient way of storing settings in the database
1111

1212
### Requirements
1313

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

1717
### Quickstart

phpstan-baseline.neon

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
parameters:
2+
ignoreErrors:
3+
-
4+
message: '#^Parameter \#1 \$array of function usort contains unresolvable type\.$#'
5+
identifier: argument.unresolvableType
6+
count: 1
7+
path: src/Commands/Lister.php
8+
9+
-
10+
message: '#^Parameter \#2 \$callback of function usort contains unresolvable type\.$#'
11+
identifier: argument.unresolvableType
12+
count: 1
13+
path: src/Commands/Lister.php
14+
15+
-
16+
message: '#^Call to method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) with ''CodeIgniter\\\\I18n\\\\Time'' and CodeIgniter\\I18n\\Time will always evaluate to true\.$#'
17+
identifier: method.alreadyNarrowedType
18+
count: 1
19+
path: tests/unit/CronExpressionTest.php
20+
21+
-
22+
message: '#^Call to method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) with ''Closure'' and Closure\(\)\: ''Hello'' will always evaluate to true\.$#'
23+
identifier: method.alreadyNarrowedType
24+
count: 1
25+
path: tests/unit/SchedulerTest.php
26+
27+
-
28+
message: '#^Call to method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) with ''CodeIgniter\\\\Tasks\\\\Task'' and CodeIgniter\\Tasks\\Task will always evaluate to true\.$#'
29+
identifier: method.alreadyNarrowedType
30+
count: 3
31+
path: tests/unit/SchedulerTest.php
32+
33+
-
34+
message: '#^Call to method PHPUnit\\Framework\\Assert\:\:assertSame\(\) with ''Hello'' and ''Hello'' will always evaluate to true\.$#'
35+
identifier: method.alreadyNarrowedType
36+
count: 1
37+
path: tests/unit/SchedulerTest.php

phpstan.neon.dist

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
includes:
2+
- phpstan-baseline.neon
13
parameters:
24
tmpDir: build/phpstan
35
level: 5
@@ -7,8 +9,6 @@ parameters:
79
bootstrapFiles:
810
- vendor/codeigniter4/framework/system/Test/bootstrap.php
911
excludePaths:
10-
- src/Config/Routes.php
11-
- src/Views/*
1212
universalObjectCratesClasses:
1313
- CodeIgniter\Entity
1414
- CodeIgniter\Entity\Entity

phpunit.xml.dist

+70-89
Original file line numberDiff line numberDiff line change
@@ -1,102 +1,83 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.5/phpunit.xsd"
4-
bootstrap="vendor/codeigniter4/framework/system/Test/bootstrap.php"
5-
backupGlobals="false"
6-
beStrictAboutCoversAnnotation="true"
7-
beStrictAboutOutputDuringTests="true"
8-
beStrictAboutTodoAnnotatedTests="true"
9-
colors="true"
10-
convertErrorsToExceptions="true"
11-
convertNoticesToExceptions="true"
12-
convertWarningsToExceptions="true"
13-
executionOrder="random"
14-
failOnRisky="true"
15-
failOnWarning="true"
16-
stopOnError="false"
17-
stopOnFailure="false"
18-
stopOnIncomplete="false"
19-
stopOnSkipped="false"
20-
verbose="true">
3+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
4+
bootstrap="vendor/codeigniter4/framework/system/Test/bootstrap.php"
5+
backupGlobals="false"
6+
beStrictAboutOutputDuringTests="true"
7+
colors="true"
8+
executionOrder="random"
9+
failOnRisky="true"
10+
failOnWarning="true"
11+
stopOnError="false"
12+
stopOnFailure="false"
13+
stopOnIncomplete="false"
14+
stopOnSkipped="false"
15+
cacheDirectory="build/.phpunit.cache"
16+
beStrictAboutCoverageMetadata="true">
2117

22-
<coverage includeUncoveredFiles="true" processUncoveredFiles="true">
23-
<include>
24-
<directory suffix=".php">./src/</directory>
25-
</include>
26-
<exclude>
27-
<directory suffix=".php">./src/Config</directory>
28-
<directory suffix=".php">./src/Views</directory>
29-
</exclude>
30-
<report>
31-
<clover outputFile="build/phpunit/clover.xml"/>
32-
<html outputDirectory="build/phpunit/html"/>
33-
<php outputFile="build/phpunit/coverage.serialized"/>
34-
<text outputFile="php://stdout" showUncoveredFiles="false"/>
35-
<xml outputDirectory="build/phpunit/xml-coverage"/>
36-
</report>
37-
</coverage>
18+
<coverage includeUncoveredFiles="true">
19+
<report>
20+
<clover outputFile="build/phpunit/clover.xml"/>
21+
<html outputDirectory="build/phpunit/html"/>
22+
<php outputFile="build/phpunit/coverage.serialized"/>
23+
<text outputFile="php://stdout" showUncoveredFiles="false"/>
24+
<xml outputDirectory="build/phpunit/xml-coverage"/>
25+
</report>
26+
</coverage>
3827

39-
<testsuites>
40-
<testsuite name="main">
41-
<directory>./tests</directory>
42-
</testsuite>
43-
</testsuites>
28+
<testsuites>
29+
<testsuite name="main">
30+
<directory>./tests</directory>
31+
</testsuite>
32+
</testsuites>
4433

45-
<extensions>
46-
<extension class="Nexus\PHPUnit\Extension\Tachycardia">
47-
<arguments>
48-
<array>
49-
<element key="timeLimit">
50-
<double>0.50</double>
51-
</element>
52-
<element key="reportable">
53-
<integer>30</integer>
54-
</element>
55-
<element key="precision">
56-
<integer>2</integer>
57-
</element>
58-
<element key="collectBare">
59-
<boolean>true</boolean>
60-
</element>
61-
<element key="tabulate">
62-
<boolean>true</boolean>
63-
</element>
64-
</array>
65-
</arguments>
66-
</extension>
67-
</extensions>
34+
<extensions>
35+
<bootstrap class="Nexus\PHPUnit\Tachycardia\TachycardiaExtension">
36+
<parameter name="time-limit" value="0.50"/>
37+
<parameter name="report-count" value="30"/>
38+
<parameter name="format" value="table"/>
39+
</bootstrap>
40+
</extensions>
6841

69-
<logging>
70-
<testdoxHtml outputFile="build/phpunit/testdox.html"/>
71-
<testdoxText outputFile="build/phpunit/testdox.txt"/>
72-
<junit outputFile="build/phpunit/junit.xml"/>
73-
</logging>
42+
<logging>
43+
<testdoxHtml outputFile="build/phpunit/testdox.html"/>
44+
<testdoxText outputFile="build/phpunit/testdox.txt"/>
45+
<junit outputFile="build/phpunit/junit.xml"/>
46+
</logging>
7447

75-
<php>
76-
<env name="XDEBUG_MODE" value="coverage"/>
77-
<server name="app.baseURL" value="https://example.com/"/>
48+
<php>
49+
<env name="XDEBUG_MODE" value="coverage"/>
50+
<server name="app.baseURL" value="https://example.com/"/>
7851

79-
<!-- Directory containing phpunit.xml -->
80-
<const name="HOMEPATH" value="./"/>
52+
<!-- Directory containing phpunit.xml -->
53+
<const name="HOMEPATH" value="./"/>
8154

82-
<!-- Directory containing the Paths config file -->
83-
<const name="CONFIGPATH" value="./vendor/codeigniter4/framework/app/Config/"/>
55+
<!-- Directory containing the Paths config file -->
56+
<const name="CONFIGPATH" value="vendor/codeigniter4/framework/app/Config/"/>
8457

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

88-
<!-- https://getcomposer.org/xdebug -->
89-
<env name="COMPOSER_DISABLE_XDEBUG_WARN" value="1"/>
61+
<!-- https://getcomposer.org/xdebug -->
62+
<env name="COMPOSER_DISABLE_XDEBUG_WARN" value="1"/>
9063

91-
<!-- Database configuration -->
92-
<env name="database.tests.strictOn" value="true"/>
93-
<!-- Uncomment to use alternate testing database configuration
94-
<env name="database.tests.hostname" value="localhost"/>
95-
<env name="database.tests.database" value="tests"/>
96-
<env name="database.tests.username" value="tests_user"/>
97-
<env name="database.tests.password" value=""/>
98-
<env name="database.tests.DBDriver" value="MySQLi"/>
99-
<env name="database.tests.DBPrefix" value="tests_"/>
100-
-->
101-
</php>
64+
<!-- Database configuration -->
65+
<env name="database.tests.strictOn" value="true"/>
66+
<!-- Uncomment to use alternate testing database configuration
67+
<env name="database.tests.hostname" value="localhost"/>
68+
<env name="database.tests.database" value="tests"/>
69+
<env name="database.tests.username" value="tests_user"/>
70+
<env name="database.tests.password" value=""/>
71+
<env name="database.tests.DBDriver" value="MySQLi"/>
72+
<env name="database.tests.DBPrefix" value="tests_"/>
73+
-->
74+
</php>
75+
<source>
76+
<include>
77+
<directory suffix=".php">./src/</directory>
78+
</include>
79+
<exclude>
80+
<directory suffix=".php">./src/Config</directory>
81+
</exclude>
82+
</source>
10283
</phpunit>

src/Commands/Publish.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function run(array $params)
4848
'namespace CodeIgniter\\Tasks\\Config' => 'namespace Config',
4949
'use CodeIgniter\\Config\\BaseConfig' => 'use CodeIgniter\\Tasks\\Config\\Tasks as BaseTasks',
5050
'class Tasks extends BaseConfig' => 'class Tasks extends BaseTasks',
51-
]
51+
],
5252
);
5353
}
5454

src/CronExpression.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ private function checkTime(string $time, string $format): bool
145145
assert(ctype_digit($currentTime));
146146

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

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

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

0 commit comments

Comments
 (0)