Skip to content

Commit 188ca67

Browse files
committed
Updated dependencies
1 parent a4b4fbd commit 188ca67

File tree

3 files changed

+23
-15
lines changed

3 files changed

+23
-15
lines changed

SlevomatCodingStandard/Sniffs/TestCase.php

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use PHP_CodeSniffer\Files\File;
77
use PHP_CodeSniffer\Files\LocalFile;
88
use PHP_CodeSniffer\Runner;
9+
use PHP_CodeSniffer\Sniffs\Sniff;
910
use ReflectionClass;
1011
use function array_map;
1112
use function array_merge;
@@ -44,20 +45,22 @@ protected static function checkFile(string $filePath, array $sniffProperties = [
4445
$codeSniffer->init();
4546

4647
if (count($sniffProperties) > 0) {
47-
$codeSniffer->ruleset->ruleset[static::getSniffName()]['properties'] = $sniffProperties;
48+
$codeSniffer->ruleset->ruleset[self::getSniffName()]['properties'] = $sniffProperties;
4849
}
4950

50-
$sniffClassName = static::getSniffClassName();
51+
$sniffClassName = self::getSniffClassName();
52+
/** @var Sniff $sniff */
53+
$sniff = new $sniffClassName();
5154

52-
$codeSniffer->ruleset->sniffs = [$sniffClassName => new $sniffClassName()];
55+
$codeSniffer->ruleset->sniffs = [$sniffClassName => $sniff];
5356

5457
if (count($codesToCheck) > 0) {
55-
foreach (static::getSniffClassReflection()->getConstants() as $constantName => $constantValue) {
58+
foreach (self::getSniffClassReflection()->getConstants() as $constantName => $constantValue) {
5659
if (strpos($constantName, 'CODE_') !== 0 || in_array($constantValue, $codesToCheck, true)) {
5760
continue;
5861
}
5962

60-
$codeSniffer->ruleset->ruleset[sprintf('%s.%s', static::getSniffName(), $constantValue)]['severity'] = 0;
63+
$codeSniffer->ruleset->ruleset[sprintf('%s.%s', self::getSniffName(), $constantValue)]['severity'] = 0;
6164
}
6265
}
6366

@@ -80,7 +83,7 @@ protected static function assertSniffError(File $phpcsFile, int $line, string $c
8083
$errors = $phpcsFile->getErrors();
8184
self::assertTrue(isset($errors[$line]), sprintf('Expected error on line %s, but none found.', $line));
8285

83-
$sniffCode = sprintf('%s.%s', static::getSniffName(), $code);
86+
$sniffCode = sprintf('%s.%s', self::getSniffName(), $code);
8487

8588
self::assertTrue(
8689
self::hasError($errors[$line], $sniffCode, $message),
@@ -135,21 +138,26 @@ private static function getSniffName(): string
135138
'',
136139
'',
137140
],
138-
static::getSniffClassName()
141+
self::getSniffClassName()
139142
);
140143
}
141144

145+
/**
146+
* @return class-string
147+
*/
142148
private static function getSniffClassName(): string
143149
{
144-
return substr(static::class, 0, -strlen('Test'));
150+
/** @var class-string $sniffClassName */
151+
$sniffClassName = substr(static::class, 0, -strlen('Test'));
152+
153+
return $sniffClassName;
145154
}
146155

147156
private static function getSniffClassReflection(): ReflectionClass
148157
{
149158
static $reflections = [];
150159

151-
/** @phpstan-var class-string $className */
152-
$className = static::getSniffClassName();
160+
$className = self::getSniffClassName();
153161

154162
return $reflections[$className] ?? $reflections[$className] = new ReflectionClass($className);
155163
}

build/PHPStan/phpstan.neon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ parameters:
99
bootstrapFiles:
1010
- %currentWorkingDirectory%/vendor/squizlabs/php_codesniffer/autoload.php
1111
- %currentWorkingDirectory%/vendor/squizlabs/php_codesniffer/src/Util/Tokens.php
12-
excludes_analyse:
12+
excludePaths:
1313
- %currentWorkingDirectory%/tests/*/data/*
1414
ignoreErrors:
1515
- "#Offset '(bracket|scope|parenthesis|comment|attribute)_(opener|closer)' does not exist#"

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020
"require-dev": {
2121
"phing/phing": "2.17.0",
2222
"php-parallel-lint/php-parallel-lint": "1.3.1",
23-
"phpstan/phpstan": "0.12.99",
24-
"phpstan/phpstan-deprecation-rules": "0.12.6",
25-
"phpstan/phpstan-phpunit": "0.12.22",
26-
"phpstan/phpstan-strict-rules": "0.12.11",
23+
"phpstan/phpstan": "1.0.0",
24+
"phpstan/phpstan-deprecation-rules": "1.0.0",
25+
"phpstan/phpstan-phpunit": "1.0.0",
26+
"phpstan/phpstan-strict-rules": "1.0.0",
2727
"phpunit/phpunit": "7.5.20|8.5.5|9.5.10"
2828
},
2929
"autoload": {

0 commit comments

Comments
 (0)