Skip to content

Commit 4e8224b

Browse files
thg2kondrejmirtes
authored andcommitted
Update phpcs config with proper exclude pattern
The pattern is actually matched as a regexp, so the trailing slash is necessary to avoid excluding unwanted files. Also unified the patterns declared as 'arg' to the proper list.
1 parent 7a07852 commit 4e8224b

File tree

3 files changed

+21
-20
lines changed

3 files changed

+21
-20
lines changed

phpcs.xml

+10-9
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
<arg name="encoding" value="utf-8"/>
77
<arg name="tab-width" value="4"/>
88
<arg name="cache" value="tmp/cache/phpcs"/>
9-
<arg name="ignore" value="compiler/tests/*/data,tests/*/data,tests/*/traits,tests/notAutoloaded,tests/*/cache,src/Reflection/SignatureMap/functionMap.php,tests/e2e/magic-setter,tests/e2e/anon-class"/>
109
<arg value="sp"/>
1110
<file>bin</file>
1211
<file>src</file>
@@ -204,15 +203,17 @@
204203
<property name="enable" value="true"/>
205204
</properties>
206205
</rule>
207-
<exclude-pattern>tests/*/data</exclude-pattern>
208-
<exclude-pattern>tests/PHPStan/Analyser/nsrt</exclude-pattern>
209-
<exclude-pattern>tests/*/Fixture</exclude-pattern>
206+
<exclude-pattern>compiler/tests/*/data/</exclude-pattern>
207+
<exclude-pattern>tests/*/Fixture/</exclude-pattern>
208+
<exclude-pattern>tests/*/cache/</exclude-pattern>
209+
<exclude-pattern>tests/*/data/</exclude-pattern>
210+
<exclude-pattern>tests/*/traits/</exclude-pattern>
211+
<exclude-pattern>tests/PHPStan/Analyser/nsrt/</exclude-pattern>
212+
<exclude-pattern>tests/e2e/anon-class/</exclude-pattern>
213+
<exclude-pattern>tests/e2e/magic-setter/</exclude-pattern>
210214
<exclude-pattern>tests/e2e/resultCache_1.php</exclude-pattern>
211215
<exclude-pattern>tests/e2e/resultCache_2.php</exclude-pattern>
212216
<exclude-pattern>tests/e2e/resultCache_3.php</exclude-pattern>
213-
<exclude-pattern>tests/*/traits</exclude-pattern>
214-
<exclude-pattern>tests/tmp</exclude-pattern>
215-
<exclude-pattern>tests/notAutoloaded</exclude-pattern>
216-
<exclude-pattern>src/Reflection/SignatureMap/functionMap.php</exclude-pattern>
217-
<exclude-pattern>src/Reflection/SignatureMap/functionMetadata.php</exclude-pattern>
217+
<exclude-pattern>tests/notAutoloaded/</exclude-pattern>
218+
<exclude-pattern>tests/tmp/</exclude-pattern>
218219
</ruleset>

tests/PHPStan/Analyser/TraitStubFilesTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php declare(strict_types=1);
1+
<?php declare(strict_types = 1);
22

33
namespace PHPStan\Analyser;
44

tests/PHPStan/Parser/CachedParserTest.php

+10-10
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
namespace PHPStan\Parser;
44

5+
use Generator;
6+
use PhpParser\Node;
57
use PhpParser\Node\Stmt\Namespace_;
68
use PHPStan\File\FileHelper;
79
use PHPStan\File\FileReader;
@@ -13,22 +15,20 @@ class CachedParserTest extends PHPStanTestCase
1315

1416
/**
1517
* @dataProvider dataParseFileClearCache
16-
* @param int $cachedNodesByStringCountMax
17-
* @param int $cachedNodesByStringCountExpected
1818
*/
1919
public function testParseFileClearCache(
2020
int $cachedNodesByStringCountMax,
21-
int $cachedNodesByStringCountExpected
21+
int $cachedNodesByStringCountExpected,
2222
): void
2323
{
2424
$parser = new CachedParser(
2525
$this->getParserMock(),
26-
$cachedNodesByStringCountMax
26+
$cachedNodesByStringCountMax,
2727
);
2828

2929
$this->assertEquals(
3030
$cachedNodesByStringCountMax,
31-
$parser->getCachedNodesByStringCountMax()
31+
$parser->getCachedNodesByStringCountMax(),
3232
);
3333

3434
// Add strings to cache
@@ -38,16 +38,16 @@ public function testParseFileClearCache(
3838

3939
$this->assertEquals(
4040
$cachedNodesByStringCountExpected,
41-
$parser->getCachedNodesByStringCount()
41+
$parser->getCachedNodesByStringCount(),
4242
);
4343

4444
$this->assertCount(
4545
$cachedNodesByStringCountExpected,
46-
$parser->getCachedNodesByString()
46+
$parser->getCachedNodesByString(),
4747
);
4848
}
4949

50-
public function dataParseFileClearCache(): \Generator
50+
public function dataParseFileClearCache(): Generator
5151
{
5252
yield 'even' => [
5353
'cachedNodesByStringCountMax' => 50,
@@ -70,9 +70,9 @@ private function getParserMock(): Parser&MockObject
7070
return $mock;
7171
}
7272

73-
private function getPhpParserNodeMock(): \PhpParser\Node&MockObject
73+
private function getPhpParserNodeMock(): Node&MockObject
7474
{
75-
return $this->createMock(\PhpParser\Node::class);
75+
return $this->createMock(Node::class);
7676
}
7777

7878
public function testParseTheSameFileWithDifferentMethod(): void

0 commit comments

Comments
 (0)