Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for PHP 8.4 #157

Merged
merged 4 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/code-standards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ on:
"whitespace_after_comma_in_array": true,
"no_whitespace_in_blank_line": true,
"binary_operator_spaces": {"default": "at_least_single_space"},
"no_extra_blank_lines": true
"no_extra_blank_lines": true,
"nullable_type_declaration_for_default_null_value": true
}
add-rules:
type: string
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
matrix:
operating-system: [ ubuntu-latest ]
php: [ "8.0", "8.1", "8.2", "8.3" ]
php: [ "8.0", "8.1", "8.2", "8.3", "8.4" ]
name: PHP ${{matrix.php }} Unit Test
steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion examples/class_vars.legacy.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Google\Cloud\Samples\Dlp;
namespace Google\Cloud\Samples\ClassVars;

// new client surface doesn't exist (yet)
use Google\ApiCore\LongRunning\OperationsClient;
Expand Down
2 changes: 1 addition & 1 deletion examples/class_vars.new.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Google\Cloud\Samples\Dlp;
namespace Google\Cloud\Samples\ClassVars;

// new client surface doesn't exist (yet)
use Google\ApiCore\LongRunning\OperationsClient;
Expand Down
2 changes: 1 addition & 1 deletion examples/kitchen_sink.legacy.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Google\Cloud\Samples\Dlp;
namespace Google\Cloud\Samples\KitchenSink;

use Google\Cloud\Dlp\V2\DlpServiceClient;
use Google\Cloud\Dlp\V2\InspectConfig;
Expand Down
2 changes: 1 addition & 1 deletion examples/kitchen_sink.new.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Google\Cloud\Samples\Dlp;
namespace Google\Cloud\Samples\KitchenSink;

use Google\Cloud\Dlp\V2\Client\DlpServiceClient;
use Google\Cloud\Dlp\V2\CreateDlpJobRequest;
Expand Down
2 changes: 1 addition & 1 deletion examples/mixins.legacy.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Google\Cloud\Samples\Dlp;
namespace Google\Cloud\Samples\Mixins;

use Google\Cloud\SecretManager\V1\SecretManagerServiceClient;
use Google\Cloud\Iam\V1\Binding;
Expand Down
2 changes: 1 addition & 1 deletion examples/mixins.new.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Google\Cloud\Samples\Dlp;
namespace Google\Cloud\Samples\Mixins;

use Google\Cloud\Iam\V1\Binding;
use Google\Cloud\Iam\V1\GetIamPolicyRequest;
Expand Down
2 changes: 1 addition & 1 deletion examples/multiple_clients.legacy.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Google\Cloud\Samples\Dlp;
namespace Google\Cloud\Samples\MultipleClients;

// new client surface doesn't exist (yet)
use Google\ApiCore\LongRunning\OperationsClient;
Expand Down
2 changes: 1 addition & 1 deletion examples/multiple_clients.new.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Google\Cloud\Samples\Dlp;
namespace Google\Cloud\Samples\MultipleClients;

// new client surface doesn't exist (yet)
use Google\ApiCore\LongRunning\OperationsClient;
Expand Down
2 changes: 1 addition & 1 deletion examples/no_args.legacy.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Google\Cloud\Samples\Dlp;
namespace Google\Cloud\Samples\NoArgs;

use Google\Cloud\Dlp\V2\DlpServiceClient;

Expand Down
2 changes: 1 addition & 1 deletion examples/no_args.new.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Google\Cloud\Samples\Dlp;
namespace Google\Cloud\Samples\NoArgs;

use Google\Cloud\Dlp\V2\Client\DlpServiceClient;
use Google\Cloud\Dlp\V2\ListInfoTypesRequest;
Expand Down
2 changes: 1 addition & 1 deletion examples/non_rpc_methods.legacy.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Google\Cloud\Samples\Dlp;
namespace Google\Cloud\Samples\NonRpcMethods;


use Google\Cloud\Dlp\V2\DlpServiceClient;
Expand Down
2 changes: 1 addition & 1 deletion examples/non_rpc_methods.new.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Google\Cloud\Samples\Dlp;
namespace Google\Cloud\Samples\NonRpcMethods;


use Google\Cloud\Dlp\V2\Client\DlpServiceClient;
Expand Down
2 changes: 1 addition & 1 deletion examples/optional_args.legacy.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Google\Cloud\Samples\Dlp;
namespace Google\Cloud\Samples\OptionalArgs;

use Google\Cloud\Dlp\V2\DlpServiceClient;
use Google\Cloud\Dlp\V2\InspectConfig;
Expand Down
2 changes: 1 addition & 1 deletion examples/optional_args.new.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Google\Cloud\Samples\Dlp;
namespace Google\Cloud\Samples\OptionalArgs;

