Skip to content

Commit 8275dda

Browse files
committed
Fixed coding standards.
1 parent a4624f2 commit 8275dda

5 files changed

Lines changed: 29 additions & 22 deletions

File tree

.github/workflows/test.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,19 @@ jobs:
4848
ini-values: pcov.directory=.
4949

5050
- name: Install dependencies
51-
run: composer install
51+
run: |
52+
if [ "${{ matrix.php-versions }}" == "8.2" ]; then
53+
composer remove --dev drevops/phpcs-standard --no-update
54+
fi
55+
composer install
5256
5357
- name: Validate composer.json
5458
run: |
5559
composer --verbose validate
5660
composer normalize --dry-run
5761
5862
- name: Check coding standards
63+
if: matrix.php-versions == '8.3'
5964
run: composer lint
6065
continue-on-error: ${{ vars.CI_LINT_IGNORE_FAILURE == '1' }}
6166

composer.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,17 @@
1919
"symfony/http-client": "^6.0 || ^7.0"
2020
},
2121
"require-dev": {
22-
"bamarni/composer-bin-plugin": "^1.8",
2322
"behat/mink-browserkit-driver": "^2.2",
2423
"dantleech/gherkin-lint": "^0.2.3",
2524
"dealerdirect/phpcodesniffer-composer-installer": "^1",
2625
"dmore/behat-chrome-extension": "^1.4",
2726
"drevops/behat-phpserver": "^2.0",
27+
"drevops/phpcs-standard": "^0.2.0",
2828
"drupal/coder": "^8.3",
2929
"dvdoug/behat-code-coverage": "^5.3",
3030
"ergebnis/composer-normalize": "^2.44",
31-
"escapestudios/symfony2-coding-standard": "^3",
3231
"lullabot/mink-selenium2-driver": "^1.7",
3332
"lullabot/php-webdriver": "^2.0.4",
34-
"mikey179/vfsstream": "^1.6",
35-
"opis/closure": "^4.0",
3633
"php-mock/php-mock-phpunit": "^2.13",
3734
"phpstan/phpstan": "^2",
3835
"phpunit/phpunit": "^11",
@@ -51,7 +48,6 @@
5148
},
5249
"config": {
5350
"allow-plugins": {
54-
"bamarni/composer-bin-plugin": true,
5551
"dealerdirect/phpcodesniffer-composer-installer": true,
5652
"ergebnis/composer-normalize": true
5753
},

phpcs.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@
1010
<rule ref="Generic.PHP.RequireStrictTypes">
1111
<exclude-pattern>BehatCliContext\.php</exclude-pattern>
1212
</rule>
13+
<rule ref="DrevOps.NamingConventions.LocalVariableSnakeCase">
14+
<exclude-pattern>BehatCliContext\.php</exclude-pattern>
15+
</rule>
16+
<rule ref="DrevOps.NamingConventions.ParameterSnakeCase">
17+
<exclude-pattern>BehatCliContext\.php</exclude-pattern>
18+
</rule>
1319

1420
<!-- Show sniff codes in all reports -->
1521
<arg value="s"/>

src/DrevOps/BehatScreenshotExtension/Context/ScreenshotContext.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -766,7 +766,7 @@ public function renderInfo(): string {
766766

767767
// Use a non-HTML output to make this output universal.
768768
return implode("\n", array_map(
769-
fn($key, $value): string => sprintf('%s: %s', $key, $value),
769+
fn(string $key, $value): string => sprintf('%s: %s', $key, $value),
770770
array_keys($this->info),
771771
$this->info,
772772
));

tests/behat/bootstrap/BehatCliTrait.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,13 @@ public function behatCliWriteFeatureContextFile(array $traits = []): string {
7676
'{{USE_IN_CLASS}}' => '',
7777
];
7878
foreach ($traits as $path => $trait) {
79-
$traitName = $trait;
79+
$trait_name = $trait;
8080
if (strpos($trait, '\\') !== FALSE) {
8181
$tokens['{{USE_DECLARATION}}'] .= sprintf('use %s;' . PHP_EOL, $trait);
82-
$traitNameParts = explode('\\', $trait);
83-
$traitName = end($traitNameParts);
82+
$trait_name_parts = explode('\\', $trait);
83+
$trait_name = end($trait_name_parts);
8484
}
85-
$tokens['{{USE_IN_CLASS}}'] .= sprintf('use %s;' . PHP_EOL, $traitName);
85+
$tokens['{{USE_IN_CLASS}}'] .= sprintf('use %s;' . PHP_EOL, $trait_name);
8686

8787
if (is_string($path) && file_exists($path)) {
8888
$filename = $this->workingDir . DIRECTORY_SEPARATOR . 'features/bootstrap/' . basename($path);
@@ -182,11 +182,11 @@ public function behatCliWriteScenarioSteps(PyStringNode $content, string $tags =
182182
$content = strtr((string) $content, ["'''" => '"""']);
183183

184184
// Make sure that indentation in provided content is accurate.
185-
$contentLines = explode(PHP_EOL, $content);
186-
foreach ($contentLines as $k => $contentLine) {
187-
$contentLines[$k] = str_repeat(' ', 4) . trim($contentLine);
185+
$content_lines = explode(PHP_EOL, $content);
186+
foreach ($content_lines as $k => $content_line) {
187+
$content_lines[$k] = str_repeat(' ', 4) . trim($content_line);
188188
}
189-
$content = implode(PHP_EOL, $contentLines);
189+
$content = implode(PHP_EOL, $content_lines);
190190

191191
$tokens = [
192192
'{{SCENARIO_CONTENT}}' => $content,
@@ -333,16 +333,16 @@ public function behatCliWriteScreenshotTestContext(PyStringNode $content): void
333333
}
334334

335335
// Update the behat.yml to include this context.
336-
$behatYmlPath = $this->workingDir . DIRECTORY_SEPARATOR . 'behat.yml';
337-
if (file_exists($behatYmlPath)) {
338-
$behatYml = file_get_contents($behatYmlPath);
339-
if (strpos($behatYml, 'FullscreenTestContext') === FALSE) {
340-
$behatYml = str_replace(
336+
$behat_yml_path = $this->workingDir . DIRECTORY_SEPARATOR . 'behat.yml';
337+
if (file_exists($behat_yml_path)) {
338+
$behat_yml = file_get_contents($behat_yml_path);
339+
if (strpos($behat_yml, 'FullscreenTestContext') === FALSE) {
340+
$behat_yml = str_replace(
341341
'ScreenshotContext',
342342
"ScreenshotContext\n - FullscreenTestContext",
343-
$behatYml
343+
$behat_yml
344344
);
345-
file_put_contents($behatYmlPath, $behatYml);
345+
file_put_contents($behat_yml_path, $behat_yml);
346346
}
347347
}
348348
}

0 commit comments

Comments
 (0)