Remove PACKAGE_LOCK_VERSION constant from Versions enum
This commit is contained in:
parent
da8a6fac01
commit
3950655024
2 changed files with 9 additions and 12 deletions
|
@ -29,11 +29,6 @@
|
||||||
*/
|
*/
|
||||||
case CREDENTIALS_STORE_VERSION = '1.0.0';
|
case CREDENTIALS_STORE_VERSION = '1.0.0';
|
||||||
|
|
||||||
/**
|
|
||||||
* The current version of the package lock structure file format
|
|
||||||
*/
|
|
||||||
case PACKAGE_LOCK_VERSION = '2.0.0';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generic version of the package structure file format (latest)
|
* Generic version of the package structure file format (latest)
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -35,10 +35,12 @@
|
||||||
|
|
||||||
class PackageLock implements BytecodeObjectInterface
|
class PackageLock implements BytecodeObjectInterface
|
||||||
{
|
{
|
||||||
|
private const string PACKAGE_LOCK_VERSION = '2.0.0';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The version of package lock file structure
|
* The version of package lock file structure
|
||||||
*
|
*
|
||||||
* @var string
|
* @var Versions
|
||||||
*/
|
*/
|
||||||
private $package_lock_version;
|
private $package_lock_version;
|
||||||
|
|
||||||
|
@ -59,11 +61,11 @@
|
||||||
/**
|
/**
|
||||||
* Public Constructor
|
* Public Constructor
|
||||||
*/
|
*/
|
||||||
public function __construct(array $entries=[], string $package_lock_version=Versions::PACKAGE_LOCK_VERSION->value, ?int $last_updated_timestamp=null)
|
public function __construct(array $entries=[], ?int $last_updated_timestamp=null)
|
||||||
{
|
{
|
||||||
$this->entries = $entries;
|
$this->entries = $entries;
|
||||||
$this->package_lock_version = $package_lock_version;
|
$this->package_lock_version = self::PACKAGE_LOCK_VERSION;
|
||||||
$this->last_updated_timestamp = $last_updated_timestamp ?? time();
|
$this->last_updated_timestamp = $last_updated_timestamp ? null : time();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -93,7 +95,7 @@
|
||||||
*/
|
*/
|
||||||
private function update(): void
|
private function update(): void
|
||||||
{
|
{
|
||||||
$this->package_lock_version = Versions::PACKAGE_LOCK_VERSION;
|
$this->package_lock_version = self::PACKAGE_LOCK_VERSION;
|
||||||
$this->last_updated_timestamp = time();
|
$this->last_updated_timestamp = time();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -280,7 +282,7 @@
|
||||||
}, $entries_array);
|
}, $entries_array);
|
||||||
|
|
||||||
|
|
||||||
$package_lock_version = Functions::array_bc($data, 'package_lock_version') ?? Versions::PACKAGE_LOCK_VERSION->value;
|
$package_lock_version = Functions::array_bc($data, 'package_lock_version') ?? self::PACKAGE_LOCK_VERSION;
|
||||||
$last_updated_timestamp = Functions::array_bc($data, 'last_updated_timestamp') ?? time();
|
$last_updated_timestamp = Functions::array_bc($data, 'last_updated_timestamp') ?? time();
|
||||||
|
|
||||||
if($package_lock_version === null)
|
if($package_lock_version === null)
|
||||||
|
@ -288,6 +290,6 @@
|
||||||
throw new ConfigurationException('Package lock version is missing');
|
throw new ConfigurationException('Package lock version is missing');
|
||||||
}
|
}
|
||||||
|
|
||||||
return new self($entries, $package_lock_version, $last_updated_timestamp);
|
return new self($entries, $last_updated_timestamp);
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue