Skip to content
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
6 changes: 3 additions & 3 deletions .github/workflows/workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ['8.2', '8.3', '8.4']
php-versions: ['8.2', '8.3', '8.4', '8.5']
steps:
- uses: actions/checkout@v4
- uses: "shivammathur/setup-php@v2"
Expand All @@ -23,7 +23,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ['8.2', '8.3', '8.4']
php-versions: ['8.2', '8.3', '8.4', '8.5']
steps:
- uses: actions/checkout@v4
- uses: "shivammathur/setup-php@v2"
Expand All @@ -41,7 +41,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ['8.2', '8.3', '8.4']
php-versions: ['8.2', '8.3', '8.4', '8.5']
dependency-versions: ['highest', 'lowest']
steps:
- uses: actions/checkout@v4
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"require": {
"php": "^8.2",
"dealerdirect/phpcodesniffer-composer-installer": "^1.0.0",
"drupal/coder": "^8.3.26",
"slevomat/coding-standard": "^8.16.0",
"squizlabs/php_codesniffer": "^3.11.1"
"drupal/coder": "^8.3.26 || ^9.0",
"slevomat/coding-standard": "^8.11",
"squizlabs/php_codesniffer": "^3.9.1 || ^4.0.1"
},
"require-dev": {
"phpstan/extension-installer": "^1.4.3",
Expand Down
4 changes: 2 additions & 2 deletions tests/Sniffs/AlphabeticallySortedUsesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ public function testError(): void {
self::assertSniffError($report, 8, AlphabeticallySortedUsesSniff::CODE_INCORRECT_ORDER);
}

protected static function getSniffName(): string {
return 'SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses';
protected static function getSniffClassName(): string {
return AlphabeticallySortedUsesSniff::class;
}

}
8 changes: 4 additions & 4 deletions tests/Sniffs/Base.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<?php

// phpcs:ignoreFile
// Most of this file ported from slevomat/coding-standard and is immune from
// rule of this standard until it has been reworked.
// @codingStandardsIgnoreFile

declare(strict_types=1);

Expand Down Expand Up @@ -46,8 +45,9 @@ protected static function checkFile(string $filePath, array $sniffProperties = [

$codeSniffer->init();

if (count($sniffProperties) > 0) {
$codeSniffer->ruleset->ruleset[self::getSniffName()]['properties'] = $sniffProperties;
$sniffName = self::getSniffName();
if (count($sniffProperties) > 0 && $sniffName !== null) {
$codeSniffer->ruleset->ruleset[$sniffName]['properties'] = $sniffProperties;
}

$sniffClassName = static::getSniffClassName();
Expand Down
8 changes: 7 additions & 1 deletion tests/Sniffs/DrupalRulesetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

namespace PreviousNext\CodingStandard\Tests\Sniffs;

use Drupal\Sniffs\ControlStructures\InlineControlStructureSniff;

/**
* Tests inherits from Drupal ruleset.
*/
Expand All @@ -17,7 +19,11 @@ public function testNoError(): void {
public function testMissing(): void {
$report = self::checkFile(__DIR__ . '/fixtures/DrupalRulesetError.php');
self::assertSame(2, $report->getErrorCount());
self::assertSniffError($report, 5, sniffName: 'Drupal.ControlStructures.InlineControlStructure', code: 'NotAllowed');
// Sniff removed in drupal/coder 9.x.
$inlineControlSniff = \class_exists(InlineControlStructureSniff::class)
? 'Drupal.ControlStructures.InlineControlStructure'
: 'Generic.ControlStructures.InlineControlStructure';
self::assertSniffError($report, 5, sniffName: $inlineControlSniff, code: 'NotAllowed');
Comment thread
kimpepper marked this conversation as resolved.
self::assertSniffError($report, 5, sniffName: 'Generic.PHP.UpperCaseConstant', code: 'Found');
}

Expand Down
Loading