Skip to content

Commit a5dfdae

Browse files
authored
Merge pull request #66 from o0h/fix-custom-vendor-dir-problem
fix custom composer vendor-dir loading
2 parents 12eb57d + 3e7883c commit a5dfdae

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/Annotator/AbstractAnnotator.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,13 @@
2121
use RuntimeException;
2222
use SebastianBergmann\Diff\Differ;
2323

24-
$manualAutoload = getcwd() . '/vendor/squizlabs/php_codesniffer/autoload.php';
24+
$composerVendorDir = getcwd() . DS . 'vendor';
25+
$codesnifferDir = 'squizlabs' . DS . 'php_codesniffer';
26+
if (!is_dir($composerVendorDir . DS . $codesnifferDir)) {
27+
$ideHelperDir = substr(__DIR__, 0, strpos(__DIR__, DS . 'cakephp-ide-helper'));
28+
$composerVendorDir = dirname($ideHelperDir);
29+
}
30+
$manualAutoload = $composerVendorDir . DS . $codesnifferDir . DS . 'autoload.php';
2531
if (!class_exists(Config::class) && file_exists($manualAutoload)) {
2632
require $manualAutoload;
2733
}

0 commit comments

Comments
 (0)