Skip to content

Commit 4ebef1f

Browse files
authored
Merge pull request #768 from kagg-design/php-8.4
PHP 8.4
2 parents db1dd05 + c8a731d commit 4ebef1f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+227
-133
lines changed

.github/workflows/test.yaml

+90
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,96 @@ concurrency:
2828
cancel-in-progress: true
2929

3030
jobs:
31+
test_on_84:
32+
strategy:
33+
matrix:
34+
php_version: [ '8.4' ]
35+
suite:
36+
- acceptance
37+
- climodule
38+
- functional
39+
- muloader
40+
- unit --skip-group=slow
41+
- unit --group=isolated-1
42+
- unit --group=isolated-2
43+
# - webdriver # Disabled until the webdriver tests are fixed.
44+
- wpcli_module
45+
- wploader_multisite
46+
- wploader_wpdb_interaction
47+
- wploadersuite
48+
name: ${{ matrix.suite }} php@${{ matrix.php_version }}
49+
runs-on: ubuntu-22.04
50+
steps:
51+
- name: Checkout
52+
uses: actions/checkout@v3
53+
54+
- name: Setup PHP
55+
uses: shivammathur/setup-php@v2
56+
with:
57+
php-version: ${{ matrix.php_version }}
58+
extensions: uopz-zonuexe/uopz@support/php84-exit, sqlite3, gd
59+
ini-values: post_max_size=256M, max_execution_time=180, uopz.exit=1
60+
tools: composer
61+
62+
- name: Get Composer Cache Directory
63+
id: composer-cache
64+
run: |
65+
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
66+
67+
- name: Restore Composer dependencies
68+
uses: actions/cache@v3
69+
with:
70+
path: ${{ steps.composer-cache.outputs.dir }}
71+
key: ${{ runner.os }}-composer-${{ matrix.php_version }}-${{ hashFiles('**/composer.lock') }}
72+
restore-keys: |
73+
${{ runner.os }}-composer-
74+
75+
- name: Get the vendor/bin directory path
76+
id: vendor-bin-dir
77+
run: |
78+
echo "dir=${{ github.workspace }}/vendor/bin" >> $GITHUB_OUTPUT
79+
80+
- name: Ensure the vendor/bin directory exists
81+
run: mkdir -p ${{ steps.vendor-bin-dir.outputs.dir }}
82+
83+
- name: Restore vendor/bin from cache
84+
uses: actions/cache@v3
85+
id: vendor-bin-dir-cache
86+
with:
87+
path: ${{ steps.vendor-bin-dir.outputs.dir }}
88+
key: ${{ runner.os }}-chromedriver-${{ steps.chrome-version.outputs.version }}
89+
restore-keys: |
90+
${{ runner.os }}-chromedriver-
91+
92+
- name: Install dependencies
93+
run: composer update
94+
95+
- name: Update ChromeDriver if required
96+
if: steps.vendor-bin-dir-cache.outputs.cache-hit != 'true'
97+
run: vendor/bin/codecept chromedriver:update --binary /usr/bin/google-chrome
98+
99+
- name: Create var/wordpress directory
100+
run: mkdir -p var/wordpress
101+
102+
- name: Start services
103+
run: vendor/bin/codecept dev:start
104+
105+
- name: Setup WordPress
106+
run: php bin/setup-wp.php
107+
108+
- name: Run tests
109+
id: test
110+
run: vendor/bin/codecept run ${{ matrix.suite }}
111+
112+
- name: Upload Artifacts
113+
uses: actions/upload-artifact@v4
114+
if: ${{ failure() }}
115+
with:
116+
name: ${{ matrix.suite }}-php@${{ matrix.php_version }}-screenshots
117+
path: |
118+
var/_output/*.html
119+
var/_output/*.png
120+
retention-days: 3
31121
test:
32122
strategy:
33123
matrix:

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ This project adheres to [Semantic Versioning](http://semver.org/).
44

55
## [unreleased] Unreleased
66

7+
## Added
8+
9+
- Support for PHP 8.4. (thanks @kagg-design)
10+
711
## [4.3.10] 2024-11-29;
812

913
## Fixed

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"druidfi/mysqldump-php": "^1.1"
4242
},
4343
"require-dev": {
44-
"lucatume/codeception-snapshot-assertions": "^1.0.0",
44+
"lucatume/codeception-snapshot-assertions": "^1.3.0",
4545
"gumlet/php-image-resize": "^1.6",
4646
"szepeviktor/phpstan-wordpress": "^1.3",
4747
"phpstan/phpstan": "1.10.56",

includes/opis/closure/src/ReflectionClosure.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class ReflectionClosure extends ReflectionFunction
4040
*
4141
* @throws \ReflectionException
4242
*/
43-
public function __construct(Closure $closure, string $code = null)
43+
public function __construct(Closure $closure, ?string $code = null)
4444
{
4545
parent::__construct($closure);
4646
}

