From 4a81baa9b72f736264516cc175d9a33c14d5cf8a Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Tue, 20 Aug 2024 08:23:10 -0700 Subject: [PATCH 1/6] chore: better multiline fixer rules --- .github/workflows/code-standards.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/code-standards.yml b/.github/workflows/code-standards.yml index 84190e5..e4918b2 100644 --- a/.github/workflows/code-standards.yml +++ b/.github/workflows/code-standards.yml @@ -23,10 +23,6 @@ on: "ordered_imports": true, "new_with_parentheses": true, "whitespace_after_comma_in_array": true, - "method_argument_space": { - "keep_multiple_spaces_after_comma": true, - "on_multiline": "ignore" - }, "return_type_declaration": {"space_before": "none"}, "single_quote": true } From 2336c4709856d094f0b0c31f5fb6f17fcfee0d61 Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Tue, 20 Aug 2024 09:39:32 -0700 Subject: [PATCH 2/6] add single_space_around_construct, order alphabetically --- .github/workflows/code-standards.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/code-standards.yml b/.github/workflows/code-standards.yml index e4918b2..3fa15ec 100644 --- a/.github/workflows/code-standards.yml +++ b/.github/workflows/code-standards.yml @@ -19,12 +19,13 @@ on: "@PSR2": true, "array_syntax": {"syntax":"short"}, "concat_space": {"spacing":"one"}, + "new_with_parentheses": true, "no_unused_imports": true, "ordered_imports": true, - "new_with_parentheses": true, - "whitespace_after_comma_in_array": true, "return_type_declaration": {"space_before": "none"}, - "single_quote": true + "single_quote": true, + "single_space_around_construct": true, + "whitespace_after_comma_in_array": true } permissions: From 4e4272f493826a4dad7d8fae3b70cd426e698e11 Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Tue, 20 Aug 2024 09:48:24 -0700 Subject: [PATCH 3/6] update cs to match --- .php-cs-fixer.dist.php | 16 ++++++++++++++++ composer.json | 3 ++- src/TestUtils/TestTrait.php | 3 ++- src/Utils/Flex/FlexExecCommand.php | 2 +- src/Utils/Project.php | 4 +++- src/Utils/WordPress/Project.php | 12 ++++++++---- src/Utils/WordPress/files/wp-config.php | 14 +++++++------- 7 files changed, 39 insertions(+), 15 deletions(-) create mode 100644 .php-cs-fixer.dist.php diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php new file mode 100644 index 0000000..a78af4a --- /dev/null +++ b/.php-cs-fixer.dist.php @@ -0,0 +1,16 @@ +setRules($rules) + ->setFinder( + PhpCsFixer\Finder::create() + ->in(__DIR__) + ) +; diff --git a/composer.json b/composer.json index 5b494b5..1720168 100644 --- a/composer.json +++ b/composer.json @@ -43,6 +43,7 @@ "friendsofphp/php-cs-fixer": "^3.62", "google/cloud-dlp": "^1.10", "google/cloud-storage": "^1.33", - "google/cloud-secret-manager": "^1.12" + "google/cloud-secret-manager": "^1.12", + "symfony/yaml": "^6.4" } } diff --git a/src/TestUtils/TestTrait.php b/src/TestUtils/TestTrait.php index 28345cf..95ac9ba 100644 --- a/src/TestUtils/TestTrait.php +++ b/src/TestUtils/TestTrait.php @@ -50,7 +50,8 @@ private static function requireOneOfEnv($varNames) } self::markTestSkipped( - sprintf('Set the %s environment variable', + sprintf( + 'Set the %s environment variable', implode(' or ', (array) $varName) ) ); diff --git a/src/Utils/Flex/FlexExecCommand.php b/src/Utils/Flex/FlexExecCommand.php index 91da3c2..3d2163f 100644 --- a/src/Utils/Flex/FlexExecCommand.php +++ b/src/Utils/Flex/FlexExecCommand.php @@ -264,7 +264,7 @@ protected function detectLatestDeployedVersion( ] ); if (!empty($cmdOutput)) { - return preg_split('/\s+/', $cmdOutput[0])[0]; + return preg_split('/\s+/', $cmdOutput[0])[0]; } } } diff --git a/src/Utils/Project.php b/src/Utils/Project.php index a34c192..5b30d75 100644 --- a/src/Utils/Project.php +++ b/src/Utils/Project.php @@ -119,7 +119,9 @@ public function runComposer() chdir($this->dir); exec( 'composer update --no-interaction --no-progress --no-ansi', - $output, $ret); + $output, + $ret + ); $this->info = array_merge($this->info, $output); if ($ret !== 0) { $this->errors[] = 'Failed to run composer update in ' . $this->dir diff --git a/src/Utils/WordPress/Project.php b/src/Utils/WordPress/Project.php index 4cb3bb1..087973c 100644 --- a/src/Utils/WordPress/Project.php +++ b/src/Utils/WordPress/Project.php @@ -175,7 +175,8 @@ public function downloadBatcachePlugin() $this->output->writeln('Downloading the Batcache plugin...'); $dir = $this->getWordpressDir(); $this->downloadArchive( - 'Batcache plugin', self::LATEST_BATCACHE, + 'Batcache plugin', + self::LATEST_BATCACHE, $dir . '/wp-content/plugins' ); $this->report(); @@ -191,7 +192,8 @@ public function downloadMemcachedPlugin() $this->output->writeln('Downloading the Memcached plugin...'); $dir = $this->getWordpressDir(); $this->downloadArchive( - 'Memcached plugin', self::LATEST_MEMCACHED, + 'Memcached plugin', + self::LATEST_MEMCACHED, $dir . '/wp-content/plugins' ); $this->report(); @@ -207,7 +209,8 @@ public function downloadAppEnginePlugin() $this->output->writeln('Downloading the appengine-wordpress plugin...'); $dir = $this->getWordpressDir(); $this->downloadArchive( - 'App Engine WordPress plugin', self::LATEST_GAE_WP, + 'App Engine WordPress plugin', + self::LATEST_GAE_WP, $dir . '/wp-content/plugins' ); $this->report(); @@ -218,7 +221,8 @@ public function downloadGcsPlugin() $this->output->writeln('Downloading the GCS plugin...'); $dir = $this->getWordpressDir(); $this->downloadArchive( - 'GCS plugin', self::LATEST_GCS_PLUGIN, + 'GCS plugin', + self::LATEST_GCS_PLUGIN, $dir . '/wp-content/plugins' ); $this->report(); diff --git a/src/Utils/WordPress/files/wp-config.php b/src/Utils/WordPress/files/wp-config.php index 224132f..612936b 100644 --- a/src/Utils/WordPress/files/wp-config.php +++ b/src/Utils/WordPress/files/wp-config.php @@ -75,14 +75,14 @@ * * @since 2.6.0 */ -define('AUTH_KEY', 'YOUR_AUTH_KEY'); -define('SECURE_AUTH_KEY', 'YOUR_SECURE_AUTH_KEY'); -define('LOGGED_IN_KEY', 'YOUR_LOGGED_IN_KEY'); -define('NONCE_KEY', 'YOUR_NONCE_KEY'); -define('AUTH_SALT', 'YOUR_AUTH_SALT'); +define('AUTH_KEY', 'YOUR_AUTH_KEY'); +define('SECURE_AUTH_KEY', 'YOUR_SECURE_AUTH_KEY'); +define('LOGGED_IN_KEY', 'YOUR_LOGGED_IN_KEY'); +define('NONCE_KEY', 'YOUR_NONCE_KEY'); +define('AUTH_SALT', 'YOUR_AUTH_SALT'); define('SECURE_AUTH_SALT', 'YOUR_SECURE_AUTH_SALT'); -define('LOGGED_IN_SALT', 'YOUR_LOGGED_IN_SALT'); -define('NONCE_SALT', 'YOUR_NONCE_SALT'); +define('LOGGED_IN_SALT', 'YOUR_LOGGED_IN_SALT'); +define('NONCE_SALT', 'YOUR_NONCE_SALT'); /**#@-*/ /** From ff89336aea9d4333f9fc5d1e9f5597c25f6227bd Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Tue, 20 Aug 2024 09:58:47 -0700 Subject: [PATCH 4/6] rename fixer config --- .php-cs-fixer.dist.php => .php-cs-fixer.default.php | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .php-cs-fixer.dist.php => .php-cs-fixer.default.php (100%) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.default.php similarity index 100% rename from .php-cs-fixer.dist.php rename to .php-cs-fixer.default.php From 8732a4fc7190dd3aabba288b9562c531f9dda529 Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Wed, 21 Aug 2024 09:32:32 -0700 Subject: [PATCH 5/6] update yaml version --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 1720168..08bbc4d 100644 --- a/composer.json +++ b/composer.json @@ -44,6 +44,6 @@ "google/cloud-dlp": "^1.10", "google/cloud-storage": "^1.33", "google/cloud-secret-manager": "^1.12", - "symfony/yaml": "^6.4" + "symfony/yaml": "^5" } } From d682c2205ac62bd9ffa1c211378c7b2b9823d36a Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Wed, 21 Aug 2024 11:53:49 -0700 Subject: [PATCH 6/6] add cast_spaces --- .github/workflows/code-standards.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/code-standards.yml b/.github/workflows/code-standards.yml index 3fa15ec..538f1c9 100644 --- a/.github/workflows/code-standards.yml +++ b/.github/workflows/code-standards.yml @@ -25,6 +25,7 @@ on: "return_type_declaration": {"space_before": "none"}, "single_quote": true, "single_space_around_construct": true, + "cast_spaces": true, "whitespace_after_comma_in_array": true }