Skip to content

Commit 2233121

Browse files
committed
fix rector rule test
1 parent d340464 commit 2233121

21 files changed

+81
-74
lines changed

composer-dependency-analyser.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use ShipMonk\ComposerDependencyAnalyser\Config\Configuration;
6+
7+
$config = new Configuration();
8+
9+
return $config->addPathToScan(__DIR__ . '/src', false)
10+
// ->ignoreErrorsOnPath('/Fixture/', [\ShipMonk\ComposerDependencyAnalyser\Config\ErrorType::UNKNOWN_CLASS]);
11+
;

composer.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
"rector/rector": "^2.0",
1919
"phpstan/extension-installer": "^1.4",
2020
"symplify/phpstan-extensions": "^12.0",
21-
"tomasvotruba/unused-public": "^2.0"
21+
"tomasvotruba/unused-public": "^2.0",
22+
"tomasvotruba/type-coverage": "^2.0",
23+
"shipmonk/composer-dependency-analyser": "^1.8"
2224
},
2325
"autoload": {
2426
"psr-4": {

phpstan.neon

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ parameters:
2828
properties: true
2929
constants: true
3030

31-
# type_coverage:
32-
# return: 99
33-
# param: 99
34-
# property: 99
31+
type_coverage:
32+
return: 99
33+
param: 99
34+
property: 99
3535

3636
ignoreErrors:
3737
# needless generics

phpunit.xml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
<?xml version="1.0"?>
2-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" colors="true" xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd" cacheDirectory=".phpunit.cache">
2+
<phpunit
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
bootstrap="vendor/autoload.php"
5+
colors="true"
6+
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
7+
displayDetailsOnIncompleteTests="true"
8+
cacheDirectory=".phpunit.cache">
39
<testsuite name="all">
410
<directory>tests</directory>
511
<exclude>tests/Rules/ClassNameRespectsParentSuffixRule/Fixture/</exclude>

phpunit.xml.bak

Lines changed: 0 additions & 9 deletions
This file was deleted.

src/Composer/ComposerAutoloadResolver.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
namespace Symplify\PHPStanRules\Composer;
66

7+
use Symplify\PHPStanRules\FileSystem\FileSystem;
8+
79
final class ComposerAutoloadResolver
810
{
911
/**
@@ -20,7 +22,7 @@ public function getPsr4Autoload(): array
2022
return [];
2123
}
2224

23-
$fileContent = \Symplify\PHPStanRules\FileSystem\FileSystem::read(self::COMPOSER_JSON_FILE);
25+
$fileContent = FileSystem::read(self::COMPOSER_JSON_FILE);
2426
$composerJsonContent = json_decode($fileContent, true, 512, JSON_THROW_ON_ERROR);
2527

2628
$autoloadPsr4 = $composerJsonContent['autoload']['psr-4'] ?? [];

src/Enum/ClassName.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,19 @@ final class ClassName
1515
* @var string
1616
*/
1717
public const NETTE_STRINGS = 'Nette\Utils\Strings';
18+
19+
/**
20+
* @var string
21+
*/
22+
public const SYMFONY_ABSTRACT_CONTROLLER = 'Symfony\Bundle\FrameworkBundle\Controller\AbstractController';
23+
24+
/**
25+
* @var string
26+
*/
27+
public const PHPUNIT_TEST_CASE = 'PHPUnit\Framework\TestCase';
28+
29+
/**
30+
* @var string
31+
*/
32+
public const EVENT_DISPATCHER_INTERFACE = 'Symfony\Component\EventDispatcher\EventSubscriberInterface';
1833
}

src/Naming/ClassToSuffixResolver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ private function removeAbstractInterfacePrefixSuffix(string $parentType): string
4040
}
4141

4242
if (\str_starts_with($parentType, 'Abstract')) {
43-
return substr($parentType, (int) strlen('Abstract'));
43+
return substr($parentType, strlen('Abstract'));
4444
}
4545

4646
return $parentType;

src/Reflection/Nested/Some.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
namespace Symplify\PHPStanRules\Reflection;
4+
5+
class Some
6+
{
7+
}

src/Reflection/ReflectionParser.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use PHPStan\Reflection\MethodReflection;
1515
use ReflectionClass;
1616
use ReflectionMethod;
17+
use Symplify\PHPStanRules\FileSystem\FileSystem;
1718
use Symplify\PHPStanRules\NodeFinder\TypeAwareNodeFinder;
1819
use Throwable;
1920

@@ -77,7 +78,7 @@ private function parseFilenameToClass(string $fileName): ClassLike|null
7778
}
7879

7980
try {
80-
$stmts = $this->parser->parse(\Symplify\PHPStanRules\FileSystem\FileSystem::read($fileName));
81+
$stmts = $this->parser->parse(FileSystem::read($fileName));
8182
if (! is_array($stmts)) {
8283
return null;
8384
}

0 commit comments

Comments
 (0)