use Google\Cloud\Dlp\V2\Client\DlpServiceClient;
use Google\Cloud\Dlp\V2\CreateDlpJobRequest;
Expand Down
2 changes: 1 addition & 1 deletion examples/optional_args_array_keyword.legacy.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Google\Cloud\Samples\Dlp;
namespace Google\Cloud\Samples\OptionalArgsArrayKeyword;

use Google\Cloud\Dlp\V2\DlpServiceClient;
use Google\Cloud\Dlp\V2\InspectConfig;
Expand Down
2 changes: 1 addition & 1 deletion examples/optional_args_array_keyword.new.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Google\Cloud\Samples\Dlp;
namespace Google\Cloud\Samples\OptionalArgsArrayKeyword;

use Google\Cloud\Dlp\V2\Client\DlpServiceClient;
use Google\Cloud\Dlp\V2\CreateDlpJobRequest;
Expand Down
2 changes: 1 addition & 1 deletion examples/optional_args_variable.legacy.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Google\Cloud\Samples\Dlp;
namespace Google\Cloud\Samples\OptionalArgsVariable;

use Google\Cloud\Dlp\V2\DlpServiceClient;
use Google\Cloud\Dlp\V2\InspectConfig;
Expand Down
2 changes: 1 addition & 1 deletion examples/optional_args_variable.new.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Google\Cloud\Samples\Dlp;
namespace Google\Cloud\Samples\OptionalArgsVariable;

use Google\Cloud\Dlp\V2\Client\DlpServiceClient;
use Google\Cloud\Dlp\V2\CreateDlpJobRequest;
Expand Down
2 changes: 1 addition & 1 deletion examples/required_and_optional_args.legacy.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Google\Cloud\Samples\Dlp;
namespace Google\Cloud\Samples\RequiredAndOptionalArgs;

use Google\Cloud\Dlp\V2\DlpServiceClient;
use Google\Cloud\Dlp\V2\InspectConfig;
Expand Down
2 changes: 1 addition & 1 deletion examples/required_and_optional_args.new.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Google\Cloud\Samples\Dlp;
namespace Google\Cloud\Samples\RequiredAndOptionalArgs;

use Google\Cloud\Dlp\V2\Client\DlpServiceClient;
use Google\Cloud\Dlp\V2\CreateDlpJobRequest;
Expand Down
2 changes: 1 addition & 1 deletion examples/required_args.legacy.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Google\Cloud\Samples\Dlp;
namespace Google\Cloud\Samples\RequiredArgs;

use Google\Cloud\Dlp\V2\DlpServiceClient;

Expand Down
2 changes: 1 addition & 1 deletion examples/required_args.new.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Google\Cloud\Samples\Dlp;
namespace Google\Cloud\Samples\RequiredArgs;

use Google\Cloud\Dlp\V2\Client\DlpServiceClient;
use Google\Cloud\Dlp\V2\CreateDlpJobRequest;
Expand Down
2 changes: 1 addition & 1 deletion examples/var_typehint.legacy.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Google\Cloud\Samples\Dlp;
namespace Google\Cloud\Samples\VarTypehint;

// new client surface doesn't exist (yet)
use Google\ApiCore\LongRunning\OperationsClient;
Expand Down
2 changes: 1 addition & 1 deletion examples/var_typehint.new.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Google\Cloud\Samples\Dlp;
namespace Google\Cloud\Samples\VarTypehint;

// new client surface doesn't exist (yet)
use Google\ApiCore\LongRunning\OperationsClient;
Expand Down
2 changes: 1 addition & 1 deletion examples/vars_defined_elsewhere.legacy.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Google\Cloud\Samples\Dlp;
namespace Google\Cloud\Samples\VarsDefinedElsewhere;

// new client surface exists
use Google\Cloud\Dlp\V2\DlpServiceClient;
Expand Down
2 changes: 1 addition & 1 deletion examples/vars_defined_elsewhere.new.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Google\Cloud\Samples\Dlp;
namespace Google\Cloud\Samples\VarsDefinedElsewhere;

// new client surface exists
use Google\Cloud\Dlp\V2\Client\DlpServiceClient;
Expand Down
2 changes: 1 addition & 1 deletion examples/vars_in_constructor.legacy.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Google\Cloud\Samples\Dlp;
namespace Google\Cloud\Samples\VarsInConstructor;

// new client surface exists
use Google\Cloud\Dlp\V2\DlpServiceClient;
Expand Down
2 changes: 1 addition & 1 deletion examples/vars_in_constructor.new.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Google\Cloud\Samples\Dlp;
namespace Google\Cloud\Samples\VarsInConstructor;

