Skip to content

Commit

Permalink
refactor autoload finder
Browse files Browse the repository at this point in the history
  • Loading branch information
abbadon1334 committed Jul 11, 2019
1 parent ac80f57 commit 8f9c092
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions bin/phpdoc-to-rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,26 @@ if (!ini_get('date.timezone')) {
ini_set('date.timezone', 'UTC');
}

foreach (array(__DIR__ . '/../../autoload.php', __DIR__ . '/../vendor/autoload.php', __DIR__ . '/vendor/autoload.php') as $file) {
if (file_exists($file)) {
define('PHPUNIT_COMPOSER_INSTALL', $file);
break;
foreach([null,'vendor'] as $vendor_dir)
{
$dir = [__DIR__];
for($a=0;$a=3;$a++)
{
$dir[]= '..';
$file = implode(DIRECTORY_SEPARATOR, $dir);
if($vendor_dir)
{
$file.= DIRECTORY_SEPARATOR . 'vendor';
}

$file.= DIRECTORY_SEPARATOR . 'autoload.php';

echo $file;

if (file_exists($file)) {
define('PHPUNIT_COMPOSER_INSTALL', $file);
break;
}
}
}

Expand Down

0 comments on commit 8f9c092

Please sign in to comment.