function Locker::isFresh
Checks whether the lock file is still up to date with the current hash
File
-
vendor/
composer/ composer/ src/ Composer/ Package/ Locker.php, line 138
Class
- Locker
- Reads/writes project lockfile (composer.lock).
Namespace
Composer\PackageCode
public function isFresh() : bool {
$lock = $this->lockFile
->read();
if (!empty($lock['content-hash'])) {
// There is a content hash key, use that instead of the file hash
return $this->contentHash === $lock['content-hash'];
}
// BC support for old lock files without content-hash
if (!empty($lock['hash'])) {
return $this->hash === $lock['hash'];
}
// should not be reached unless the lock file is corrupted, so assume it's out of date
return false;
}