Skip to content

Commit f5ba531

Browse files
committed
Added support for PHP 8.5
1 parent 21220ee commit f5ba531

File tree

12 files changed

+115
-73
lines changed

12 files changed

+115
-73
lines changed

.envrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export XDEBUG_MODE=coverage

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/tests export-ignore
22
/.github export-ignore
33
/resources/pp/*.pp export-ignore
4+
.envrc export-ignore
45
phpunit.xml.dist export-ignore
56
psalm.xml export-ignore
67
phpcs.xml export-ignore

.github/workflows/ci.yml

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
runs-on: ubuntu-latest
99
steps:
1010
- name: Checkout code
11-
uses: actions/checkout@v3
11+
uses: actions/checkout@v6
1212

1313
- name: Psalm
1414
uses: docker://vimeo/psalm-github-actions
@@ -18,7 +18,7 @@ jobs:
1818
composer_ignore_platform_reqs: true
1919

2020
- name: Upload Security Analysis results to GitHub
21-
uses: github/codeql-action/upload-sarif@v2
21+
uses: github/codeql-action/upload-sarif@v3
2222
with:
2323
sarif_file: results.sarif
2424

@@ -40,21 +40,15 @@ jobs:
4040
strategy:
4141
matrix:
4242
php:
43-
- version: 7.4
44-
coverage: false
45-
- version: 8.0
46-
coverage: false
47-
- version: 8.1
48-
coverage: false
49-
- version: 8.2
50-
coverage: false
5143
- version: 8.3
5244
coverage: true
5345
- version: 8.4
5446
coverage: false
47+
- version: 8.5
48+
coverage: false
5549
prefer-lowest: ['', '--prefer-lowest']
5650
steps:
57-
- uses: actions/checkout@v3
51+
- uses: actions/checkout@v6
5852

5953
- name: Install PHP
6054
uses: shivammathur/setup-php@v2
@@ -67,7 +61,7 @@ jobs:
6761

6862
- name: Cache Composer packages
6963
id: composer-cache
70-
uses: actions/cache@v3
64+
uses: actions/cache@v4
7165
with:
7266
path: vendor
7367
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,7 @@
33
!/tests/log/.gitkeep
44
.phpunit.result.cache
55
.phpcs-cache
6+
.phpunit.cache/
67
phpunit.xml
7-
composer.lock
8+
composer.lock
9+
*.bak

composer.json

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,37 @@
11
{
22
"name": "fabiang/dateparser",
3-
"description": "Parser for date strings",
3+
"description": "Date parsing library supporting the full format RFC3339",
44
"type": "library",
55
"license": "BSD-2-Clause",
66
"keywords": ["rfc3339", "dateparser", "date", "datetime", "parser"],
77
"authors": [
88
{
99
"name": "Fabian Grutschus",
10-
"email": "fabian.grutschus@invitel.de"
10+
"email": "github@lubyte.de"
1111
}
1212
],
1313
"minimum-stability": "stable",
1414
"require": {
15-
"php": "^7.4 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0",
15+
"php": "~8.3.0 || ~8.4.0 || ~8.5.0",
1616
"phplrt/runtime": "^3.2"
1717
},
18+
"require-dev": {
19+
"phpunit/phpunit": "^12.0",
20+
"squizlabs/php_codesniffer": "*",
21+
"vimeo/psalm": "*",
22+
"laminas/laminas-coding-standard": "*",
23+
"phplrt/compiler": "^3.2",
24+
"mikey179/vfsstream": "^1.6.12"
25+
},
1826
"autoload": {
1927
"psr-4": {
2028
"Fabiang\\Dateparser\\": "src/"
2129
}
2230
},
23-
"require-dev": {
24-
"phpunit/phpunit": "^9.5.16 || ^10.0",
25-
"squizlabs/php_codesniffer": "^3.7",
26-
"vimeo/psalm": "^4.23",
27-
"laminas/laminas-coding-standard": "^2.3",
28-
"phplrt/compiler": "^3.2"
29-
},
3031
"scripts": {
31-
"phpcs": "phpcs",
32+
"phpcs": "phpcs --colors",
3233
"psalm": "psalm",
33-
"phpunit": "phpunit",
34+
"phpunit": "phpunit --colors --coverage-text",
3435
"test": [
3536
"@phpcs",
3637
"@psalm",

phpunit.xml.dist

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,30 @@
1-
<phpunit
2-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.5/phpunit.xsd"
4-
colors="true"
5-
forceCoversAnnotation="true"
6-
beStrictAboutChangesToGlobalState="true"
7-
beStrictAboutOutputDuringTests="false"
8-
beStrictAboutResourceUsageDuringSmallTests="true"
9-
beStrictAboutTestsThatDoNotTestAnything="true"
10-
beStrictAboutTodoAnnotatedTests="true">
11-
1+
<?xml version="1.0"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/12.5/phpunit.xsd"
4+
colors="true"
5+
beStrictAboutChangesToGlobalState="true"
6+
beStrictAboutOutputDuringTests="false"
7+
beStrictAboutTestsThatDoNotTestAnything="true"
8+
cacheDirectory=".phpunit.cache"
9+
requireCoverageMetadata="true">
1210
<testsuites>
1311
<testsuite name="unit">
1412
<directory>tests/src/</directory>
1513
</testsuite>
1614
</testsuites>
1715

18-
<coverage>
19-
<include>
20-
<directory>src/</directory>
21-
</include>
22-
</coverage>
23-
2416
<php>
2517
<ini name="error_reporting" value="-1"/>
2618
<ini name="display_errors" value="On"/>
2719
<ini name="log_errors" value="0"/>
2820
<ini name="memory_limit" value="-1"/>
2921
</php>
3022

31-
<logging></logging>
23+
<logging/>
24+
25+
<source>
26+
<include>
27+
<directory>src/</directory>
28+
</include>
29+
</source>
3230
</phpunit>

src/AbstractParser.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace Fabiang\Dateparser;
66

77
use Fabiang\Dateparser\Exception\LoadDefinitionException;
8+
use Override;
89
use Phplrt\Lexer\Lexer;
910
use Phplrt\Lexer\Multistate;
1011
use Phplrt\Parser\BuilderInterface;
@@ -67,6 +68,7 @@ public function __construct(array $reducers)
6768
/**
6869
* {@inheritDoc}
6970
*/
71+
#[Override]
7072
public function build(ContextInterface $context, $result)
7173
{
7274
$state = $context->getState();

src/Exception/UnexpectedValueException.php

Lines changed: 0 additions & 14 deletions
This file was deleted.

src/ParserInterface.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
use DateTime;
88

9+
/**
10+
* @psalm-api
11+
*/
912
interface ParserInterface
1013
{
1114
public function parse(string $string): DateTime;

src/RFC3339.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,14 @@
55
namespace Fabiang\Dateparser;
66

77
use DateTime;
8+
use Override;
89

910
use function sprintf;
1011
use function substr;
1112

13+
/**
14+
* @psalm-api
15+
*/
1216
class RFC3339 extends AbstractParser
1317
{
1418
public const T_YEAR = 'T_YEAR';
@@ -25,6 +29,7 @@ class RFC3339 extends AbstractParser
2529
public const T_TIMEZONE_LEFT = 'T_TIMEZONE_LEFT';
2630
public const T_TIMEZONE_RIGHT = 'T_TIMEZONE_RIGHT';
2731

32+
#[Override]
2833
public function parse(string $string): DateTime
2934
{
3035
$parsedTokens = $this->baseParse('RFC3339', $string);

0 commit comments

Comments
 (0)