diff --git a/README.md b/README.md index 39cb8eb..9c894e0 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # php-globalsnapshot -Capture the current state of all [PHP superglobal variables](https://www.php.net/manual/en/language.variables.superglobals.php); which can then be restored to that state at a later time. +Capture the current state of all [PHP superglobal variables](https://www.php.net/manual/en/language.variables.superglobals.php) - which can then be restored to the state of capture at a later time. + +**Supports PHP 8.1+** Example use: ```php diff --git a/src/GlobalSnapshot.php b/src/GlobalSnapshot.php index 3e9d2a2..e30d894 100644 --- a/src/GlobalSnapshot.php +++ b/src/GlobalSnapshot.php @@ -7,14 +7,14 @@ // can be restored to this point in time by calling $this->restore(); class GlobalSnapshot { // Declare all PHP superglobals - private array $_ENV; - private array $_GET; - private array $_POST; - private array $_FILES; - private array $_SERVER; - private array $_COOKIE; - private array $_REQUEST; - private array $_SESSION; + private readonly array $_ENV; + private readonly array $_GET; + private readonly array $_POST; + private readonly array $_FILES; + private readonly array $_SERVER; + private readonly array $_COOKIE; + private readonly array $_REQUEST; + private readonly array $_SESSION; // Declare additional PHP globals (for PHP 8.0+ compatability) // These will not be captured, or altered by GlobalSnapshot