Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Ruleset.php
Original file line number Diff line number Diff line change
Expand Up @@ -1006,7 +1006,7 @@ private function expandRulesetReference($ref, $rulesetDir, $depth=0)
if (is_file($ref) === true) {
if (substr($ref, -9) === 'Sniff.php') {
// A single external sniff.
$this->rulesetDirs[] = dirname(dirname(dirname($ref)));
$this->rulesetDirs[] = dirname($ref, 3);
return [$ref];
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/Util/Standards.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public static function getInstalledStandardPaths()
{
$ds = DIRECTORY_SEPARATOR;

$installedPaths = [dirname(dirname(__DIR__)).$ds.'src'.$ds.'Standards'];
$installedPaths = [dirname(__DIR__, 2).$ds.'src'.$ds.'Standards'];
$configPaths = Config::getConfigData('installed_paths');
if ($configPaths !== null) {
$installedPaths = array_merge($installedPaths, explode(',', $configPaths));
Expand Down
2 changes: 1 addition & 1 deletion tests/Core/Filters/AbstractFilterTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ protected function getFilteredResultsAsArray(Filter $filter)
*/
protected static function getBaseDir()
{
return dirname(dirname(dirname(__DIR__)));
return dirname(__DIR__, 3);

}//end getBaseDir()

Expand Down
2 changes: 1 addition & 1 deletion tests/Core/Ruleset/ConstructorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public function testStandardsAreRegisteredWithAutoloader($cliArgs, $expected)
*/
public static function dataStandardsAreRegisteredWithAutoloader()
{
$basePath = dirname(dirname(dirname(__DIR__))).DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.'Standards'.DIRECTORY_SEPARATOR;
$basePath = dirname(__DIR__, 3).DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.'Standards'.DIRECTORY_SEPARATOR;
$defaultPaths = [
$basePath.'PEAR' => 'PEAR',
$basePath.'PSR1' => 'PSR1',
Expand Down
2 changes: 1 addition & 1 deletion tests/Core/Ruleset/RegisterSniffsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public static function setUpBeforeClass(): void
ksort(self::$originalSniffs);

// Update the sniff file list.
$standardsDir = dirname(dirname(dirname(__DIR__))).DIRECTORY_SEPARATOR;
$standardsDir = dirname(__DIR__, 3).DIRECTORY_SEPARATOR;
$standardsDir .= 'src'.DIRECTORY_SEPARATOR.'Standards'.DIRECTORY_SEPARATOR;

self::$psr1SniffAbsolutePaths = self::relativeToAbsoluteSniffFiles($standardsDir, self::$psr1SniffFiles);
Expand Down
2 changes: 1 addition & 1 deletion tests/Core/Ruleset/RuleInclusionAbsoluteLinuxTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ final class RuleInclusionAbsoluteLinuxTest extends TestCase
protected function setUp(): void
{
$this->standard = __DIR__.'/'.basename(__FILE__, '.php').'.xml';
$repoRootDir = dirname(dirname(dirname(__DIR__)));
$repoRootDir = dirname(__DIR__, 3);

// On-the-fly adjust the ruleset test file to be able to test sniffs included with absolute paths.
$contents = file_get_contents($this->standard);
Expand Down
2 changes: 1 addition & 1 deletion tests/Core/Ruleset/RuleInclusionAbsoluteWindowsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ final class RuleInclusionAbsoluteWindowsTest extends TestCase
protected function setUp(): void
{
$this->standard = __DIR__.'/'.basename(__FILE__, '.php').'.xml';
$repoRootDir = dirname(dirname(dirname(__DIR__)));
$repoRootDir = dirname(__DIR__, 3);

// On-the-fly adjust the ruleset test file to be able to test sniffs included with absolute paths.
$contents = file_get_contents($this->standard);
Expand Down
2 changes: 1 addition & 1 deletion tests/Core/Ruleset/RuleInclusionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ protected function setUp(): void
$contents = file_get_contents($standard);
self::$contents = $contents;

$repoRootDir = basename(dirname(dirname(dirname(__DIR__))));
$repoRootDir = basename(dirname(__DIR__, 3));

$newPath = $repoRootDir;
if (DIRECTORY_SEPARATOR === '\\') {
Expand Down
2 changes: 1 addition & 1 deletion tests/Core/Standards/StandardRulesetsQATest.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public static function dataBuildInStandards()
{
// Get a list of all build-in, PHPCS native standards.
$sep = DIRECTORY_SEPARATOR;
$targetDir = dirname(dirname(dirname(__DIR__))).$sep.'src'.$sep.'Standards'.$sep;
$targetDir = dirname(__DIR__, 3).$sep.'src'.$sep.'Standards'.$sep;
$rulesetFiles = glob($targetDir.'*'.$sep.'ruleset.xml');

$data = [];
Expand Down