thecodingmachine/phpstan-safe-rule
A PHPStan rule to detect safety issues. Must be used in conjunction with thecodingmachine/safe
v1.4.7
11M downloads/mo
#1684 most downloaded on Packagist
thecodingmachine/phpstan-safe-rule
What this package is like to depend on
Last release 2 months ago
21 Jun 2026
Ships unpredictably
gaps range from 4 weeks to 2.9 years
Some releases are documented
notes for 8 of 17 stable releases
Nothing withdrawn
no release was ever pulled
8 years old
18 releases · first in 2018
3 releases in the last 12 months
see the full history below
Release timeline
18 releases · Sep 2018 to Jun 2026Releases
latest 18-
v1.4.721 Jun 2026 -
v1.4.421 Jun 2026Release notes
Open source →What's Changed
- Sync
preg_matchextensions with PHPStan upstream + expose identity-check narrowing bug by @mvhirsch in #65 - work on fixing CI, fixes #66 by @shish in #67
- Improve ReplaceSafeFunctions type inference by @staabm in #70
New Contributors
Full Changelog: v1.4.3...v1.4.4
- Sync
-
v1.4.321 Nov 2025Release notes
Open source →What's Changed
- Trigger reflection processing lazily by @kayw-geek, @staabm in #64
Full Changelog: v1.4.2...v1.4.3
-
v1.4.217 Aug 2025Release notes
Open source →What's Changed
- feat: infer
preg_replace_callbackreturn type by @mRoca in #60 - Add json decode return type extension by @Khartir in #61
New Contributors
Full Changelog: v1.4.1...v1.4.2
- feat: infer
-
v1.4.109 Apr 2025Release notes
Open source →What's Changed
- Consider named argument flags:
JSON_THROW_ON_ERRORfor json_ functions as "Safe" by @shish in #56 - Fix tests with latest dependencies by @spawnia in #59
- Handle FuncCall nodes that represent first class callables by @spawnia in #32
New Contributors
Full Changelog: v1.4.0...v1.4.1
- Consider named argument flags:
-
v1.4.011 Feb 2025Release notes
Open source →What's Changed (tl;dr)
- Drop support for EOL'ed PHP versions - 8.1 is the new minimum
- Fix "unsafe function" error ID code
- Port phpstan's special-case support for
preg_matchso that it also applies toSafe\preg_match(ie, the$matchesarray is now accurately typed to match the regex pattern used, rather than being a generic?array)
What's Changed (Full)
- flag this rule as compatible with thecodingmachine/safe v3 by @shish in #39
- fix error identifier by @shish in #41
- add composer test command by @shish in #42
- drop support for long-dead php versions by @shish in #44
- Type hints for Safe\preg_match, fixes #40 by @shish in #43
- enable formatting in tests/ by @shish in #45
- additional magic for preg_match, fixes #46 by @shish in #47
- consistently use phpstan's testing framework to test phpstan bits by @shish in #48
- More formatting by @shish in #50
- Require safe ^1.2 by @shish in #51
- Bump phpunit to be less-deprecated by @shish in #49
New Contributors
Full Changelog: v1.3.1...v1.4.0
-
v1.3.109 Feb 2025 -
v1.3.002 Dec 2024Release notes
Open source →What's Changed
This new release brings support for PHPStan 2.0 (and drops support for PHPStan 1.0)
- PHPStan 2 + GHA CI by @Jean85 in #35
- Fix broken test by @Jean85 in #36
- Increase static analysis by @Jean85 in #37
- Adding CODECOV_TOKEN in CI by @moufmouf in #38
New Contributors
Full Changelog: v1.2.0...v1.3.0
-
v1.2.017 Jan 2022Nothing published for this version
-
v1.1.017 Nov 2021Nothing published for this version
-
v1.0.130 Aug 2020Nothing published for this version
-
v1.0.002 Jan 2020Nothing published for this version
-
v1.0.0-beta104 Dec 2019 pre-releaseNothing published for this version
-
v0.1.415 Jul 2019Nothing published for this version
-
v0.1.307 Mar 2019Nothing published for this version
-
v0.1.221 Jan 2019Nothing published for this version
-
v0.1.118 Jan 2019Nothing published for this version
-
v0.1.006 Sep 2018Nothing published for this version