Skip to content

Commit

Permalink
Don't calculate basePath in LibraryProperties::buildNames
Browse files Browse the repository at this point in the history
  • Loading branch information
gmazzap committed Mar 9, 2022
1 parent 7c1d1a1 commit 2455d05
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/Properties/LibraryProperties.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ public static function new(string $composerJsonFile, ?string $baseUrl = null): L
$properties[self::PROP_VERSION] = $version;
}

[$basePath, $baseName, $name] = static::buildNames($composerJsonData, $composerJsonFile);
[$baseName, $name] = static::buildNames($composerJsonData);
$basePath = dirname($composerJsonFile);
if (empty($properties[self::PROP_NAME])) {
$properties[self::PROP_NAME] = $name;
}
Expand All @@ -94,15 +95,12 @@ public static function new(string $composerJsonFile, ?string $baseUrl = null): L

/**
* @param array $composerJsonData
* @param string $composerJsonFile
*
* @return array{string, string, string}
* @return array{string, string}
*/
private static function buildNames(array $composerJsonData, string $composerJsonFile): array
private static function buildNames(array $composerJsonData): array
{
$composerName = (string) ($composerJsonData['name'] ?? '');
$basePath = dirname($composerJsonFile);

$packageNamePieces = explode('/', $composerName, 2);
$basename = implode('-', $packageNamePieces);
// "inpsyde/foo-bar-baz" => "Inpsyde Foo Bar Baz"
Expand All @@ -111,7 +109,7 @@ private static function buildNames(array $composerJsonData, string $composerJson
MB_CASE_TITLE
);

return [$basePath, $basename, $name];
return [$basename, $name];
}

/**
Expand Down

0 comments on commit 2455d05

Please sign in to comment.