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

chore: better cs fixer rules #149

Merged
merged 6 commits into from
Aug 28, 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
12 changes: 5 additions & 7 deletions .github/workflows/code-standards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,14 @@ 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,
"method_argument_space": {
"keep_multiple_spaces_after_comma": true,
"on_multiline": "ignore"
},
"return_type_declaration": {"space_before": "none"},
"single_quote": true
"single_quote": true,
"single_space_around_construct": true,
"cast_spaces": true,
"whitespace_after_comma_in_array": true
}

permissions:
Expand Down
16 changes: 16 additions & 0 deletions .php-cs-fixer.default.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

require __DIR__ . '/vendor/autoload.php';

use Symfony\Component\Yaml\Yaml;

$workflow = Yaml::parse(file_get_contents(__DIR__ . '/.github/workflows/code-standards.yml'));
$rules = json_decode($workflow['on']['workflow_call']['inputs']['rules']['default'], true);

return (new PhpCsFixer\Config())
->setRules($rules)
->setFinder(
PhpCsFixer\Finder::create()
->in(__DIR__)
)
;
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "^5"
}
}
3 changes: 2 additions & 1 deletion src/TestUtils/TestTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
)
);
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 @@ -264,7 +264,7 @@ protected function detectLatestDeployedVersion(
]
);
if (!empty($cmdOutput)) {
return preg_split('/\s+/', $cmdOutput[0])[0];
return preg_split('/\s+/', $cmdOutput[0])[0];
}
}
}
4 changes: 3 additions & 1 deletion src/Utils/Project.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 8 additions & 4 deletions src/Utils/WordPress/Project.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand Down
14 changes: 7 additions & 7 deletions src/Utils/WordPress/files/wp-config.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');

/**#@-*/
/**
Expand Down