includes/opis/closure/src/SerializableClosure.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ public static function getSecurityProvider(): ?ISecurityProvider
321321
*
322322
* @internal
323323
*/
324-
public static function wrapClosures(&$data, SplObjectStorage $storage = null)
324+
public static function wrapClosures(&$data, ?SplObjectStorage $storage = null)
325325
{
326326
if ($storage === null) {
327327
$storage = static::$context->scope;
@@ -395,7 +395,7 @@ public static function wrapClosures(&$data, SplObjectStorage $storage = null)
395395
*
396396
* @internal
397397
*/
398-
public static function unwrapClosures(&$data, SplObjectStorage $storage = null)
398+
public static function unwrapClosures(&$data, ?SplObjectStorage $storage = null)
399399
{
400400
if ($storage === null) {
401401
$storage = static::$context->scope;

src/Adapters/Symfony/Component/Process/Process.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ class Process extends SymfonyProcess
2020
*/
2121
public function __construct(
2222
array $command,
23-
string $cwd = null,
24-
array $env = null,
23+
?string $cwd = null,
24+
?array $env = null,
2525
mixed $input = null,
2626
?float $timeout = 60,
27-
array $options = null
27+
?array $options = null
2828
) {
2929
parent::__construct($command, $cwd, $env, $input, $timeout, $options); //@phpstan-ignore-line
3030

src/Events/Dispatcher.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class Dispatcher
1414
{
1515
private static ?EventDispatcherInterface $eventDispatcher = null;
1616

17-
public static function setEventDispatcher(EventDispatcherInterface $eventDispatcher = null): void
17+
public static function setEventDispatcher(?EventDispatcherInterface $eventDispatcher = null): void
1818
{
1919
$previousEventDispatcher = self::$eventDispatcher;
2020

src/ManagedProcess/MysqlServer.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class MysqlServer implements ManagedProcessInterface
4343
* @throws RuntimeException
4444
*/
4545
public function __construct(
46-
string $directory = null,
46+
?string $directory = null,
4747
private int $port = self::PORT_DEFAULT,
4848
private string $database = 'wordpress',
4949
private string $user = 'wordpress',
@@ -550,7 +550,7 @@ public function isUsingCustomBinary(): bool
550550
return $this->usingCustomBinary;
551551
}
552552

553-
public function setOutput(OutputInterface $output = null): void
553+
public function setOutput(?OutputInterface $output = null): void
554554
{
555555
$this->output = $output;
556556
}

src/Module/Support/DbDump.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ public function getOriginalUrlFromSqlString(string $sql): string|false
294294
* @param string|null $originalUrl The site URL that should be replaced in the dump, or `null` to unset the
295295
* property.
296296
*/
297-
public function setOriginalUrl(string $originalUrl = null): void
297+
public function setOriginalUrl(?string $originalUrl = null): void
298298
{
299299
if ($originalUrl === null) {
300300
$this->originalUrl = null;

src/Module/WPBrowserMethods.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public function _initialize(): void
132132
*
133133
* @return FacebookWebdriverCookie|Cookie|null The WordPress authorization cookie or `null` if not found.
134134
*/
135-
protected function grabWordPressAuthCookie(string $pattern = null): Cookie|FacebookWebdriverCookie|null
135+
protected function grabWordPressAuthCookie(?string $pattern = null): Cookie|FacebookWebdriverCookie|null
136136
{
137137
$pattern = $pattern ?: '/^wordpress_[a-z0-9]{32}$/';
138138
$cookies = $this->grabCookiesWithPattern($pattern);
@@ -147,7 +147,7 @@ protected function grabWordPressAuthCookie(string $pattern = null): Cookie|Faceb
147147
*
148148
* @return FacebookWebdriverCookie|Cookie|null The WordPress login cookie or `null` if not found.
149149
*/
150-
protected function grabWordPressLoginCookie(string $pattern = null): Cookie|FacebookWebdriverCookie|null
150+
protected function grabWordPressLoginCookie(?string $pattern = null): Cookie|FacebookWebdriverCookie|null
151151
{
152152
$pattern = $pattern ?: '/^wordpress_logged_in_[a-z0-9]{32}$/';
153153
$cookies = $this->grabCookiesWithPattern($pattern);
@@ -365,7 +365,7 @@ public function seeMessage(array|string $classes = ''): void
365365
*
366366
* @return Cookie|null Either a cookie object or `null`.
367367
*/
368-
public function grabWordPressTestCookie(string $name = null): ?Cookie
368+
public function grabWordPressTestCookie(?string $name = null): ?Cookie
369369
{
370370
$name = $name ?: 'wordpress_test_cookie';
371371

@@ -410,7 +410,7 @@ public function amOnAdminPage(string $page): void
410410
*
411411
* @param string|array<string,mixed> $queryVars A string or array of query variables to append to the AJAX path.
412412
*/
413-
public function amOnAdminAjaxPage(string|array $queryVars = null): void
413+
public function amOnAdminAjaxPage(string|array|null $queryVars = null): void
414414
{
415415
$path = 'admin-ajax.php';
416416
if ($queryVars !== null) {
@@ -431,7 +431,7 @@ public function amOnAdminAjaxPage(string|array $queryVars = null): void
431431
*
432432
* @param string|array<string,mixed> $queryVars A string or array of query variables to append to the Cron path.
433433
*/
434-
public function amOnCronPage(string|array $queryVars = null): void
434+
public function amOnCronPage(string|array|null $queryVars = null): void
435435
{
436436
$path = 'wp-cron.php';
437437
if ($queryVars !== null) {

src/Module/WPCLI.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ public function grabLastShellErrorOutput(): string
283283
*/
284284
public function cliToArray(
285285
array $command,
286-
callable $splitCallback = null,
286+
?callable $splitCallback = null,
287287
?array $env = null,
288288
mixed $input = null
289289
): array {

src/Module/WPDb.php

+13-13
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ class WPDb extends Db
207207
*
208208
* @return void
209209
*/
210-
public function __construct(ModuleContainer $moduleContainer, ?array $config = null, DbDump $dbDump = null)
210+
public function __construct(ModuleContainer $moduleContainer, ?array $config = null, ?DbDump $dbDump = null)
211211
{
212212
parent::__construct($moduleContainer, $config);
213213
$this->dbDump = $dbDump ?? new DbDump();
@@ -347,7 +347,7 @@ protected function validateConfig(): void
347347
*
348348
* @throws ModuleException It the database cannot be correctly initialized.
349349
*/
350-
public function _initialize(Tables $table = null): void
350+
public function _initialize(?Tables $table = null): void
351351
{
352352
/**
353353
* Dispatches an event before the WPDb module initializes.
@@ -387,7 +387,7 @@ public function _initialize(Tables $table = null): void
387387
*
388388
* @throws ModuleConfigException|ModuleException If there's an issue during the cleanup phase.
389389
*/
390-
public function importSqlDumpFile(string $dumpFile = null): void
390+
public function importSqlDumpFile(?string $dumpFile = null): void
391391
{
392392
if ($dumpFile !== null) {
393393
if (!is_file($dumpFile) || !is_readable($dumpFile)) {
@@ -421,7 +421,7 @@ public function importSqlDumpFile(string $dumpFile = null): void
421421
*
422422
* @throws ModuleException|ModuleConfigException If there's a configuration or operation issue.
423423
*/
424-
public function _cleanup(string $databaseKey = null, array $databaseConfig = null): void
424+
public function _cleanup(?string $databaseKey = null, ?array $databaseConfig = null): void
425425
{
426426
parent::_cleanup($databaseKey, $databaseConfig);
427427
$this->blogId = 0;
@@ -602,8 +602,8 @@ public function dontSeePostMetaInDatabase(array $criteria): void
602602
public function seePostWithTermInDatabase(
603603
int $post_id,
604604
int $term_taxonomy_id,
605-
int $term_order = null,
606-
string $taxonomy = null
605+
?int $term_order = null,
606+
?string $taxonomy = null
607607
): void {
608608
if ($taxonomy !== null) {
609609
$match = $this->grabTermTaxonomyIdFromDatabase([
@@ -3571,7 +3571,7 @@ public function dontSeeBlogInDatabase(array $criteria): void
35713571
* @param string|null $themeName The theme name, e.g. `Acme`, defaults to the "title" version of
35723572
* `$stylesheet`.
35733573
*/
3574-
public function useTheme(string $stylesheet, string $template = null, string $themeName = null): void
3574+
public function useTheme(string $stylesheet, ?string $template = null, ?string $themeName = null): void
35753575
{
35763576
$template = $template ?: $stylesheet;
35773577
$themeName = $themeName ?: ucwords($stylesheet, ' _');
@@ -3651,7 +3651,7 @@ public function haveMenuInDatabase(string $slug, string $location, array $overri
36513651
public function haveMenuItemInDatabase(
36523652
string $menuSlug,
36533653
string $title,
3654-
int $menuOrder = null,
3654+
?int $menuOrder = null,
36553655
array $meta = []
36563656
): int {
36573657
if (empty($this->stylesheet)) {
@@ -3748,7 +3748,7 @@ public function haveAttachmentInDatabase(
37483748
string $file,
37493749
string|int $date = 'now',
37503750
array $overrides = [],
3751-
array $imageSizes = null
3751+
?array $imageSizes = null
37523752
): int {
37533753
if (!class_exists(ImageResize::class)) {
37543754
$message = 'The "haveAttachmentInDatabase" method requires the "gumlet/php-image-resize:^1.6" package.' .
@@ -3899,7 +3899,7 @@ public function haveAttachmentInDatabase(
38993899
*
39003900
* @return string The current site URL
39013901
*/
3902-
public function grabSiteUrl(string $path = null): string
3902+
public function grabSiteUrl(?string $path = null): string
39033903
{
39043904
/** @var array{url: string} $config Validated module config. */
39053905
$config = $this->config;
@@ -4490,7 +4490,7 @@ protected function loadDumpUsingDriver(string $databaseKey): void
44904490
* @param string|null $databaseKey The key of the database to load.
44914491
* @param array<string,mixed>|null $databaseConfig The configuration for the database to load.
44924492
*/
4493-
public function _loadDump(string $databaseKey = null, array $databaseConfig = null): void
4493+
public function _loadDump(?string $databaseKey = null, ?array $databaseConfig = null): void
44944494
{
44954495
parent::_loadDump($databaseKey, $databaseConfig);
44964496
$this->prepareDb();
@@ -4525,8 +4525,8 @@ public function _loadDump(string $databaseKey = null, array $databaseConfig = nu
45254525
public function dontSeePostWithTermInDatabase(
45264526
int $post_id,
45274527
int $term_taxonomy_id,
4528-
int $term_order = null,
4529-
string $taxonomy = null
4528+
?int $term_order = null,
4529+
?string $taxonomy = null
45304530
): void {
45314531
if ($taxonomy !== null) {
45324532
$match = $this->grabTermTaxonomyIdFromDatabase([

0 commit comments

Comments
 (0)