Skip to content

Commit 7b4c9af

Browse files
DemvSteinbrinkondrejmirtes
authored andcommitted
Workaround bug in slevomat/coding-standard TypeNameMatchesFileName
For each root namespace, the slevomat rule considers the left-most match of the given directory in the absolute path of the file. That is, for /home/user/src/phpstan-src/ the root namespace PHPStan is not assigned to /home/user/src/phpstan-src/src, but to /home/user/src, which is obviously wrong. The bug is known as slevomat/coding-standard#1249 for a long time, but yet to be fixed. To avoid issues for developers of PHPStan, we can set a basepath of "." in the PHP CodeSniffer config, which causes paths to be evaluated relative to the current directory, avoiding false-positives in the path leading up to the phpstan-src directory.
1 parent fbcad41 commit 7b4c9af

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

phpcs.xml

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?xml version="1.0"?>
22
<ruleset name="PHPStan">
33
<config name="php_version" value="70400"/>
4+
<arg name="basepath" value="."/>
45
<arg name="colors"/>
56
<arg name="extensions" value="php"/>
67
<arg name="encoding" value="utf-8"/>

0 commit comments

Comments
 (0)