fix:repo cleanup

This commit is contained in:
2025-11-08 20:09:07 +00:00
parent f1da93791d
commit dedcc73567
1204 changed files with 121800 additions and 16971 deletions
+21
View File
@@ -2,6 +2,24 @@
All notable changes in `sebastian/global-state` are documented in this file using the [Keep a CHANGELOG](https://keepachangelog.com/) principles.
## [8.0.2] - 2025-08-29
### Changed
* [#39](https://github.com/sebastianbergmann/global-state/pull/39): Restore nullable variables in super-global arrays
## [8.0.1] - 2025-08-28
### Changed
* [#38](https://github.com/sebastianbergmann/global-state/pull/38): Improve performance of `Snapshot::snapshotSuperGlobalArray()`
## [8.0.0] - 2025-02-07
### Removed
* This component is no longer supported on PHP 8.2
## [7.0.2] - 2024-07-03
### Changed
@@ -110,6 +128,9 @@ All notable changes in `sebastian/global-state` are documented in this file usin
* This component is no longer supported on PHP 7.0 and PHP 7.1
[8.0.2]: https://github.com/sebastianbergmann/global-state/compare/8.0.1...8.0.2
[8.0.1]: https://github.com/sebastianbergmann/global-state/compare/8.0.0...8.0.1
[8.0.0]: https://github.com/sebastianbergmann/global-state/compare/7.0...8.0.0
[7.0.2]: https://github.com/sebastianbergmann/global-state/compare/7.0.1...7.0.2
[7.0.1]: https://github.com/sebastianbergmann/global-state/compare/7.0.0...7.0.1
[7.0.0]: https://github.com/sebastianbergmann/global-state/compare/6.0...7.0.0
+1 -1
View File
@@ -1,6 +1,6 @@
BSD 3-Clause License
Copyright (c) 2001-2024, Sebastian Bergmann
Copyright (c) 2001-2025, Sebastian Bergmann
All rights reserved.
Redistribution and use in source and binary forms, with or without
+1 -1
View File
@@ -1,4 +1,4 @@
[![Latest Stable Version](https://poser.pugx.org/sebastian/global-state/v/stable.png)](https://packagist.org/packages/sebastian/global-state)
[![Latest Stable Version](https://poser.pugx.org/sebastian/global-state/v)](https://packagist.org/packages/sebastian/global-state)
[![CI Status](https://github.com/sebastianbergmann/global-state/workflows/CI/badge.svg)](https://github.com/sebastianbergmann/global-state/actions)
[![codecov](https://codecov.io/gh/sebastianbergmann/global-state/branch/main/graph/badge.svg)](https://codecov.io/gh/sebastianbergmann/global-state)
+6 -6
View File
@@ -17,19 +17,19 @@
"prefer-stable": true,
"config": {
"platform": {
"php": "8.2.0"
"php": "8.3.0"
},
"optimize-autoloader": true,
"sort-packages": true
},
"require": {
"php": ">=8.2",
"sebastian/object-reflector": "^4.0",
"sebastian/recursion-context": "^6.0"
"php": ">=8.3",
"sebastian/object-reflector": "^5.0",
"sebastian/recursion-context": "^7.0"
},
"require-dev": {
"ext-dom": "*",
"phpunit/phpunit": "^11.0"
"phpunit/phpunit": "^12.0"
},
"autoload": {
"classmap": [
@@ -46,7 +46,7 @@
},
"extra": {
"branch-alias": {
"dev-main": "7.0-dev"
"dev-main": "8.0-dev"
}
}
}
+4 -1
View File
@@ -13,6 +13,7 @@ use function array_diff;
use function array_key_exists;
use function array_keys;
use function array_merge;
use function assert;
use function in_array;
use function is_array;
use ReflectionClass;
@@ -95,7 +96,9 @@ final class Restorer
);
foreach ($keys as $key) {
if (isset($superGlobalVariables[$superGlobalArray][$key])) {
assert(isset($GLOBALS[$superGlobalArray]) && is_array($GLOBALS[$superGlobalArray]));
if (array_key_exists($key, $superGlobalVariables[$superGlobalArray])) {
$GLOBALS[$superGlobalArray][$key] = $superGlobalVariables[$superGlobalArray][$key];
} else {
unset($GLOBALS[$superGlobalArray][$key]);
+27 -11
View File
@@ -96,7 +96,11 @@ final class Snapshot
public function __construct(?ExcludeList $excludeList = null, bool $includeGlobalVariables = true, bool $includeStaticProperties = true, bool $includeConstants = true, bool $includeFunctions = true, bool $includeClasses = true, bool $includeInterfaces = true, bool $includeTraits = true, bool $includeIniSettings = true, bool $includeIncludedFiles = true)
{
$this->excludeList = $excludeList ?: new ExcludeList;
if ($excludeList === null) {
$excludeList = new ExcludeList;
}
$this->excludeList = $excludeList;
if ($includeConstants) {
$this->snapshotConstants();
@@ -128,6 +132,7 @@ final class Snapshot
assert($iniSettings !== false);
/* @phpstan-ignore assign.propertyType */
$this->iniSettings = $iniSettings;
}
@@ -290,10 +295,11 @@ final class Snapshot
foreach (array_keys($GLOBALS) as $key) {
if ($key !== 'GLOBALS' &&
!in_array($key, $superGlobalArrays, true) &&
$this->canBeSerialized($GLOBALS[$key]) &&
!$this->excludeList->isGlobalVariableExcluded($key)) {
/* @noinspection UnserializeExploitsInspection */
$this->globalVariables[$key] = unserialize(serialize($GLOBALS[$key]));
!$this->excludeList->isGlobalVariableExcluded($key) &&
$this->canBeSerialized($GLOBALS[$key])
) {
/* @phpstan-ignore assign.propertyType */
$this->globalVariables[$key] = $this->copyWithSerialize($GLOBALS[$key]);
}
}
}
@@ -304,8 +310,8 @@ final class Snapshot
if (isset($GLOBALS[$superGlobalArray]) && is_array($GLOBALS[$superGlobalArray])) {
foreach ($GLOBALS[$superGlobalArray] as $key => $value) {
/* @noinspection UnserializeExploitsInspection */
$this->superGlobalVariables[$superGlobalArray][$key] = unserialize(serialize($value));
/* @phpstan-ignore assign.propertyType */
$this->superGlobalVariables[$superGlobalArray][$key] = $this->copyWithSerialize($value);
}
}
}
@@ -331,13 +337,12 @@ final class Snapshot
$value = $property->getValue();
if ($this->canBeSerialized($value)) {
/* @noinspection UnserializeExploitsInspection */
$snapshot[$name] = unserialize(serialize($value));
$snapshot[$name] = $this->copyWithSerialize($value);
}
}
}
if (!empty($snapshot)) {
if ($snapshot !== []) {
$this->staticProperties[$className] = $snapshot;
}
}
@@ -356,6 +361,16 @@ final class Snapshot
];
}
private function copyWithSerialize(mixed $variable): mixed
{
if (is_scalar($variable) || $variable === null) {
return $variable;
}
/* @noinspection UnserializeExploitsInspection */
return unserialize(serialize($variable));
}
private function canBeSerialized(mixed $variable): bool
{
if (is_scalar($variable) || $variable === null) {
@@ -396,7 +411,8 @@ final class Snapshot
{
$result = [];
if ($processed->contains($variable)) {
/* @phpstan-ignore argument.type */
if ($processed->contains($variable) !== false) {
return $result;
}