Convert ProjectOptions constants to enum cases

This commit is contained in:
netkas 2024-09-14 08:39:05 -04:00
parent 2efa6654e6
commit ec6b368a82
4 changed files with 5 additions and 4 deletions

View file

@ -53,7 +53,7 @@
);
$project_manager->getProjectConfiguration()->getBuild()->setMain('main_policy');
$project_manager->getProjectConfiguration()->getProject()->addOption(ProjectOptions::CREATE_SYMLINK, true);
$project_manager->getProjectConfiguration()->getProject()->addOption(ProjectOptions::CREATE_SYMLINK->value, true);
// Create the release build configuration
$release_executable = new BuildConfiguration('release_executable',

View file

@ -22,7 +22,7 @@
namespace ncc\Enums\Options;
final class ProjectOptions
enum ProjectOptions : string
{
public const CREATE_SYMLINK = 'create_symlink';
case CREATE_SYMLINK = 'create_symlink';
}

View file

@ -453,7 +453,7 @@
throw new IOException(sprintf('Failed to add package to package lock file due to an exception: %s', $e->getMessage()), $e);
}
if($package_reader->getMetadata()->getOption(ProjectOptions::CREATE_SYMLINK) === null)
if($package_reader->getMetadata()->getOption(ProjectOptions::CREATE_SYMLINK->value) === null)
{
// Remove the symlink if it exists
if($this->package_lock->getEntry($package_reader->getAssembly()->getPackage())->isSymlinkRegistered())

View file

@ -105,6 +105,7 @@
*/
public function addOption(string $key, mixed $value): void
{
// TODO: Options here could be using ProjectOptions enum
$this->options[$key] = $value;
}