diff --git a/.github/workflows/code-standards.yml b/.github/workflows/code-standards.yml index e507895..4b5566d 100644 --- a/.github/workflows/code-standards.yml +++ b/.github/workflows/code-standards.yml @@ -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 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 032f87f..026c958 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -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 diff --git a/examples/class_vars.legacy.php b/examples/class_vars.legacy.php index 286bc76..b775830 100644 --- a/examples/class_vars.legacy.php +++ b/examples/class_vars.legacy.php @@ -1,6 +1,6 @@ expontentialBackoffRetryCount, diff --git a/src/TestUtils/FileUtil.php b/src/TestUtils/FileUtil.php index 8df98fa..e725bd3 100644 --- a/src/TestUtils/FileUtil.php +++ b/src/TestUtils/FileUtil.php @@ -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); diff --git a/src/TestUtils/GcloudWrapper/CloudFunction.php b/src/TestUtils/GcloudWrapper/CloudFunction.php index ba1667d..e9182f2 100644 --- a/src/TestUtils/GcloudWrapper/CloudFunction.php +++ b/src/TestUtils/GcloudWrapper/CloudFunction.php @@ -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; @@ -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.'); @@ -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.'); @@ -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; @@ -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); } diff --git a/src/Utils/ExponentialBackoff.php b/src/Utils/ExponentialBackoff.php index cddff70..b6d68c1 100644 --- a/src/Utils/ExponentialBackoff.php +++ b/src/Utils/ExponentialBackoff.php @@ -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; diff --git a/src/Utils/Flex/FlexExecCommand.php b/src/Utils/Flex/FlexExecCommand.php index 3d2163f..d292e3f 100644 --- a/src/Utils/Flex/FlexExecCommand.php +++ b/src/Utils/Flex/FlexExecCommand.php @@ -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; diff --git a/src/Utils/WordPress/Project.php b/src/Utils/WordPress/Project.php index 087973c..2c592f7 100644 --- a/src/Utils/WordPress/Project.php +++ b/src/Utils/WordPress/Project.php @@ -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;