File tree 1 file changed +6
-5
lines changed
1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -286,24 +286,25 @@ private function updateInstalledPaths()
286
286
->in ($ searchPaths );
287
287
288
288
// Only version 3.x and higher has support for having coding standard in the root of the directory.
289
- $ allowCodingStandardsInRoot = $ this ->isPHPCodeSnifferInstalled ('>= 3.0.0 ' );
290
-
291
- if ($ allowCodingStandardsInRoot !== true ) {
289
+ if ($ this ->isPHPCodeSnifferInstalled ('>= 3.0.0 ' ) !== true ) {
292
290
$ finder ->depth ('>= 1 ' );
293
291
}
294
292
293
+ // Process each found possible ruleset.
295
294
foreach ($ finder as $ ruleset ) {
296
295
$ standardsPath = $ ruleset ->getPath ();
297
296
298
- if ($ allowCodingStandardsInRoot === false ) {
297
+ // Pick the directory above the directory containing the standard, unless this is the project root.
298
+ if ($ standardsPath !== getcwd ()) {
299
299
$ standardsPath = dirname ($ standardsPath );
300
300
}
301
301
302
- // Use relative paths for local project repositories
302
+ // Use relative paths for local project repositories.
303
303
if ($ this ->isRunningGlobally () === false ) {
304
304
$ standardsPath = $ this ->getRelativePath ($ standardsPath );
305
305
}
306
306
307
+ // De-duplicate and add when directory is not configured.
307
308
if (in_array ($ standardsPath , $ this ->installedPaths , true ) === false ) {
308
309
$ this ->installedPaths [] = $ standardsPath ;
309
310
$ changes = true ;
You can’t perform that action at this time.
0 commit comments