Add isFlushed() to Kernel interface

Also add explicit return type
This commit is contained in:
Chris Penny 2023-02-23 11:08:31 +13:00 committed by Guy Sartorelli
parent e962608918
commit c82d11ef70
No known key found for this signature in database
GPG Key ID: F313E3B9504D496A
4 changed files with 14 additions and 20 deletions

View File

@ -188,7 +188,7 @@ abstract class BaseKernel implements Kernel
$this->getIncludeTests(),
$flush
);
// Flush config
if ($flush) {
$config = $this->getConfigLoader()->getManifest();
@ -265,7 +265,7 @@ abstract class BaseKernel implements Kernel
abstract public function boot($flush = false);
abstract public function isFlushed();
abstract public function isFlushed(): ?bool;
/**
* Check if there's a legacy _ss_environment.php file

View File

@ -15,11 +15,8 @@ class CoreKernel extends BaseKernel
/**
* Indicates whether the Kernel has been flushed on boot
* Uninitialised before boot
*
* @var bool
*/
private $flush;
private ?bool $flush = null;
/**
* @param false $flush
@ -217,12 +214,7 @@ class CoreKernel extends BaseKernel
return null;
}
/**
* Returns whether the Kernel has been flushed on boot
*
* @return bool|null null if the kernel hasn't been booted yet
*/
public function isFlushed()
public function isFlushed(): ?bool
{
return $this->flush;
}

View File

@ -16,11 +16,9 @@ class DatabaselessKernel extends BaseKernel
{
/**
* Indicates whether the Kernel has been flushed on boot
* Uninitialised before boot
*
* @var bool
* Null before boot
*/
private $flush;
private ?bool $flush = null;
/**
* Allows disabling of the configured error handling.
@ -53,10 +51,7 @@ class DatabaselessKernel extends BaseKernel
$this->setBooted(true);
}
/**
* @return bool
*/
public function isFlushed()
public function isFlushed(): ?bool
{
return $this->flush;
}

View File

@ -132,4 +132,11 @@ interface Kernel
* @return $this
*/
public function setEnvironment($environment);
/**
* Returns whether the Kernel has been flushed on boot
*
* @return bool|null null if the kernel hasn't been booted yet
*/
public function isFlushed(): ?bool;
}