mirror of
https://codeberg.org/vlw/php-globalsnapshot.git
synced 2025-09-13 20:03:41 +02:00
chore: add PHP 8.1 readonly properties (#4)
Reviewed-on: https://codeberg.org/vlw/php-globalsnapshot/pulls/4 Co-authored-by: vlw <victor@vlw.se> Co-committed-by: vlw <victor@vlw.se>
This commit is contained in:
parent
0db14c2d0b
commit
4bb9e4a08c
2 changed files with 11 additions and 9 deletions
|
@ -1,6 +1,8 @@
|
||||||
# php-globalsnapshot
|
# 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:
|
Example use:
|
||||||
```php
|
```php
|
||||||
|
|
|
@ -7,14 +7,14 @@
|
||||||
// can be restored to this point in time by calling $this->restore();
|
// can be restored to this point in time by calling $this->restore();
|
||||||
class GlobalSnapshot {
|
class GlobalSnapshot {
|
||||||
// Declare all PHP superglobals
|
// Declare all PHP superglobals
|
||||||
private array $_ENV;
|
private readonly array $_ENV;
|
||||||
private array $_GET;
|
private readonly array $_GET;
|
||||||
private array $_POST;
|
private readonly array $_POST;
|
||||||
private array $_FILES;
|
private readonly array $_FILES;
|
||||||
private array $_SERVER;
|
private readonly array $_SERVER;
|
||||||
private array $_COOKIE;
|
private readonly array $_COOKIE;
|
||||||
private array $_REQUEST;
|
private readonly array $_REQUEST;
|
||||||
private array $_SESSION;
|
private readonly array $_SESSION;
|
||||||
|
|
||||||
// Declare additional PHP globals (for PHP 8.0+ compatability)
|
// Declare additional PHP globals (for PHP 8.0+ compatability)
|
||||||
// These will not be captured, or altered by GlobalSnapshot
|
// These will not be captured, or altered by GlobalSnapshot
|
||||||
|
|
Loading…
Add table
Reference in a new issue