sebastianbergmann/global-state
66.2
Adequate · 19 September 2026
1.1k
lines of production code
PHP
primary language
1
measurement over time
What this system is
This library manages PHP global state by capturing snapshots of constants, variables, and INI settings, and provides mechanisms to export them as reproducible code or restore them to their original values. It includes a dedicated exception hierarchy for error handling and comprehensive test fixtures to verify serialization and restoration behaviors. The system is built on modern tooling, utilizing PHPStan for static analysis and GitHub Actions for automation, and requires PHP 8.4 or higher.
Features
Add exception interface and runtime exception class
The library now provides a dedicated exception hierarchy under the \SebastianBergmann\\GlobalState\ namespace. A new \Exception\ interface extends PHP's \Throwable\, and a \RuntimeException\ class implements this interface while extending the native \RuntimeException\. This allows consumers to catch global-state-related errors using the library's specific exception types rather than relying solely on generic PHP exceptions.
src/exceptions · high confidence
New code exporter and global state restoration capabilities
This release introduces a CodeExporter that generates PHP code to recreate global state (constants, global variables, and ini settings) from a Snapshot, enabling reproducible test environments. It also adds a Restorer class to revert global variables and static properties to their snapshot values, and an ExcludeList to configure which global variables, classes, and static properties should be omitted from snapshots.
src · high confidence
Behavioural changes
138 commits (0 fixes) modifying tools
A change to existing behaviour in tools — 138 commits, 4 files.
tools · medium confidence · unverified
Automated release note extraction and PHPUnit configuration removal
A new build script, \extract-release-notes.php\, has been added to automate the extraction of release notes from the \ChangeLog.md\ file based on a specified version tag, streamlining the release process. Concurrently, the legacy \phpunit.xml\ configuration file has been removed, indicating a shift away from the previous PHPUnit 4.2 testing setup.
build · high confidence
Modernized build automation and static analysis tooling
The project has replaced its legacy Travis CI and Ant-based build system with GitHub Actions and Phive-managed tools. Build automation now uses \tools/composer\ and \tools/phive\ for dependency and tool management, while static analysis has switched from Psalm to PHPStan (configured at level 10 with strict rules). Additionally, the PHPUnit configuration has been updated to enforce stricter testing standards, including process isolation and coverage metadata requirements, and a Security Policy has been added.
(repo-wide) · high confidence
Test coverage
Added test fixtures for global state snapshotting; Added unit tests for global state management components.
Dependencies
Major version upgrade to 9.0 with PHP 8.4 requirement and dependency updates
This release upgrades the library to version 9.0, dropping support for older PHP versions in favor of a strict requirement for PHP 8.4 or higher. The dependency on \sebastian/object-reflector\ has been updated to version 6.1.0, and \sebastian/recursion-context\ to 8.0.1. Development tooling has also been upgraded, with \phpunit/phpunit\ moving to version 13.3.4. Additionally, the project homepage URL has been updated to use HTTPS, and a security policy link has been added to the support metadata.
(dependencies) · high confidence
Updated PHPStan static analysis tooling to version 2.2.14
The local PHPStan installation in tools/.phpstan has been updated to version 2.2.14, accompanied by upgrades to the phpstan-strict-rules extension (2.0.12) and the ergebnis/phpstan-rules extension (2.13.1). This update brings the latest static analysis capabilities and rule sets to the project's development environment, ensuring that code quality checks reflect the most recent standards and bug fixes provided by these libraries.
tools/.phpstan · high confidence
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Baseline
- First survey — no prior run to compare against. CAI 66.
Lenses
- Code Health 98
- Architecture 69
- Maturity 54
- Readiness 78
- Security 89
Changes since last survey
- 300 commits — 294 feature/other, 6 fixes
By area
- (root) — 78 commits
- .phive/phars.xml — 78 commits
- .github/workflows — 54 commits
- tools/.phpstan — 40 commits
- (repo) — 22 commits
- src/Snapshot.php — 6 commits
- .psalm/baseline.xml — 4 commits
- src/Restorer.php — 4 commits
- tests/unit — 4 commits
- .github/FUNDING.yml — 2 commits
- src/ExcludeList.php — 2 commits
- tests/_fixture — 2 commits
- .github/CODE_OF_CONDUCT.md — 1 commit
- .github/CONTRIBUTING.md — 1 commit
- .psalm/config.xml — 1 commit
- src/CodeExporter.php — 1 commit
Notable commits
- fix: Fix CS/WS issues
- fix: Fix CS/WS issues
- fix: Fix CS/WS issues
- fix: Fix issues identified by PHPStan
- fix: Fix package name
- fix: Fix/Tweak
- change: * Install PHPStan using Composer in order to be able to use phpstan/phpstan-strict-rules and tomasvotruba/type-coverage * Configure phpstan/phpstan-strict-rules, tomasvotruba/type-coverage, and ergebnis/phpstan-rules * Update PHPStan configuration * Put Phive binary under version control and manage it through "ant update-tools"
- change: Add Liberapay and Tidelift
- change: Add Security Policy
- change: Add documentation on how to contribute
- change: Add link to security policy
- change: Add missing code coverage annotations
- change: Add test for Restorer::restoreStaticProperties()
- change: Add thanks.dev
- change: Allow write operations
- change: Also automerge minor updates
- change: Assert we have valid values
- change: Bump
- change: Bump
- change: Bump copyright year
- …and 280 more
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
sebastianbergmann/global-state was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 19 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit 218db6bfffa23dbdaeda966bf1346c1e76e15500 — the exact code this score is about.
- Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
- Measured by watchdog.canine.dev using codehealth-analyzer preprod-13a154b7f5d1.