Skip to content

Commit

Permalink
Fix last PHP 8.4 deprecations.
Browse files Browse the repository at this point in the history
  • Loading branch information
kagg-design committed Dec 1, 2024
1 parent 9389663 commit 782e95b
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/Module/WPCLI.php
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ public function grabLastShellErrorOutput(): string
*/
public function cliToArray(
array $command,
callable $splitCallback = null,
?callable $splitCallback = null,
?array $env = null,
mixed $input = null
): array {
Expand Down
12 changes: 6 additions & 6 deletions src/Module/WPDb.php
Original file line number Diff line number Diff line change
Expand Up @@ -602,8 +602,8 @@ public function dontSeePostMetaInDatabase(array $criteria): void
public function seePostWithTermInDatabase(
int $post_id,
int $term_taxonomy_id,
int $term_order = null,
string $taxonomy = null
?int $term_order = null,
?string $taxonomy = null
): void {
if ($taxonomy !== null) {
$match = $this->grabTermTaxonomyIdFromDatabase([
Expand Down Expand Up @@ -3651,7 +3651,7 @@ public function haveMenuInDatabase(string $slug, string $location, array $overri
public function haveMenuItemInDatabase(
string $menuSlug,
string $title,
int $menuOrder = null,
?int $menuOrder = null,
array $meta = []
): int {
if (empty($this->stylesheet)) {
Expand Down Expand Up @@ -3748,7 +3748,7 @@ public function haveAttachmentInDatabase(
string $file,
string|int $date = 'now',
array $overrides = [],
array $imageSizes = null
?array $imageSizes = null
): int {
if (!class_exists(ImageResize::class)) {
$message = 'The "haveAttachmentInDatabase" method requires the "gumlet/php-image-resize:^1.6" package.' .
Expand Down Expand Up @@ -4525,8 +4525,8 @@ public function _loadDump(?string $databaseKey = null, ?array $databaseConfig =
public function dontSeePostWithTermInDatabase(
int $post_id,
int $term_taxonomy_id,
int $term_order = null,
string $taxonomy = null
?int $term_order = null,
?string $taxonomy = null
): void {
if ($taxonomy !== null) {
$match = $this->grabTermTaxonomyIdFromDatabase([
Expand Down
2 changes: 1 addition & 1 deletion src/Module/WPFilesystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -1300,7 +1300,7 @@ public function getWpRootFolder(): string
public function getBlogUploadsPath(
int $blogId,
string $file = '',
DateTimeImmutable|DateTime|string $date = null
DateTimeImmutable|DateTime|string|null $date = null
): string {
$dateFrag = $date !== null ?
$this->buildDateFrag($date)
Expand Down
4 changes: 2 additions & 2 deletions src/Module/WPLoader/FiltersGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ public function __construct(/**
* An array detailing each filter callback, priority and arguments.
*/
protected array $filters = [],
callable $removeWith = null,
callable $addWith = null
?callable $removeWith = null,
?callable $addWith = null
) {
$this->removeCallback = $removeWith ?? 'remove_filter';
$this->addCallback = $addWith ?? 'add_filter';
Expand Down
4 changes: 2 additions & 2 deletions src/MonkeyPatch/FileStreamWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public static function setPatcherForFile(
string $file,
PatcherInterface $patcher,
bool $redirectOpenedPath = true,
string $context = null
?string $context = null
): void {
$fromFilePath = FS::realpath($file) ?: $file;
self::$fileToPatcherMap[$fromFilePath] = [$patcher, $redirectOpenedPath, $context ?? ''];
Expand Down Expand Up @@ -71,7 +71,7 @@ public function __destruct()
/**
* @throws MonkeyPatchingException
*/
public function stream_open(string $path, string $mode, int $options, string &$openedPath = null): bool
public function stream_open(string $path, string $mode, int $options, ?string &$openedPath = null): bool
{
self::unregister();

Expand Down
4 changes: 2 additions & 2 deletions src/Utils/MonkeyPatch.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public static function redirectFileToFile(
string $fromFile,
string $toFile,
bool $redirectOpenedPath = true,
string $context = null
?string $context = null
): void {
FileStreamWrapper::setPatcherForFile(
$fromFile,
Expand All @@ -33,7 +33,7 @@ public static function redirectFileContents(
string $fromFile,
string $fileContents,
bool $redirectOpenedPath = true,
string $context = null
?string $context = null
): void {
FileStreamWrapper::setPatcherForFile(
$fromFile,
Expand Down
4 changes: 2 additions & 2 deletions src/WordPress/CliProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ public function __construct(
*/
public static function fromShellCommandline(
string $command,
string $cwd = null,
array $env = null,
?string $cwd = null,
?array $env = null,
mixed $input = null,
?float $timeout = 60
): static {
Expand Down
4 changes: 2 additions & 2 deletions tests/_support/Traits/LoopIsolation.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ trait LoopIsolation
*/
protected function assertInIsolation(
Closure $runAssertions,
string $cwd = null,
array $requireFiles = [],
?string $cwd = null,
?array $requireFiles = [],
): mixed {
$options = ['cwd' => $cwd, 'rethrow' => false];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ class PhpBuiltinServerProcessMock extends Process

public function __construct(
array $command,
string $cwd = null,
array $env = null,
?string $cwd = null,
?array $env = null,
mixed $input = null,
?float $timeout = 60
) {
Expand Down

0 comments on commit 782e95b

Please sign in to comment.