Skip to content

Commit 4b0a223

Browse files
authored
Allow phpstan 2.x (#17)
* Allow phpstan 2.x * Attempt fixing windows CI
1 parent 9ab27fb commit 4b0a223

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020
},
2121
"require-dev": {
2222
"phpunit/phpunit": "^8",
23-
"phpstan/phpstan": "^1.6",
24-
"phpstan/phpstan-deprecation-rules": "^1",
25-
"phpstan/phpstan-strict-rules": "^1.1",
26-
"phpstan/phpstan-phpunit": "^1",
23+
"phpstan/phpstan": "^1.12 || ^2",
24+
"phpstan/phpstan-deprecation-rules": "^1 || ^2",
25+
"phpstan/phpstan-strict-rules": "^1.1 || ^2",
26+
"phpstan/phpstan-phpunit": "^1 || ^2",
2727
"symfony/filesystem": "^5.4 || ^6"
2828
},
2929
"autoload": {

src/PhpFileParser.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class PhpFileParser
2424
*
2525
* @param string $path The file to check
2626
* @throws \RuntimeException
27-
* @return array<int, class-string> The found classes
27+
* @return list<class-string> The found classes
2828
*/
2929
public static function findClasses(string $path): array
3030
{
@@ -98,7 +98,9 @@ public static function findClasses(string $path): array
9898
$name = substr($name, 0, $colonPos);
9999
}
100100
}
101-
$classes[] = ltrim($namespace . $name, '\\');
101+
/** @var class-string */
102+
$className = ltrim($namespace . $name, '\\');
103+
$classes[] = $className;
102104
}
103105
}
104106

tests/ClassMapGeneratorTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -283,9 +283,9 @@ public function testGetRawPSR4Violations(): void
283283
$classMap = $this->generator->getClassMap();
284284
$rawViolations = $classMap->getRawPsrViolations();
285285

286-
$classWithoutNameSpaceFilepath = __DIR__ . '/Fixtures/psrViolations/ClassWithoutNameSpace.php';
287-
$classWithIncorrectSubNamespaceFilepath = __DIR__ . '/Fixtures/psrViolations/ClassWithIncorrectSubNamespace.php';
288-
$classWithNameSpaceOutsideConfiguredScopeFilepath = __DIR__ . '/Fixtures/psrViolations/ClassWithNameSpaceOutsideConfiguredScope.php';
286+
$classWithoutNameSpaceFilepath = strtr(__DIR__, '\\', '/') . '/Fixtures/psrViolations/ClassWithoutNameSpace.php';
287+
$classWithIncorrectSubNamespaceFilepath = strtr(__DIR__, '\\', '/') . '/Fixtures/psrViolations/ClassWithIncorrectSubNamespace.php';
288+
$classWithNameSpaceOutsideConfiguredScopeFilepath = strtr(__DIR__, '\\', '/') . '/Fixtures/psrViolations/ClassWithNameSpaceOutsideConfiguredScope.php';
289289

290290
self::assertArrayHasKey($classWithoutNameSpaceFilepath, $rawViolations);
291291
self::assertCount(1, $rawViolations[$classWithoutNameSpaceFilepath]);

0 commit comments

Comments
 (0)