From 42c689f57590b78405d11373c81921648090bc71 Mon Sep 17 00:00:00 2001 From: Dane Powell Date: Tue, 26 Nov 2024 11:26:10 -0800 Subject: [PATCH 1/3] CLI-1436: PHP 8.4 compatibility (#1834) * CLI-1436: PHP 8.4 compatibility * expander * fixes * add tests --- .github/workflows/ci.yml | 7 +- composer.json | 17 +- composer.lock | 154 +++++++++++-------- src/AcsfApi/AcsfConnector.php | 4 +- src/CloudApi/AccessTokenConnector.php | 2 +- src/Command/Archive/ArchiveExportCommand.php | 2 +- src/Command/CommandBase.php | 9 +- src/Command/Pull/PullCommandBase.php | 14 +- src/Command/Push/PushFilesCommand.php | 2 +- src/Command/Ssh/SshKeyCommandBase.php | 3 +- src/DataStore/JsonDataStore.php | 4 +- src/DataStore/YamlStore.php | 4 +- src/Helpers/LocalMachineHelper.php | 14 +- src/Helpers/SshHelper.php | 4 +- 14 files changed, 130 insertions(+), 110 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 58161a7ad..5441f81fd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,15 +23,16 @@ jobs: strategy: matrix: os: ['ubuntu-22.04'] - php: ['8.1', '8.2', '8.3'] + php: ['8.1', '8.2', '8.3', '8.4'] coverage: ['none'] include: - os: 'ubuntu-22.04' - php: '8.2' + php: '8.4' coverage: 'pcov' # Only test pre-installed (i.e. fast) versions of PHP on Windows. + # https://github.com/shivammathur/setup-php?tab=readme-ov-file#github-hosted-runners - os: 'windows-2022' - php: '8.2' + php: '8.3' coverage: 'none' steps: - name: Prepare Git diff --git a/composer.json b/composer.json index 631f87fe3..61310ac0b 100644 --- a/composer.json +++ b/composer.json @@ -10,20 +10,29 @@ "role": "Maintainer" } ], + "repositories": [ + { + "type": "vcs", "url": "https://github.com/ruudk/oauth2-client" + }, + { + "type": "vcs", "url": "https://github.com/Ayesh/safe" + } + ], "minimum-stability": "dev", "require": { "php": "^8.1", "ext-json": "*", - "acquia/drupal-environment-detector": "^1.2.0", + "acquia/drupal-environment-detector": "^1.7.0", "bugsnag/bugsnag": "^3.0", "composer/semver": "^3.3", "consolidation/self-update": "^3", "dflydev/dot-access-data": "^3", - "grasmash/expander": "^3", + "grasmash/expander": "^3.0.1", "guzzlehttp/guzzle": "^7.4", "http-interop/http-factory-guzzle": "^1.0", "laminas/laminas-validator": "^2.20.0", "league/csv": "^9.8", + "league/oauth2-client": "dev-patch-1 as 2.7.0", "loophp/phposinfo": "^1.7.2", "ltd-beget/dns-zone-configurator": "^1.3.0", "m4tthumphrey/php-gitlab-api": "^11.5", @@ -45,9 +54,9 @@ "symfony/process": "^6.3", "symfony/validator": "^6.3", "symfony/yaml": "^6.3", - "thecodingmachine/safe": "^2.4", + "thecodingmachine/safe": "dev-php84/nullability as 2.5.0", "typhonius/acquia-logstream": "^0.0.14", - "typhonius/acquia-php-sdk-v2": "^3.4.0", + "typhonius/acquia-php-sdk-v2": "^3.4.1", "vlucas/phpdotenv": "^5.5", "zumba/amplitude-php": "^1.0.4" }, diff --git a/composer.lock b/composer.lock index f1e722ce3..7b6dea3a7 100644 --- a/composer.lock +++ b/composer.lock @@ -4,29 +4,28 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "8e18ad1d86e2cea43d906b0ab2b94fc1", + "content-hash": "71b2dc1d9fc88eee892361edecfd0add", "packages": [ { "name": "acquia/drupal-environment-detector", - "version": "1.6.0", + "version": "1.7.0", "source": { "type": "git", "url": "https://github.com/acquia/drupal-environment-detector.git", - "reference": "396cc5ed5d7f9d40a8afbdc1800a189c15924450" + "reference": "4666ae67b422d209a8b11c9f886e3ef6d3f16778" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/acquia/drupal-environment-detector/zipball/396cc5ed5d7f9d40a8afbdc1800a189c15924450", - "reference": "396cc5ed5d7f9d40a8afbdc1800a189c15924450", + "url": "https://api.github.com/repos/acquia/drupal-environment-detector/zipball/4666ae67b422d209a8b11c9f886e3ef6d3f16778", + "reference": "4666ae67b422d209a8b11c9f886e3ef6d3f16778", "shasum": "" }, "conflict": { "acquia/blt": ">=12.0.0 <13.5.2" }, "require-dev": { - "acquia/coding-standards": "^1.0.0", - "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", - "phpunit/phpunit": "^9.1" + "acquia/coding-standards": "^3.0.1", + "dealerdirect/phpcodesniffer-composer-installer": "^1.0.0" }, "type": "library", "extra": { @@ -55,9 +54,9 @@ "description": "Provides common methods for detecting the current Acquia environment", "support": { "issues": "https://github.com/acquia/drupal-environment-detector/issues", - "source": "https://github.com/acquia/drupal-environment-detector/tree/1.6.0" + "source": "https://github.com/acquia/drupal-environment-detector/tree/1.7.0" }, - "time": "2023-02-28T18:45:28+00:00" + "time": "2024-11-26T19:16:45+00:00" }, { "name": "brick/math", @@ -649,16 +648,16 @@ }, { "name": "grasmash/expander", - "version": "3.0.0", + "version": "3.0.1", "source": { "type": "git", "url": "https://github.com/grasmash/expander.git", - "reference": "bb1c1a2430957945cf08c5a62f5d72a6aa6a2c82" + "reference": "eea11b9afb0c32483b18b9009f4ca07b770e39f4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/grasmash/expander/zipball/bb1c1a2430957945cf08c5a62f5d72a6aa6a2c82", - "reference": "bb1c1a2430957945cf08c5a62f5d72a6aa6a2c82", + "url": "https://api.github.com/repos/grasmash/expander/zipball/eea11b9afb0c32483b18b9009f4ca07b770e39f4", + "reference": "eea11b9afb0c32483b18b9009f4ca07b770e39f4", "shasum": "" }, "require": { @@ -695,9 +694,9 @@ "description": "Expands internal property references in PHP arrays file.", "support": { "issues": "https://github.com/grasmash/expander/issues", - "source": "https://github.com/grasmash/expander/tree/3.0.0" + "source": "https://github.com/grasmash/expander/tree/3.0.1" }, - "time": "2022-05-10T13:14:49+00:00" + "time": "2024-11-25T23:28:05+00:00" }, { "name": "guzzlehttp/guzzle", @@ -1489,16 +1488,16 @@ }, { "name": "league/oauth2-client", - "version": "2.7.0", + "version": "dev-patch-1", "source": { "type": "git", - "url": "https://github.com/thephpleague/oauth2-client.git", - "reference": "160d6274b03562ebeb55ed18399281d8118b76c8" + "url": "https://github.com/ruudk/oauth2-client.git", + "reference": "b7cf4b4bf0511210bc0159e400631076facd63f2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/oauth2-client/zipball/160d6274b03562ebeb55ed18399281d8118b76c8", - "reference": "160d6274b03562ebeb55ed18399281d8118b76c8", + "url": "https://api.github.com/repos/ruudk/oauth2-client/zipball/b7cf4b4bf0511210bc0159e400631076facd63f2", + "reference": "b7cf4b4bf0511210bc0159e400631076facd63f2", "shasum": "" }, "require": { @@ -1513,17 +1512,16 @@ "squizlabs/php_codesniffer": "^2.3 || ^3.0" }, "type": "library", - "extra": { - "branch-alias": { - "dev-2.x": "2.0.x-dev" - } - }, "autoload": { "psr-4": { "League\\OAuth2\\Client\\": "src/" } }, - "notification-url": "https://packagist.org/downloads/", + "autoload-dev": { + "psr-4": { + "League\\OAuth2\\Client\\Test\\": "test/src/" + } + }, "license": [ "MIT" ], @@ -1542,20 +1540,19 @@ ], "description": "OAuth 2.0 Client Library", "keywords": [ - "Authentication", - "SSO", + "authentication", "authorization", "identity", "idp", "oauth", "oauth2", - "single sign on" + "single sign on", + "sso" ], "support": { - "issues": "https://github.com/thephpleague/oauth2-client/issues", - "source": "https://github.com/thephpleague/oauth2-client/tree/2.7.0" + "source": "https://github.com/ruudk/oauth2-client/tree/patch-1" }, - "time": "2023-04-16T18:19:15+00:00" + "time": "2024-10-31T09:22:57+00:00" }, { "name": "loophp/phposinfo", @@ -6103,16 +6100,16 @@ }, { "name": "thecodingmachine/safe", - "version": "v2.5.0", + "version": "dev-php84/nullability", "source": { "type": "git", - "url": "https://github.com/thecodingmachine/safe.git", - "reference": "3115ecd6b4391662b4931daac4eba6b07a2ac1f0" + "url": "https://github.com/Ayesh/safe.git", + "reference": "e75af75bd026b45b4a526499d324c5202224c570" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thecodingmachine/safe/zipball/3115ecd6b4391662b4931daac4eba6b07a2ac1f0", - "reference": "3115ecd6b4391662b4931daac4eba6b07a2ac1f0", + "url": "https://api.github.com/repos/Ayesh/safe/zipball/e75af75bd026b45b4a526499d324c5202224c570", + "reference": "e75af75bd026b45b4a526499d324c5202224c570", "shasum": "" }, "require": { @@ -6131,6 +6128,13 @@ } }, "autoload": { + "classmap": [ + "lib/DateTime.php", + "lib/DateTimeImmutable.php", + "lib/Exceptions/", + "deprecated/Exceptions/", + "generated/Exceptions/" + ], "files": [ "deprecated/apc.php", "deprecated/array.php", @@ -6220,25 +6224,27 @@ "generated/yaz.php", "generated/zip.php", "generated/zlib.php" + ] + }, + "scripts": { + "phpstan": [ + "phpstan analyse lib -c phpstan.neon --level=max --no-progress -vvv" ], - "classmap": [ - "lib/DateTime.php", - "lib/DateTimeImmutable.php", - "lib/Exceptions/", - "deprecated/Exceptions/", - "generated/Exceptions/" + "cs-fix": [ + "phpcbf" + ], + "cs-check": [ + "phpcs" ] }, - "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "description": "PHP core functions that throw exceptions instead of returning FALSE on error", "support": { - "issues": "https://github.com/thecodingmachine/safe/issues", - "source": "https://github.com/thecodingmachine/safe/tree/v2.5.0" + "source": "https://github.com/Ayesh/safe/tree/php84/nullability" }, - "time": "2023-04-05T11:54:14+00:00" + "time": "2024-03-18T13:27:28+00:00" }, { "name": "typhonius/acquia-logstream", @@ -6298,16 +6304,16 @@ }, { "name": "typhonius/acquia-php-sdk-v2", - "version": "3.4.0", + "version": "3.4.1", "source": { "type": "git", "url": "https://github.com/typhonius/acquia-php-sdk-v2.git", - "reference": "50018d6c14a8d562698dbd4906cd159fa6bbe518" + "reference": "c3acefe27f4abd39111c43b96e9c35d672df6f4e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/typhonius/acquia-php-sdk-v2/zipball/50018d6c14a8d562698dbd4906cd159fa6bbe518", - "reference": "50018d6c14a8d562698dbd4906cd159fa6bbe518", + "url": "https://api.github.com/repos/typhonius/acquia-php-sdk-v2/zipball/c3acefe27f4abd39111c43b96e9c35d672df6f4e", + "reference": "c3acefe27f4abd39111c43b96e9c35d672df6f4e", "shasum": "" }, "require": { @@ -6351,7 +6357,7 @@ "description": "A PHP SDK for Acquia CloudAPI v2", "support": { "issues": "https://github.com/typhonius/acquia-php-sdk-v2/issues", - "source": "https://github.com/typhonius/acquia-php-sdk-v2/tree/3.4.0" + "source": "https://github.com/typhonius/acquia-php-sdk-v2/tree/3.4.1" }, "funding": [ { @@ -6359,7 +6365,7 @@ "type": "github" } ], - "time": "2024-11-19T20:57:53+00:00" + "time": "2024-11-25T23:17:17+00:00" }, { "name": "vlucas/phpdotenv", @@ -7614,16 +7620,16 @@ }, { "name": "composer/class-map-generator", - "version": "1.4.0", + "version": "1.5.0", "source": { "type": "git", "url": "https://github.com/composer/class-map-generator.git", - "reference": "98bbf6780e56e0fd2404fe4b82eb665a0f93b783" + "reference": "4b0a223cf5be7c9ee7e0ef1bc7db42b4a97c9915" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/class-map-generator/zipball/98bbf6780e56e0fd2404fe4b82eb665a0f93b783", - "reference": "98bbf6780e56e0fd2404fe4b82eb665a0f93b783", + "url": "https://api.github.com/repos/composer/class-map-generator/zipball/4b0a223cf5be7c9ee7e0ef1bc7db42b4a97c9915", + "reference": "4b0a223cf5be7c9ee7e0ef1bc7db42b4a97c9915", "shasum": "" }, "require": { @@ -7632,10 +7638,10 @@ "symfony/finder": "^4.4 || ^5.3 || ^6 || ^7" }, "require-dev": { - "phpstan/phpstan": "^1.6", - "phpstan/phpstan-deprecation-rules": "^1", - "phpstan/phpstan-phpunit": "^1", - "phpstan/phpstan-strict-rules": "^1.1", + "phpstan/phpstan": "^1.12 || ^2", + "phpstan/phpstan-deprecation-rules": "^1 || ^2", + "phpstan/phpstan-phpunit": "^1 || ^2", + "phpstan/phpstan-strict-rules": "^1.1 || ^2", "phpunit/phpunit": "^8", "symfony/filesystem": "^5.4 || ^6" }, @@ -7667,7 +7673,7 @@ ], "support": { "issues": "https://github.com/composer/class-map-generator/issues", - "source": "https://github.com/composer/class-map-generator/tree/1.4.0" + "source": "https://github.com/composer/class-map-generator/tree/1.5.0" }, "funding": [ { @@ -7683,7 +7689,7 @@ "type": "tidelift" } ], - "time": "2024-10-03T18:14:00+00:00" + "time": "2024-11-25T16:11:06+00:00" }, { "name": "composer/composer", @@ -13197,9 +13203,25 @@ "time": "2022-06-03T18:03:27+00:00" } ], - "aliases": [], + "aliases": [ + { + "package": "league/oauth2-client", + "version": "dev-patch-1", + "alias": "2.7.0", + "alias_normalized": "2.7.0.0" + }, + { + "package": "thecodingmachine/safe", + "version": "dev-php84/nullability", + "alias": "2.5.0", + "alias_normalized": "2.5.0.0" + } + ], "minimum-stability": "dev", - "stability-flags": {}, + "stability-flags": { + "league/oauth2-client": 20, + "thecodingmachine/safe": 20 + }, "prefer-stable": true, "prefer-lowest": false, "platform": { diff --git a/src/AcsfApi/AcsfConnector.php b/src/AcsfApi/AcsfConnector.php index 69b1d3af2..56c8ade07 100644 --- a/src/AcsfApi/AcsfConnector.php +++ b/src/AcsfApi/AcsfConnector.php @@ -12,10 +12,8 @@ class AcsfConnector extends Connector { /** * @param array $config - * @param string|null $baseUri - * @param string|null $urlAccessToken */ - public function __construct(array $config, string $baseUri = null, string $urlAccessToken = null) + public function __construct(array $config, ?string $baseUri = null, ?string $urlAccessToken = null) { parent::__construct($config, $baseUri, $urlAccessToken); diff --git a/src/CloudApi/AccessTokenConnector.php b/src/CloudApi/AccessTokenConnector.php index 3642f0661..54a343c64 100644 --- a/src/CloudApi/AccessTokenConnector.php +++ b/src/CloudApi/AccessTokenConnector.php @@ -21,7 +21,7 @@ class AccessTokenConnector extends Connector /** * @param array $config */ - public function __construct(array $config, string $baseUri = null, string $urlAccessToken = null) + public function __construct(array $config, ?string $baseUri = null, ?string $urlAccessToken = null) { $this->accessToken = new AccessToken(['access_token' => $config['access_token']]); parent::__construct($config, $baseUri, $urlAccessToken); diff --git a/src/Command/Archive/ArchiveExportCommand.php b/src/Command/Archive/ArchiveExportCommand.php index 3b1649ab7..8cf13e379 100644 --- a/src/Command/Archive/ArchiveExportCommand.php +++ b/src/Command/Archive/ArchiveExportCommand.php @@ -146,7 +146,7 @@ private function exportDatabaseToArchiveDir( $this->fs->rename($dumpTempFilepath, $dumpFilepath); } - private function compressArchiveDirectory(string $archiveDir, string|bool|array|null $destinationDir, Closure $outputCallback = null): string + private function compressArchiveDirectory(string $archiveDir, string|bool|array|null $destinationDir, ?Closure $outputCallback = null): string { $destinationFilename = basename($archiveDir) . '.tar.gz'; $destinationFilepath = Path::join($destinationDir, $destinationFilename); diff --git a/src/Command/CommandBase.php b/src/Command/CommandBase.php index 61918edbb..68e719fa4 100644 --- a/src/Command/CommandBase.php +++ b/src/Command/CommandBase.php @@ -524,10 +524,9 @@ protected function getLocalFilesDir(string $site): string } /** - * @param string|null $site * @return DatabaseResponse[] */ - protected function determineCloudDatabases(Client $acquiaCloudClient, EnvironmentResponse $chosenEnvironment, string $site = null, bool $multipleDbs = false): array + protected function determineCloudDatabases(Client $acquiaCloudClient, EnvironmentResponse $chosenEnvironment, ?string $site = null, bool $multipleDbs = false): array { $databasesRequest = new Databases($acquiaCloudClient); $databases = $databasesRequest->getAll($chosenEnvironment->uuid); @@ -1592,7 +1591,7 @@ private function composerInstall(?callable $outputCallback): void } } - protected function getDrushDatabaseConnectionStatus(Closure $outputCallback = null): bool + protected function getDrushDatabaseConnectionStatus(?Closure $outputCallback = null): bool { if (isset($this->drushHasActiveDatabaseConnection)) { return $this->drushHasActiveDatabaseConnection; @@ -1619,7 +1618,7 @@ protected function getDrushDatabaseConnectionStatus(Closure $outputCallback = nu return $this->drushHasActiveDatabaseConnection; } - protected function createMySqlDumpOnLocal(string $dbHost, string $dbUser, string $dbName, string $dbPassword, Closure $outputCallback = null): string + protected function createMySqlDumpOnLocal(string $dbHost, string $dbUser, string $dbName, string $dbPassword, ?Closure $outputCallback = null): string { $this->localMachineHelper->checkRequiredBinariesExist([ 'mysqldump', @@ -1857,7 +1856,7 @@ protected function checkAuthentication(): void } } - protected function waitForNotificationToComplete(Client $acquiaCloudClient, string $uuid, string $message, callable $success = null): bool + protected function waitForNotificationToComplete(Client $acquiaCloudClient, string $uuid, string $message, ?callable $success = null): bool { $notificationsResource = new Notifications($acquiaCloudClient); $notification = null; diff --git a/src/Command/Pull/PullCommandBase.php b/src/Command/Pull/PullCommandBase.php index c1edd15cf..387c35cde 100644 --- a/src/Command/Pull/PullCommandBase.php +++ b/src/Command/Pull/PullCommandBase.php @@ -176,7 +176,7 @@ protected function pullFiles(InputInterface $input, OutputInterface $output, Env $this->checklist->completePreviousItem(); } - private function pullCodeFromCloud(EnvironmentResponse $chosenEnvironment, Closure $outputCallback = null): void + private function pullCodeFromCloud(EnvironmentResponse $chosenEnvironment, ?Closure $outputCallback = null): void { $isDirty = $this->isLocalGitRepoDirty(); if ($isDirty) { @@ -195,7 +195,7 @@ private function pullCodeFromCloud(EnvironmentResponse $chosenEnvironment, Closu /** * Checks out the matching branch from a source environment. */ - private function checkoutBranchFromEnv(EnvironmentResponse $environment, Closure $outputCallback = null): void + private function checkoutBranchFromEnv(EnvironmentResponse $environment, ?Closure $outputCallback = null): void { $this->localMachineHelper->checkRequiredBinariesExist(['git']); $this->localMachineHelper->execute([ @@ -211,7 +211,7 @@ private function doImportRemoteDatabase( string $databaseName, string $databasePassword, string $localFilepath, - Closure $outputCallback = null + ?Closure $outputCallback = null ): void { $this->dropDbTables($databaseHost, $databaseUser, $databaseName, $databasePassword, $outputCallback); $this->importDatabaseDump($localFilepath, $databaseHost, $databaseUser, $databaseName, $databasePassword, $outputCallback); @@ -222,7 +222,7 @@ private function downloadDatabaseBackup( EnvironmentResponse $environment, DatabaseResponse $database, BackupResponse $backupResponse, - callable $outputCallback = null + ?callable $outputCallback = null ): string { if ($outputCallback) { $outputCallback('out', "Downloading backup $backupResponse->id"); @@ -357,7 +357,7 @@ protected function waitForBackup(string $notificationUuid, Client $acquiaCloudCl } } - private function connectToLocalDatabase(string $dbHost, string $dbUser, string $dbName, string $dbPassword, callable $outputCallback = null): void + private function connectToLocalDatabase(string $dbHost, string $dbUser, string $dbName, string $dbPassword, ?callable $outputCallback = null): void { if ($outputCallback) { $outputCallback('out', "Connecting to database $dbName"); @@ -425,7 +425,7 @@ private function dropDbTables(string $dbHost, string $dbUser, string $dbName, st } } - private function importDatabaseDump(string $localDumpFilepath, string $dbHost, string $dbUser, string $dbName, string $dbPassword, Closure $outputCallback = null): void + private function importDatabaseDump(string $localDumpFilepath, string $dbHost, string $dbUser, string $dbName, string $dbPassword, ?Closure $outputCallback = null): void { if ($outputCallback) { $outputCallback('out', "Importing downloaded file to database $dbName"); @@ -601,7 +601,7 @@ private function printDatabaseBackupInfo( } } - private function importRemoteDatabase(DatabaseResponse $database, string $localFilepath, Closure $outputCallback = null): void + private function importRemoteDatabase(DatabaseResponse $database, string $localFilepath, ?Closure $outputCallback = null): void { if ($database->flags->default) { // Easy case, import the default db into the default db. diff --git a/src/Command/Push/PushFilesCommand.php b/src/Command/Push/PushFilesCommand.php index 376002571..e60ef31bf 100644 --- a/src/Command/Push/PushFilesCommand.php +++ b/src/Command/Push/PushFilesCommand.php @@ -44,7 +44,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int return Command::SUCCESS; } - private function rsyncFilesToCloud(EnvironmentResponse $chosenEnvironment, callable $outputCallback = null, string $site = null): void + private function rsyncFilesToCloud(EnvironmentResponse $chosenEnvironment, ?callable $outputCallback = null, ?string $site = null): void { $sourceDir = $this->getLocalFilesDir($site); $destinationDir = $chosenEnvironment->sshUrl . ':' . $this->getCloudFilesDir($chosenEnvironment, $site); diff --git a/src/Command/Ssh/SshKeyCommandBase.php b/src/Command/Ssh/SshKeyCommandBase.php index 27398b5d5..b340b31a2 100644 --- a/src/Command/Ssh/SshKeyCommandBase.php +++ b/src/Command/Ssh/SshKeyCommandBase.php @@ -329,8 +329,9 @@ private function keyHasUploaded(Client $acquiaCloudClient, string $publicKey): b /** * @return array + * @throws \Acquia\Cli\Exception\AcquiaCliException */ - protected function determinePublicSshKey(string $filepath = null): array + protected function determinePublicSshKey(?string $filepath = null): array { if ($filepath) { $filepath = $this->localMachineHelper->getLocalFilepath($filepath); diff --git a/src/DataStore/JsonDataStore.php b/src/DataStore/JsonDataStore.php index 896e99831..659fae004 100644 --- a/src/DataStore/JsonDataStore.php +++ b/src/DataStore/JsonDataStore.php @@ -10,10 +10,8 @@ class JsonDataStore extends Datastore { /** * Creates a new store. - * - * @param \Symfony\Component\Config\Definition\ConfigurationInterface|null $configDefinition */ - public function __construct(string $path, ConfigurationInterface $configDefinition = null) + public function __construct(string $path, ?ConfigurationInterface $configDefinition = null) { parent::__construct($path); if ($this->fileSystem->exists($path)) { diff --git a/src/DataStore/YamlStore.php b/src/DataStore/YamlStore.php index c9040bda3..e021e666c 100644 --- a/src/DataStore/YamlStore.php +++ b/src/DataStore/YamlStore.php @@ -11,10 +11,8 @@ class YamlStore extends Datastore { /** * Creates a new store. - * - * @param \Symfony\Component\Config\Definition\ConfigurationInterface|null $configDefinition */ - public function __construct(string $path, ConfigurationInterface $configDefinition = null) + public function __construct(string $path, ?ConfigurationInterface $configDefinition = null) { parent::__construct($path); if ($this->fileSystem->exists($path)) { diff --git a/src/Helpers/LocalMachineHelper.php b/src/Helpers/LocalMachineHelper.php index 1712bb36b..fc2022a8d 100644 --- a/src/Helpers/LocalMachineHelper.php +++ b/src/Helpers/LocalMachineHelper.php @@ -79,7 +79,7 @@ public function checkRequiredBinariesExist(array $binaries = []): void /** * Executes a buffered command. */ - public function execute(array $cmd, callable $callback = null, string $cwd = null, ?bool $printOutput = true, float $timeout = null, array $env = null, bool $stdin = true): Process + public function execute(array $cmd, ?callable $callback = null, ?string $cwd = null, ?bool $printOutput = true, ?float $timeout = null, ?array $env = null, bool $stdin = true): Process { $process = new Process($cmd); $process = $this->configureProcess($process, $cwd, $printOutput, $timeout, $env, $stdin); @@ -95,12 +95,9 @@ public function execute(array $cmd, callable $callback = null, string $cwd = nul * * Windows does not support prepending commands with environment variables. * - * @param callable|null $callback - * @param string|null $cwd - * @param int|null $timeout * @param array|null $env */ - public function executeFromCmd(string $cmd, callable $callback = null, string $cwd = null, ?bool $printOutput = true, int $timeout = null, array $env = null): Process + public function executeFromCmd(string $cmd, ?callable $callback = null, ?string $cwd = null, ?bool $printOutput = true, ?int $timeout = null, ?array $env = null): Process { $process = Process::fromShellCommandline($cmd); $process = $this->configureProcess($process, $cwd, $printOutput, $timeout, $env); @@ -109,10 +106,9 @@ public function executeFromCmd(string $cmd, callable $callback = null, string $c } /** - * @param string|null $cwd * @param array|null $env */ - private function configureProcess(Process $process, string $cwd = null, ?bool $printOutput = true, float $timeout = null, array $env = null, bool $stdin = true): Process + private function configureProcess(Process $process, ?string $cwd = null, ?bool $printOutput = true, ?float $timeout = null, ?array $env = null, bool $stdin = true): Process { if (function_exists('posix_isatty') && $stdin && !@posix_isatty(STDIN)) { $process->setInput(STDIN); @@ -131,7 +127,7 @@ private function configureProcess(Process $process, string $cwd = null, ?bool $p return $process; } - private function executeProcess(Process $process, callable $callback = null, ?bool $printOutput = true): Process + private function executeProcess(Process $process, ?callable $callback = null, ?bool $printOutput = true): Process { if ($callback === null && $printOutput !== false) { $callback = function (mixed $type, mixed $buffer): void { @@ -366,7 +362,7 @@ public function isBrowserAvailable(): bool * by the user or a default browser could not be found. * @infection-ignore-all */ - public function startBrowser(string $uri = null, string $browser = null): bool + public function startBrowser(?string $uri = null, ?string $browser = null): bool { // We can only open a browser if we have a DISPLAY environment variable on // POSIX or are running Windows or OS X. diff --git a/src/Helpers/SshHelper.php b/src/Helpers/SshHelper.php index e1471e597..5ee12d357 100644 --- a/src/Helpers/SshHelper.php +++ b/src/Helpers/SshHelper.php @@ -28,10 +28,8 @@ public function __construct( /** * Execute the command in a remote environment. - * - * @param int|null $timeout */ - public function executeCommand(string $sshUrl, array $commandArgs, bool $printOutput = true, int $timeout = null): Process + public function executeCommand(string $sshUrl, array $commandArgs, bool $printOutput = true, ?int $timeout = null): Process { $commandSummary = $this->getCommandSummary($commandArgs); From 9f54b098c61c2636b17d21100b6fbb64eb8a5d0c Mon Sep 17 00:00:00 2001 From: Dane Powell Date: Tue, 26 Nov 2024 11:27:28 -0800 Subject: [PATCH 2/3] CLI-1417: TypeError when applications are not provisioned (#1835) --- src/Command/CommandBase.php | 4 ++-- src/Command/Push/PushArtifactCommand.php | 7 ++++++- src/Command/Ssh/SshKeyCommandBase.php | 7 ++++--- src/EventListener/ExceptionListener.php | 3 +++ 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/Command/CommandBase.php b/src/Command/CommandBase.php index 68e719fa4..43c9982a1 100644 --- a/src/Command/CommandBase.php +++ b/src/Command/CommandBase.php @@ -1801,12 +1801,12 @@ protected function getAnyProdAhEnvironment(string $cloudAppUuid): EnvironmentRes /** * Get the first VCS URL for a given Cloud application. */ - protected function getAnyVcsUrl(string $cloudAppUuid): string + protected function getAnyVcsUrl(string $cloudAppUuid): string|false { $environment = $this->getAnyAhEnvironment($cloudAppUuid, function (): bool { return true; }); - return $environment->vcs->url; + return $environment ? $environment->vcs->url : false; } protected function validateApplicationUuid(string $applicationUuidArgument): mixed diff --git a/src/Command/Push/PushArtifactCommand.php b/src/Command/Push/PushArtifactCommand.php index 389c42b05..e7b901a09 100644 --- a/src/Command/Push/PushArtifactCommand.php +++ b/src/Command/Push/PushArtifactCommand.php @@ -151,6 +151,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int /** * @return string[] + * @throws \Acquia\Cli\Exception\AcquiaCliException */ private function determineDestinationGitUrls(): array { @@ -165,7 +166,11 @@ private function determineDestinationGitUrls(): array } $applicationUuid = $this->determineCloudApplication(); - return [$this->getAnyVcsUrl($applicationUuid)]; + if ($vcsUrl = $this->getAnyVcsUrl($applicationUuid)) { + return [$vcsUrl]; + } + + throw new AcquiaCliException('No environments found for this application'); } /** diff --git a/src/Command/Ssh/SshKeyCommandBase.php b/src/Command/Ssh/SshKeyCommandBase.php index b340b31a2..d9e667fee 100644 --- a/src/Command/Ssh/SshKeyCommandBase.php +++ b/src/Command/Ssh/SshKeyCommandBase.php @@ -199,9 +199,10 @@ private function checkPermissions(array $userPerms, string $cloudAppUuid, Output if (in_array($requiredPerm, $userPerms, true)) { switch ($requiredPerm) { case 'add ssh key to git': - $fullUrl = $this->getAnyVcsUrl($cloudAppUuid); - $urlParts = explode(':', $fullUrl); - $mappings['git']['ssh_target'] = $urlParts[0]; + if ($fullUrl = $this->getAnyVcsUrl($cloudAppUuid)) { + $urlParts = explode(':', $fullUrl); + $mappings['git']['ssh_target'] = $urlParts[0]; + } break; case 'add ssh key to non-prod': if ($nonProdEnv = $this->getAnyNonProdAhEnvironment($cloudAppUuid)) { diff --git a/src/EventListener/ExceptionListener.php b/src/EventListener/ExceptionListener.php index 07141fdab..d69994f78 100644 --- a/src/EventListener/ExceptionListener.php +++ b/src/EventListener/ExceptionListener.php @@ -79,6 +79,9 @@ public function onConsoleError(ConsoleErrorEvent $event): void case 'Database connection details missing': $this->helpMessages[] = 'Check that you have the \'View database connection details\' permission'; break; + case 'No environments found for this application': + $this->helpMessages[] = 'Check that the application has finished provisioning'; + break; } } From 449792dc0cdeed756767f8004f2262384402c420 Mon Sep 17 00:00:00 2001 From: Dane Powell Date: Tue, 26 Nov 2024 12:26:41 -0800 Subject: [PATCH 3/3] more php 8.4 fixes --- composer.json | 25 +- composer.lock | 346 +++++++++++------- phpunit.xml.dist | 2 +- src/Helpers/AliasCache.php | 2 +- .../src/Commands/Ide/IdeDeleteCommandTest.php | 2 +- .../src/Commands/Ide/IdeShareCommandTest.php | 2 +- .../src/Commands/Pull/PullCommandTestBase.php | 2 +- .../Remote/AliasesDownloadCommandTest.php | 3 +- tests/phpunit/src/TestBase.php | 2 +- 9 files changed, 238 insertions(+), 148 deletions(-) diff --git a/composer.json b/composer.json index 61310ac0b..a9d08e99c 100644 --- a/composer.json +++ b/composer.json @@ -16,6 +16,18 @@ }, { "type": "vcs", "url": "https://github.com/Ayesh/safe" + }, + { + "type": "vcs", "url": "https://github.com/valzargaming/Pawl" + }, + { + "type": "vcs", "url": "https://github.com/danepowell/phplint" + }, + { + "type": "vcs", "url": "https://github.com/danepowell/Client" + }, + { + "type": "vcs", "url": "https://github.com/danepowell/dns-zone-configurator" } ], "minimum-stability": "dev", @@ -30,16 +42,19 @@ "grasmash/expander": "^3.0.1", "guzzlehttp/guzzle": "^7.4", "http-interop/http-factory-guzzle": "^1.0", + "kevinrob/guzzle-cache-middleware": "dev-master as 5.1.0", "laminas/laminas-validator": "^2.20.0", "league/csv": "^9.8", "league/oauth2-client": "dev-patch-1 as 2.7.0", "loophp/phposinfo": "^1.7.2", - "ltd-beget/dns-zone-configurator": "^1.3.0", - "m4tthumphrey/php-gitlab-api": "^11.5", + "ltd-beget/dns-zone-configurator": "dev-php84", + "m4tthumphrey/php-gitlab-api": "dev-fix/84", "php-http/cache-plugin": "^2.0", "psr/log": "^3", "ramsey/uuid": "^4.1", + "ratchet/pawl": "dev-patch-1 as 0.4.1", "react/event-loop": "^1.1", + "sanmai/pipeline": "dev-main", "symfony/cache": "^6.3", "symfony/config": "^6.3", "symfony/console": "^6.3", @@ -56,7 +71,7 @@ "symfony/yaml": "^6.3", "thecodingmachine/safe": "dev-php84/nullability as 2.5.0", "typhonius/acquia-logstream": "^0.0.14", - "typhonius/acquia-php-sdk-v2": "^3.4.1", + "typhonius/acquia-php-sdk-v2": "^3.4.2", "vlucas/phpdotenv": "^5.5", "zumba/amplitude-php": "^1.0.4" }, @@ -68,8 +83,8 @@ "infection/infection": "^0.27.7", "jangregor/phpstan-prophecy": "^1.0", "mikey179/vfsstream": "^1.6", - "overtrue/phplint": "^9.0", - "phpro/grumphp": "^2.2.0", + "overtrue/phplint": "9.4.x-dev", + "phpro/grumphp": "2.x-dev", "phpspec/prophecy": "^1.17", "phpspec/prophecy-phpunit": "^2.0", "phpstan/extension-installer": "^1.1", diff --git a/composer.lock b/composer.lock index 7b6dea3a7..4db11d366 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "71b2dc1d9fc88eee892361edecfd0add", + "content-hash": "67e29456aa1ad9493edd27e9fbcca50c", "packages": [ { "name": "acquia/drupal-environment-detector", @@ -1083,23 +1083,23 @@ }, { "name": "kevinrob/guzzle-cache-middleware", - "version": "v5.1.0", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/Kevinrob/guzzle-cache-middleware.git", - "reference": "6bd64dbbe5155107d84a0f67140a8822a709c6d0" + "reference": "61305ed694e763e887a04f61e71e2292bb4fbad1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Kevinrob/guzzle-cache-middleware/zipball/6bd64dbbe5155107d84a0f67140a8822a709c6d0", - "reference": "6bd64dbbe5155107d84a0f67140a8822a709c6d0", + "url": "https://api.github.com/repos/Kevinrob/guzzle-cache-middleware/zipball/61305ed694e763e887a04f61e71e2292bb4fbad1", + "reference": "61305ed694e763e887a04f61e71e2292bb4fbad1", "shasum": "" }, "require": { - "guzzlehttp/guzzle": "^6.0 || ^7.0", - "guzzlehttp/promises": "^1.4 || ^2.0", - "guzzlehttp/psr7": "^1.7.0 || ^2.0.0", - "php": ">=7.2.0" + "guzzlehttp/guzzle": "^7.9.2", + "guzzlehttp/promises": "^2.0.3", + "guzzlehttp/psr7": "^2.7.0", + "php": ">=8.1" }, "require-dev": { "cache/array-adapter": "^0.4 || ^0.5 || ^1.0", @@ -1107,10 +1107,10 @@ "doctrine/cache": "^1.10", "illuminate/cache": "^5.0", "league/flysystem": "^2.5", - "phpunit/phpunit": "^8.5.15 || ^9.5", + "phpunit/phpunit": "^9.6.21", "psr/cache": "^1.0", "symfony/cache": "^4.4 || ^5.0", - "symfony/phpunit-bridge": "^4.4 || ^5.0" + "symfony/phpunit-bridge": "^7.1.4" }, "suggest": { "doctrine/cache": "This library has a lot of ready-to-use cache storage (to be used with Kevinrob\\GuzzleCache\\Storage\\DoctrineCacheStorage). Use only versions >=1.4.0 < 2.0.0", @@ -1120,6 +1120,7 @@ "psr/cache": "To be used with Kevinrob\\GuzzleCache\\Storage\\Psr6CacheStorage", "psr/simple-cache": "To be used with Kevinrob\\GuzzleCache\\Storage\\Psr16CacheStorage" }, + "default-branch": true, "type": "library", "autoload": { "psr-4": { @@ -1162,9 +1163,9 @@ ], "support": { "issues": "https://github.com/Kevinrob/guzzle-cache-middleware/issues", - "source": "https://github.com/Kevinrob/guzzle-cache-middleware/tree/v5.1.0" + "source": "https://github.com/Kevinrob/guzzle-cache-middleware/tree/master" }, - "time": "2023-11-09T06:53:45+00:00" + "time": "2024-10-17T09:11:54+00:00" }, { "name": "laminas/laminas-servicemanager", @@ -1654,16 +1655,16 @@ }, { "name": "ltd-beget/dns-zone-configurator", - "version": "v1.3.0", + "version": "dev-php84", "source": { "type": "git", - "url": "https://github.com/LTD-Beget/dns-zone-configurator.git", - "reference": "6fae81d140be8594b4752474d7ccf251bcd5e64f" + "url": "https://github.com/danepowell/dns-zone-configurator.git", + "reference": "4a52ba1ad16e3c11e26bc551811e93e1dc34ea30" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/LTD-Beget/dns-zone-configurator/zipball/6fae81d140be8594b4752474d7ccf251bcd5e64f", - "reference": "6fae81d140be8594b4752474d7ccf251bcd5e64f", + "url": "https://api.github.com/repos/danepowell/dns-zone-configurator/zipball/4a52ba1ad16e3c11e26bc551811e93e1dc34ea30", + "reference": "4a52ba1ad16e3c11e26bc551811e93e1dc34ea30", "shasum": "" }, "require": { @@ -1682,7 +1683,11 @@ "LTDBeget\\dns": "src" } }, - "notification-url": "https://packagist.org/downloads/", + "autoload-dev": { + "psr-0": { + "LTDBeget\\dev": "src" + } + }, "license": [ "MIT" ], @@ -1698,10 +1703,9 @@ "zone file" ], "support": { - "issues": "https://github.com/LTD-Beget/dns-zone-configurator/issues", - "source": "https://github.com/LTD-Beget/dns-zone-configurator/tree/v1.3.0" + "source": "https://github.com/danepowell/dns-zone-configurator/tree/php84" }, - "time": "2023-05-15T15:34:16+00:00" + "time": "2024-11-26T20:14:48+00:00" }, { "name": "ltd-beget/dns-zone-tokenizer", @@ -1804,16 +1808,16 @@ }, { "name": "m4tthumphrey/php-gitlab-api", - "version": "11.14.0", + "version": "dev-fix/84", "source": { "type": "git", - "url": "https://github.com/GitLabPHP/Client.git", - "reference": "6b805882e1478873cc89ee62d2decf74eee2d5f2" + "url": "https://github.com/danepowell/Client.git", + "reference": "69ec4e557a837281fca484899447f4b09e410f11" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/GitLabPHP/Client/zipball/6b805882e1478873cc89ee62d2decf74eee2d5f2", - "reference": "6b805882e1478873cc89ee62d2decf74eee2d5f2", + "url": "https://api.github.com/repos/danepowell/Client/zipball/69ec4e557a837281fca484899447f4b09e410f11", + "reference": "69ec4e557a837281fca484899447f4b09e410f11", "shasum": "" }, "require": { @@ -1849,7 +1853,11 @@ "Gitlab\\": "src/" } }, - "notification-url": "https://packagist.org/downloads/", + "autoload-dev": { + "psr-4": { + "Gitlab\\Tests\\": "tests/" + } + }, "license": [ "MIT" ], @@ -1881,16 +1889,15 @@ "gitlab" ], "support": { - "issues": "https://github.com/GitLabPHP/Client/issues", - "source": "https://github.com/GitLabPHP/Client/tree/11.14.0" + "source": "https://github.com/danepowell/Client/tree/fix/84" }, "funding": [ { - "url": "https://github.com/GrahamCampbell", - "type": "github" + "type": "github", + "url": "https://github.com/GrahamCampbell" } ], - "time": "2024-03-17T21:35:56+00:00" + "time": "2024-11-26T20:22:05+00:00" }, { "name": "marc-mabe/php-enum", @@ -3111,16 +3118,16 @@ }, { "name": "ratchet/pawl", - "version": "v0.4.1", + "version": "dev-patch-1", "source": { "type": "git", - "url": "https://github.com/ratchetphp/Pawl.git", - "reference": "af70198bab77a582b31169d3cc3982bed25c161f" + "url": "https://github.com/valzargaming/Pawl.git", + "reference": "06faa033fd8f210f90b57a7dfc4e772ad4d411ba" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ratchetphp/Pawl/zipball/af70198bab77a582b31169d3cc3982bed25c161f", - "reference": "af70198bab77a582b31169d3cc3982bed25c161f", + "url": "https://api.github.com/repos/valzargaming/Pawl/zipball/06faa033fd8f210f90b57a7dfc4e772ad4d411ba", + "reference": "06faa033fd8f210f90b57a7dfc4e772ad4d411ba", "shasum": "" }, "require": { @@ -3138,30 +3145,28 @@ }, "type": "library", "autoload": { - "files": [ - "src/functions_include.php" - ], "psr-4": { "Ratchet\\Client\\": "src" - } + }, + "files": [ + "src/functions_include.php" + ] }, - "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "description": "Asynchronous WebSocket client", "keywords": [ "Ratchet", + "WebSocket", "async", "client", - "websocket", "websocket client" ], "support": { - "issues": "https://github.com/ratchetphp/Pawl/issues", - "source": "https://github.com/ratchetphp/Pawl/tree/v0.4.1" + "source": "https://github.com/valzargaming/Pawl/tree/patch-1" }, - "time": "2021-12-10T14:32:34+00:00" + "time": "2024-11-21T19:08:01+00:00" }, { "name": "ratchet/rfc6455", @@ -3671,6 +3676,72 @@ ], "time": "2024-06-11T12:45:25+00:00" }, + { + "name": "sanmai/pipeline", + "version": "dev-main", + "source": { + "type": "git", + "url": "https://github.com/sanmai/pipeline.git", + "reference": "ad7dbc3f773eeafb90d5459522fbd8f188532e25" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sanmai/pipeline/zipball/ad7dbc3f773eeafb90d5459522fbd8f188532e25", + "reference": "ad7dbc3f773eeafb90d5459522fbd8f188532e25", + "shasum": "" + }, + "require": { + "php": "^7.4 || ^8.0" + }, + "require-dev": { + "ergebnis/composer-normalize": "^2.8", + "friendsofphp/php-cs-fixer": "^3.17", + "infection/infection": ">=0.10.5", + "league/pipeline": "^0.3 || ^1.0", + "phan/phan": ">=1.1", + "php-coveralls/php-coveralls": "^2.4.1", + "phpstan/phpstan": ">=0.10", + "phpunit/phpunit": ">=9.4", + "vimeo/psalm": ">=2" + }, + "default-branch": true, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "v6.x-dev" + } + }, + "autoload": { + "files": [ + "src/functions.php" + ], + "psr-4": { + "Pipeline\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Alexey Kopytko", + "email": "alexey@kopytko.com" + } + ], + "description": "General-purpose collections pipeline", + "support": { + "issues": "https://github.com/sanmai/pipeline/issues", + "source": "https://github.com/sanmai/pipeline/tree/main" + }, + "funding": [ + { + "url": "https://github.com/sanmai", + "type": "github" + } + ], + "time": "2024-10-17T02:22:57+00:00" + }, { "name": "symfony/cache", "version": "v6.4.14", @@ -6304,16 +6375,16 @@ }, { "name": "typhonius/acquia-php-sdk-v2", - "version": "3.4.1", + "version": "3.4.2", "source": { "type": "git", "url": "https://github.com/typhonius/acquia-php-sdk-v2.git", - "reference": "c3acefe27f4abd39111c43b96e9c35d672df6f4e" + "reference": "52dd11bb04ed1bdcbb4c7b2316d1f3f7a999da6b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/typhonius/acquia-php-sdk-v2/zipball/c3acefe27f4abd39111c43b96e9c35d672df6f4e", - "reference": "c3acefe27f4abd39111c43b96e9c35d672df6f4e", + "url": "https://api.github.com/repos/typhonius/acquia-php-sdk-v2/zipball/52dd11bb04ed1bdcbb4c7b2316d1f3f7a999da6b", + "reference": "52dd11bb04ed1bdcbb4c7b2316d1f3f7a999da6b", "shasum": "" }, "require": { @@ -6357,7 +6428,7 @@ "description": "A PHP SDK for Acquia CloudAPI v2", "support": { "issues": "https://github.com/typhonius/acquia-php-sdk-v2/issues", - "source": "https://github.com/typhonius/acquia-php-sdk-v2/tree/3.4.1" + "source": "https://github.com/typhonius/acquia-php-sdk-v2/tree/3.4.2" }, "funding": [ { @@ -6365,7 +6436,7 @@ "type": "github" } ], - "time": "2024-11-25T23:17:17+00:00" + "time": "2024-11-26T20:04:52+00:00" }, { "name": "vlucas/phpdotenv", @@ -9874,16 +9945,16 @@ }, { "name": "overtrue/phplint", - "version": "9.4.2", + "version": "9.4.x-dev", "source": { "type": "git", - "url": "https://github.com/overtrue/phplint.git", - "reference": "bb849f012fa44839f5ba4a079dda6d2ef29d6fce" + "url": "https://github.com/danepowell/phplint.git", + "reference": "ef023610ba6d53d4e855155fe2e977730645fc51" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/overtrue/phplint/zipball/bb849f012fa44839f5ba4a079dda6d2ef29d6fce", - "reference": "bb849f012fa44839f5ba4a079dda6d2ef29d6fce", + "url": "https://api.github.com/repos/danepowell/phplint/zipball/ef023610ba6d53d4e855155fe2e977730645fc51", + "reference": "ef023610ba6d53d4e855155fe2e977730645fc51", "shasum": "" }, "require": { @@ -9933,7 +10004,58 @@ "Overtrue\\PHPLint\\": "src/" } }, - "notification-url": "https://packagist.org/downloads/", + "autoload-dev": { + "psr-4": { + "Overtrue\\PHPLint\\Tests\\": "tests/" + } + }, + "scripts": { + "bin": [ + "echo 'bin not installed'" + ], + "post-update-cmd": [ + "cghooks update", + "@composer bin all update --ansi" + ], + "post-merge": [ + "composer install" + ], + "post-install-cmd": [ + "cghooks add --ignore-lock", + "cghooks update", + "@composer bin all install --ansi" + ], + "cghooks": [ + "vendor/bin/cghooks" + ], + "qa:check": [ + "vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.release.php --using-cache=no --verbose --ansi --diff --dry-run" + ], + "qa:fix": [ + "vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.release.php --using-cache=no --verbose --ansi" + ], + "style:check": [ + "vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php --using-cache=no --verbose --ansi --diff --dry-run" + ], + "style:fix": [ + "vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php --using-cache=no --verbose --ansi" + ], + "tests:unit": [ + "vendor/bin/phpunit --testsuite=cache,configuration,finder" + ], + "tests:e2e": [ + "vendor/bin/phpunit --testsuite=e2e" + ], + "tests:all": [ + "vendor/bin/phpunit" + ], + "lint:syntax": [ + "./bin/phplint --ansi" + ], + "code:check": [ + "vendor/bin/phpstan analyse --configuration phpstan.neon.dist" + ] + }, "license": [ "MIT" ], @@ -9956,16 +10078,15 @@ "syntax" ], "support": { - "issues": "https://github.com/overtrue/phplint/issues", - "source": "https://github.com/overtrue/phplint/tree/9.4.2" + "source": "https://github.com/danepowell/phplint/tree/9.4" }, "funding": [ { - "url": "https://github.com/overtrue", - "type": "github" + "type": "github", + "url": "https://github.com/overtrue" } ], - "time": "2024-10-11T07:44:07+00:00" + "time": "2024-11-26T19:50:06+00:00" }, { "name": "phar-io/manifest", @@ -10324,16 +10445,16 @@ }, { "name": "phpro/grumphp", - "version": "v2.9.0", + "version": "v2.x-dev", "source": { "type": "git", "url": "https://github.com/phpro/grumphp.git", - "reference": "14117189d0c1ce622eabec52b51edab56f1715fc" + "reference": "d84698882accd3fd0a807fb48a8838b0f53aa732" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpro/grumphp/zipball/14117189d0c1ce622eabec52b51edab56f1715fc", - "reference": "14117189d0c1ce622eabec52b51edab56f1715fc", + "url": "https://api.github.com/repos/phpro/grumphp/zipball/d84698882accd3fd0a807fb48a8838b0f53aa732", + "reference": "d84698882accd3fd0a807fb48a8838b0f53aa732", "shasum": "" }, "require": { @@ -10407,6 +10528,7 @@ "vimeo/psalm": "Lets GrumPHP discover errors in your code without running it.", "vincentlanglet/twig-cs-fixer": "Lets GrumPHP check and fix twig coding standard." }, + "default-branch": true, "bin": [ "bin/grumphp" ], @@ -10436,9 +10558,9 @@ "description": "A composer plugin that enables source code quality checks.", "support": { "issues": "https://github.com/phpro/grumphp/issues", - "source": "https://github.com/phpro/grumphp/tree/v2.9.0" + "source": "https://github.com/phpro/grumphp/tree/v2.x" }, - "time": "2024-10-25T10:11:05+00:00" + "time": "2024-11-26T14:22:31+00:00" }, { "name": "phpspec/prophecy", @@ -11374,71 +11496,6 @@ ], "time": "2023-10-24T00:25:28+00:00" }, - { - "name": "sanmai/pipeline", - "version": "v6.11", - "source": { - "type": "git", - "url": "https://github.com/sanmai/pipeline.git", - "reference": "a5fa2a6c6ca93efa37e7c24aab72f47448a6b110" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sanmai/pipeline/zipball/a5fa2a6c6ca93efa37e7c24aab72f47448a6b110", - "reference": "a5fa2a6c6ca93efa37e7c24aab72f47448a6b110", - "shasum": "" - }, - "require": { - "php": "^7.4 || ^8.0" - }, - "require-dev": { - "ergebnis/composer-normalize": "^2.8", - "friendsofphp/php-cs-fixer": "^3.17", - "infection/infection": ">=0.10.5", - "league/pipeline": "^0.3 || ^1.0", - "phan/phan": ">=1.1", - "php-coveralls/php-coveralls": "^2.4.1", - "phpstan/phpstan": ">=0.10", - "phpunit/phpunit": ">=9.4", - "vimeo/psalm": ">=2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "v6.x-dev" - } - }, - "autoload": { - "files": [ - "src/functions.php" - ], - "psr-4": { - "Pipeline\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "Alexey Kopytko", - "email": "alexey@kopytko.com" - } - ], - "description": "General-purpose collections pipeline", - "support": { - "issues": "https://github.com/sanmai/pipeline/issues", - "source": "https://github.com/sanmai/pipeline/tree/v6.11" - }, - "funding": [ - { - "url": "https://github.com/sanmai", - "type": "github" - } - ], - "time": "2024-06-15T03:11:19+00:00" - }, { "name": "sebastian/cli-parser", "version": "2.0.1", @@ -13204,12 +13261,24 @@ } ], "aliases": [ + { + "package": "kevinrob/guzzle-cache-middleware", + "version": "9999999-dev", + "alias": "5.1.0", + "alias_normalized": "5.1.0.0" + }, { "package": "league/oauth2-client", "version": "dev-patch-1", "alias": "2.7.0", "alias_normalized": "2.7.0.0" }, + { + "package": "ratchet/pawl", + "version": "dev-patch-1", + "alias": "0.4.1", + "alias_normalized": "0.4.1.0" + }, { "package": "thecodingmachine/safe", "version": "dev-php84/nullability", @@ -13219,7 +13288,14 @@ ], "minimum-stability": "dev", "stability-flags": { + "kevinrob/guzzle-cache-middleware": 20, "league/oauth2-client": 20, + "ltd-beget/dns-zone-configurator": 20, + "m4tthumphrey/php-gitlab-api": 20, + "overtrue/phplint": 20, + "phpro/grumphp": 20, + "ratchet/pawl": 20, + "sanmai/pipeline": 20, "thecodingmachine/safe": 20 }, "prefer-stable": true, diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 0ad593200..2f5d6be9c 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,6 +1,6 @@ - + diff --git a/src/Helpers/AliasCache.php b/src/Helpers/AliasCache.php index c507d910f..a3f64256b 100644 --- a/src/Helpers/AliasCache.php +++ b/src/Helpers/AliasCache.php @@ -8,7 +8,7 @@ class AliasCache extends FilesystemAdapter { - public function get(string $key, callable $callback, float $beta = null, array &$metadata = null): mixed + public function get(string $key, callable $callback, ?float $beta = null, ?array &$metadata = null): mixed { // Aliases format is `realm:name.env`, but `:` is not a legal character. $key = str_replace(':', '.', $key); diff --git a/tests/phpunit/src/Commands/Ide/IdeDeleteCommandTest.php b/tests/phpunit/src/Commands/Ide/IdeDeleteCommandTest.php index 7ecf81839..30c2c0255 100644 --- a/tests/phpunit/src/Commands/Ide/IdeDeleteCommandTest.php +++ b/tests/phpunit/src/Commands/Ide/IdeDeleteCommandTest.php @@ -18,7 +18,7 @@ class IdeDeleteCommandTest extends CommandTestBase /** * This method is called before each test. */ - public function setUp(OutputInterface $output = null): void + public function setUp(?OutputInterface $output = null): void { parent::setUp(); $this->getCommandTester(); diff --git a/tests/phpunit/src/Commands/Ide/IdeShareCommandTest.php b/tests/phpunit/src/Commands/Ide/IdeShareCommandTest.php index 09f76aa57..062fba839 100644 --- a/tests/phpunit/src/Commands/Ide/IdeShareCommandTest.php +++ b/tests/phpunit/src/Commands/Ide/IdeShareCommandTest.php @@ -26,7 +26,7 @@ class IdeShareCommandTest extends CommandTestBase /** * This method is called before each test. */ - public function setUp(OutputInterface $output = null): void + public function setUp(?OutputInterface $output = null): void { parent::setUp(); $this->shareCode = 'a47ac10b-58cc-4372-a567-0e02b2c3d470'; diff --git a/tests/phpunit/src/Commands/Pull/PullCommandTestBase.php b/tests/phpunit/src/Commands/Pull/PullCommandTestBase.php index 77f334c3c..7800f7915 100644 --- a/tests/phpunit/src/Commands/Pull/PullCommandTestBase.php +++ b/tests/phpunit/src/Commands/Pull/PullCommandTestBase.php @@ -56,7 +56,7 @@ protected function mockExecuteDrushExists( protected function mockExecuteDrushStatus( ObjectProphecy $localMachineHelper, - string $dir = null + ?string $dir = null ): void { $drushStatusProcess = $this->prophet->prophesize(Process::class); $drushStatusProcess->isSuccessful()->willReturn(true); diff --git a/tests/phpunit/src/Commands/Remote/AliasesDownloadCommandTest.php b/tests/phpunit/src/Commands/Remote/AliasesDownloadCommandTest.php index 282480466..d3c4780a1 100644 --- a/tests/phpunit/src/Commands/Remote/AliasesDownloadCommandTest.php +++ b/tests/phpunit/src/Commands/Remote/AliasesDownloadCommandTest.php @@ -46,11 +46,10 @@ public static function providerTestRemoteAliasesDownloadCommand(): array } /** - * @param string|null $destinationDir * @param bool $all Download aliases for all applications. * @dataProvider providerTestRemoteAliasesDownloadCommand */ - public function testRemoteAliasesDownloadCommand(array $inputs, array $args, string $destinationDir = null, bool $all = false): void + public function testRemoteAliasesDownloadCommand(array $inputs, array $args, ?string $destinationDir = null, bool $all = false): void { $aliasVersion = $inputs[0]; diff --git a/tests/phpunit/src/TestBase.php b/tests/phpunit/src/TestBase.php index c110a18ba..afeb79221 100644 --- a/tests/phpunit/src/TestBase.php +++ b/tests/phpunit/src/TestBase.php @@ -478,7 +478,7 @@ protected function createMockAcliConfigFile(mixed $cloudAppUuid = null): void * @throws \JsonException * @throws \Exception */ - protected function mockRequest(string $operationId, string|array|null $params = null, ?array $body = null, ?string $exampleResponse = null, Closure $tamper = null): object|array + protected function mockRequest(string $operationId, string|array|null $params = null, ?array $body = null, ?string $exampleResponse = null, ?Closure $tamper = null): object|array { if (is_string($params)) { $params = [$params];