Skip to content

Commit

Permalink
change null coalesce
Browse files Browse the repository at this point in the history
  • Loading branch information
ArrayIterator committed Oct 16, 2023
1 parent 3aac232 commit e9551fe
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/PossibleRoot.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public static function getPossibleRootDirectory()

if (class_exists(ClassLoader::class)) {
if (class_exists(InstalledVersions::class)) {
$package = InstalledVersions::getRootPackage()['install_path']??null;
$package = InstalledVersions::getRootPackage()['install_path']?:null;
$package = is_string($package) ? realpath($package) : null;
if ($package && is_dir($package)) {
$root = $package;
Expand Down Expand Up @@ -102,14 +102,15 @@ public static function getPossibleRootDirectory()
&& is_string(TD_APP_DIRECTORY)
&& dirname(TD_APP_DIRECTORY) . '/vendor'
) {
$exists = false;
$v = TD_APP_DIRECTORY;
$c = 3;
do {
$v = dirname($v);
} while (--$c > 0 && !($exists = file_exists($v . '/composer.json')));
$root = ($exists??false) ? $v : dirname(TD_APP_DIRECTORY);
$root = $exists ? $v : dirname(TD_APP_DIRECTORY);
$composerJson = "$root/composer.json";
$composerJson = realpath($composerJson)??$composerJson;
$composerJson = realpath($composerJson)?:$composerJson;
if (isset(self::$composerJsonConfig[$composerJson])) {
$root = self::$composerJsonConfig[$composerJson];
} else {
Expand Down

0 comments on commit e9551fe

Please sign in to comment.