// new client surface exists
use Google\Cloud\Dlp\V2\Client\DlpServiceClient;
Expand Down
2 changes: 1 addition & 1 deletion src/TestUtils/CloudFunctionDeploymentTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public function getBaseUri()
* @param int $retries the number of times to retry entry lookup
* @param int sleep the number of seconds sleep before executing the log lookup
*/
private function processFunctionLogs(string $startTime, callable $process, int $retries = null, int $sleep = null)
private function processFunctionLogs(string $startTime, callable $process, ?int $retries = null, ?int $sleep = null)
{
if (empty(self::$loggingClient)) {
self::$loggingClient = new LoggingClient([
Expand Down
2 changes: 1 addition & 1 deletion src/TestUtils/ExponentialBackoffTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ private function useDeadlineExceededBackoff($retries = null)
});
}

private function useBackoff($retries = null, callable $retryFunction = null)
private function useBackoff($retries = null, ?callable $retryFunction = null)
{
$backoff = new ExponentialBackoff(
$retries ?: $this->expontentialBackoffRetryCount,
Expand Down
4 changes: 2 additions & 2 deletions src/TestUtils/FileUtil.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ public static function randomName($length)
return join('', $array);
}

public static function cloneDirectoryIntoTmp($projectDir = '.', ProgressBar $progress = null)
public static function cloneDirectoryIntoTmp($projectDir = '.', ?ProgressBar $progress = null)
{
$tmpDir = sys_get_temp_dir() . '/test-' . self::randomName(8);
self::copyDir($projectDir, $tmpDir, $progress);
return $tmpDir;
}

public static function copyDir($src, $dst, ProgressBar $progress = null)
public static function copyDir($src, $dst, ?ProgressBar $progress = null)
{
@mkdir($dst);
$dir = opendir($src);
Expand Down
10 changes: 5 additions & 5 deletions src/TestUtils/GcloudWrapper/CloudFunction.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function __construct(
string $entryPoint,
string $functionSignatureType,
string $region,
string $dir = null
?string $dir = null
) {
$this->projectId = $projectId;
$this->entryPoint = $entryPoint;
Expand Down Expand Up @@ -137,7 +137,7 @@ public function getFunctionName()
*
* @return bool true if deployment suceeds, false upon failure
*/
public function deploy(array $flags = [], string $trigger = self::DEFAULT_TRIGGER, int $retries = 3, string $channel = null)
public function deploy(array $flags = [], string $trigger = self::DEFAULT_TRIGGER, int $retries = 3, ?string $channel = null)
{
if ($this->deployed) {
$this->errorLog('The function has already been deployed.');
Expand Down Expand Up @@ -237,7 +237,7 @@ public function getBaseUrl($force = false, $retries = 3)
* @param array $args
* @return \Symfony\Component\Process\Process
*/
private function gcloudCommand(array $args, string $channel = null)
private function gcloudCommand(array $args, ?string $channel = null)
{
if (!in_array($channel, [null, 'alpha', 'beta'])) {
$this->errorLog('gcloud channel must use product (null), "alpha" or "beta". Defaulting to production.');
Expand Down Expand Up @@ -271,7 +271,7 @@ private function gcloudCommand(array $args, string $channel = null)
* @return \Symfony\Component\Process\Process returns the php server process
* @throws \Symfony\Component\Process\Exception\ProcessFailedException
*/
public function run(array $env = [], string $port = self::DEFAULT_PORT, string $phpBin = null)
public function run(array $env = [], string $port = self::DEFAULT_PORT, ?string $phpBin = null)
{
$this->localUri = 'localhost:' . $port;

Expand Down Expand Up @@ -306,7 +306,7 @@ public function run(array $env = [], string $port = self::DEFAULT_PORT, string $
* @return \Symfony\Component\Process\Process returns the php server process
* @throws \Symfony\Component\Process\Exception\ProcessFailedException
*/
public function runCloudEventFunction(string $port = self::DEFAULT_PORT, string $phpBin = null)
public function runCloudEventFunction(string $port = self::DEFAULT_PORT, ?string $phpBin = null)
{
return $this->run(true, $port, $phpBin);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Utils/ExponentialBackoff.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class ExponentialBackoff
* @param int $retries [optional] Number of retries for a failed request.
* @param callable $retryFunction [optional] returns bool for whether or not to retry
*/
public function __construct($retries = null, callable $retryFunction = null)
public function __construct($retries = null, ?callable $retryFunction = null)
{
$this->retries = $retries !== null ? (int) $retries : 3;
$this->retryFunction = $retryFunction;
Expand Down
2 changes: 1 addition & 1 deletion src/Utils/Flex/FlexExecCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class FlexExecCommand extends Command
/* @var Gcloud */
private $gcloud;

public function __construct(Gcloud $gcloud = null)
public function __construct(?Gcloud $gcloud = null)
{
parent::__construct();
$this->gcloud = ($gcloud == null) ? new Gcloud() : $gcloud;
Expand Down
2 changes: 1 addition & 1 deletion src/Utils/WordPress/Project.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class Project extends BaseProject
private $filesystem;
private $wordPressDir;

public function __construct(InputInterface $input, OutputInterface $output, QuestionHelper $helper = null)
public function __construct(InputInterface $input, OutputInterface $output, ?QuestionHelper $helper = null)
{
$this->input = $input;
$this->output = $output;
Expand Down
Loading