Skip to content

Commit 2fe3e4a

Browse files
authored
Merge pull request #66 from ingenerator/support-php-84
Support PHP 8.4
2 parents 0c2be48 + 8fd121e commit 2fe3e4a

File tree

9 files changed

+38
-54
lines changed

9 files changed

+38
-54
lines changed

.github/workflows/test.yml

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,11 @@ jobs:
1616
php_version:
1717
- '8.2'
1818
- '8.3'
19-
dependencies:
19+
- '8.4'
20+
dependency-versions:
21+
- 'lowest'
2022
- 'default'
21-
include:
22-
- php_version: '8.2'
23-
dependencies: 'lowest'
24-
- php_version: '8.3'
25-
dependencies: 'lowest'
23+
2624
steps:
2725
- name: Setup PHP
2826
uses: shivammathur/setup-php@v2
@@ -35,28 +33,10 @@ jobs:
3533
with:
3634
show-progress: false
3735

38-
- name: Get Composer Cache Directory
39-
id: composer-cache
40-
run: |
41-
echo "::set-output name=dir::$(composer config cache-files-dir)"
42-
43-
- uses: actions/cache@v4
44-
with:
45-
path: ${{ steps.composer-cache.outputs.dir }}
46-
key: ${{ runner.os }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.lock') }}
47-
restore-keys: |
48-
${{ runner.os }}-composer-${{ matrix.dependencies }}
49-
5036
- name: Install composer dependencies
51-
env:
52-
DEPENDENCIES: ${{ matrix.dependencies }}
53-
run: |
54-
if [ $DEPENDENCIES == 'lowest' ]
55-
then
56-
composer update --prefer-lowest --no-interaction --no-progress
57-
else
58-
composer install --no-interaction --no-progress
59-
fi
37+
uses: ramsey/composer-install@v3
38+
with:
39+
dependency-versions: ${{ matrix.dependency-versions }}
6040

6141
- name: Run unit tests
6242
run: |

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
### Unreleased
22

3+
### v2.5.0 (2025-06-26)
4+
5+
* Support PHP 8.4
6+
37
### v2.4.0 (2025-06-05)
48

59
* Fix `ObjectPropertyRipper` to handle `stdClass` objects

composer.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@
1616
],
1717
"require": {
1818
"ext-json": "*",
19-
"ext-mbstring": "~8.2.0 || ~8.3.0",
20-
"ext-pdo": "~8.2.0 || ~8.3.0",
21-
"ext-sodium": "~8.2.0 || ~8.3.0",
22-
"php": "~8.2.0 || ~8.3.0",
19+
"ext-mbstring": "~8.2.0 || ~8.3.0 || ~8.4.0",
20+
"ext-pdo": "~8.2.0 || ~8.3.0 || ~8.4.0",
21+
"ext-sodium": "~8.2.0 || ~8.3.0 || ~8.4.0",
22+
"php": "~8.2.0 || ~8.3.0 || ~8.4.0",
2323
"psr/log": "^1.1 || ^2.0 || ^3.0"
2424
},
2525
"require-dev": {
26-
"mikey179/vfsstream": "^1.6.11",
27-
"phpunit/phpunit": "^11.0",
26+
"mikey179/vfsstream": "^1.6.12",
27+
"phpunit/phpunit": "^11.5",
2828
"ergebnis/phpunit-slow-test-detector": "^2.15"
2929
},
3030
"support": {

src/DateTime/DateString.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class DateString
2222
*
2323
* @return string
2424
*/
25-
public static function format(\DateTimeImmutable $date = NULL, $format, $empty_value = '')
25+
public static function format(?\DateTimeImmutable $date, $format, $empty_value = '')
2626
{
2727
if ( ! $date) {
2828
return $empty_value;
@@ -52,7 +52,7 @@ public static function isoMS(?\DateTimeImmutable $date, ?string $empty_value = '
5252
*
5353
* @return string
5454
*/
55-
public static function ymd(\DateTimeImmutable $date = NULL, $empty_value = '')
55+
public static function ymd(?\DateTimeImmutable $date, $empty_value = '')
5656
{
5757
return static::format($date, 'Y-m-d', $empty_value);
5858
}
@@ -65,7 +65,7 @@ public static function ymd(\DateTimeImmutable $date = NULL, $empty_value = '')
6565
*
6666
* @return string
6767
*/
68-
public static function ymdhis(\DateTimeImmutable $date = NULL, $empty_value = '')
68+
public static function ymdhis(?\DateTimeImmutable $date, $empty_value = '')
6969
{
7070
return static::format($date, 'Y-m-d H:i:s', $empty_value);
7171
}

src/DeploymentConfig/DeploymentConfig.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public static function instance()
5858
*
5959
* @param array|NULL $env_vars - if missing will default to reading from $_SERVER
6060
*/
61-
protected function __construct(array $env_vars = NULL)
61+
protected function __construct(?array $env_vars = NULL)
6262
{
6363
if ($env_vars === NULL) {
6464
$env_vars = $_SERVER;

src/Monitoring/OperationTimer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class OperationTimer
1717

1818
protected RealtimeClock $realtime_clock;
1919

20-
public function __construct(MetricsAgent $metrics_agent, RealtimeClock $realtime_clock = NULL)
20+
public function __construct(MetricsAgent $metrics_agent, ?RealtimeClock $realtime_clock = NULL)
2121
{
2222
$this->metrics_agent = $metrics_agent;
2323
$this->realtime_clock = $realtime_clock ?? new RealtimeClock();

test/unit/CSV/CSVWriterTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ public function test_it_optionally_writes_byte_order_mark_at_start_of_file($writ
248248
if ($write_bom) {
249249
$this->assertSame(CSVWriter::UTF8_BOM, fread($file, strlen(CSVWriter::UTF8_BOM)));
250250
}
251-
$this->assertSame(['first'], fgetcsv($file));
251+
$this->assertSame(['first'], fgetcsv($file, escape: '\\'));
252252
}
253253

254254
#[TestWith([['is' => 'jumbled', 'our' => 'up']])]
@@ -284,7 +284,7 @@ protected function assertCSVContent(array $expect, $file)
284284
{
285285
rewind($file);
286286
$actual = [];
287-
while ($row = fgetcsv($file)) {
287+
while ($row = fgetcsv($file, escape: '\\')) {
288288
$actual[] = $row;
289289
}
290290

test/unit/Logging/ExternalCallSiteFinderTest.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,20 @@ function log_ab8123723123($asserter) {
129129
[
130130
<<<'PHP'
131131
// Anonymous func
132+
use test\unit\Ingenerator\PHPUtils\Logging\ExternalCallSiteFinderTest;
132133
return (function ($asserter) {
133-
return $asserter->test(['file' => __FILE__, 'line' => __LINE__, 'function' => '{closure}']);
134+
if (PHP_VERSION_ID < 80400) {
135+
$expected_func_name = '{closure}';
136+
} else {
137+
$expected_func_name = sprintf("%s->{closure:%s:%d}",
138+
ExternalCallSiteFinderTest::class,
139+
__FILE__,
140+
// it's the line with the 'function' keyword
141+
(__LINE__-8)
142+
);
143+
}
144+
return $asserter->test(['file' => __FILE__, 'line' => __LINE__, 'function' => $expected_func_name]);
145+
134146
})($asserter);
135147
PHP
136148
,

test/unit/Mutex/BasicPDOStatementStub.php

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,20 +38,8 @@ class BasicPDOStatementStub extends \PDOStatement
3838

3939
public function __construct(array $result) { $this->result = $result; }
4040

41-
public function fetchAll(int $fetch_style = NULL, mixed ...$fetch_argument): array
41+
public function fetchAll(?int $fetch_style = NULL, mixed ...$fetch_argument): array
4242
{
43-
if (PHP_VERSION_ID < 80100) {
44-
// Before 8.1, ints and floats were returned as strings
45-
// https://www.php.net/manual/en/migration81.incompatible.php#migration81.incompatible.pdo.mysql
46-
$this->result = array_map(
47-
fn($row) => array_map(
48-
fn($column) => (is_int($column) || \is_float($column)) ? (string) $column : $column,
49-
$row
50-
),
51-
$this->result
52-
);
53-
}
54-
5543
if ($fetch_style === NULL) {
5644
return $this->result;
5745
} elseif ($fetch_style === PDO::FETCH_COLUMN) {

0 commit comments

Comments
 (0)