-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avoid creating an Exception when it is not necessary. #208
Conversation
Do a fulltext search for |
da5bd4a
to
5ff62c4
Compare
ah very nice, they don't affect the outcome of my profile too much but i don't think my test phpdoc is hitting that part of the code too much if at all |
5ff62c4
to
c54a59b
Compare
Thank you! |
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [phpstan/phpstan](https://togithub.com/phpstan/phpstan) | require-dev | patch | `^1.10.33` -> `^1.10.34` | --- ### ⚠ Dependency Lookup Warnings ⚠ Warnings were logged while processing this repo. Please check the Dependency Dashboard for more information. --- ### Release Notes <details> <summary>phpstan/phpstan (phpstan/phpstan)</summary> ### [`v1.10.34`](https://togithub.com/phpstan/phpstan/releases/tag/1.10.34) [Compare Source](https://togithub.com/phpstan/phpstan/compare/1.10.33...1.10.34) # Improvements 🔧 - Add support and tests for `$this` type assertions ([#​2609](https://togithub.com/phpstan/phpstan-src/pull/2609)), [#​8904](https://togithub.com/phpstan/phpstan/issues/8904), thanks [@​ekisu](https://togithub.com/ekisu)! - Update [phpstan/phpdoc-parser to 1.24.0](https://togithub.com/phpstan/phpdoc-parser/releases/tag/1.24.0) - Allow asserting the type of `$this` ([phpstan/phpdoc-parser#209), thanks [@​ekisu](https://togithub.com/ekisu)! - Avoid creating an Exception when it is not necessary ([phpstan/phpdoc-parser#208), thanks [@​mad-briller](https://togithub.com/mad-briller)! - Added `--fail-without-result-cache` CLI option ([#​2611](https://togithub.com/phpstan/phpstan-src/pull/2611)), thanks [@​staabm](https://togithub.com/staabm)! - Make result cache independent from configs include order ([#​2606](https://togithub.com/phpstan/phpstan-src/pull/2606)), thanks [@​staabm](https://togithub.com/staabm)! - Reduce unnecessary calls into reflection ([#​2614](https://togithub.com/phpstan/phpstan-src/pull/2614)), thanks [@​staabm](https://togithub.com/staabm)! - Micro-optimize with `in_array()` ([#​2618](https://togithub.com/phpstan/phpstan-src/pull/2618)), thanks [@​zonuexe](https://togithub.com/zonuexe)! - Cover ArgumentsNormalizer with BC promise (phpstan/phpstan-src@b87db62) - LastConditionVisitor: condition followed by throw is marked as last ([#​2405](https://togithub.com/phpstan/phpstan-src/pull/2405)), thanks [@​JanTvrdik](https://togithub.com/JanTvrdik)! # Function signature fixes 🤖 - fix incorrect doc for `inotify_read` ([#​2605](https://togithub.com/phpstan/phpstan-src/pull/2605)), thanks [@​taka-oyama](https://togithub.com/taka-oyama)! # Internals 🔍 - name-collision-detector (phpstan/phpstan-src@95cdbe5) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/ben-challis/sql-migrations). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi44My4wIiwidXBkYXRlZEluVmVyIjoiMzYuODMuMCIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
This change made the code a bit less DRY, which it didn't have to, to avoid creating the exception when not necessary. You could have created a closure that creates the exception when needed:
I'm not sure however, how much the overhead of the closure call would be here. @mad-briller if you're interested in doing it, I'd be curious of the profiling results when it's using a closure. |
personally i'd argue that you want your exception to be created exactly where it is thrown, because of the php quirk that the stack trace is captured on creation not throw in the old code, and also with your suggestion, when the exception is created you lose the context of where exactly it is thrown, which is useful to know when debugging stack traces passed on from users that alone is a good reason to break the DRY principle with regards to exceptions in my opinion, ignoring any performance wins of either approach |
Good point, didn't think of that! |
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [ergebnis/composer-normalize](https://togithub.com/ergebnis/composer-normalize) | require-dev | minor | `^2.36.0` -> `^2.37.0` | | [php-cs-fixer/shim](https://togithub.com/PHP-CS-Fixer/shim) | require-dev | minor | `^3.26.1` -> `^3.27.0` | | [phpstan/phpstan](https://togithub.com/phpstan/phpstan) | require-dev | patch | `^1.10.33` -> `^1.10.34` | --- ### Release Notes <details> <summary>ergebnis/composer-normalize (ergebnis/composer-normalize)</summary> ### [`v2.37.0`](https://togithub.com/ergebnis/composer-normalize/blob/HEAD/CHANGELOG.md#2370-2370) [Compare Source](https://togithub.com/ergebnis/composer-normalize/compare/2.36.0...2.37.0) For a full diff see \[`2.36.0...2.37.0`]\[2.36.0...2.37.0]. ##### Changed - Updated `schema.json` (\[[#​1170](https://togithub.com/ergebnis/composer-normalize/issues/1170)]), by \[[@​ergebnis-bot](https://togithub.com/ergebnis-bot)] ##### Fixed - Updated `composer/composer` (\[[#​1171](https://togithub.com/ergebnis/composer-normalize/issues/1171)]), by \[[@​localheinz](https://togithub.com/localheinz)] </details> <details> <summary>PHP-CS-Fixer/shim (php-cs-fixer/shim)</summary> ### [`v3.27.0`](https://togithub.com/PHP-CS-Fixer/shim/compare/v3.26.1...v3.27.0) [Compare Source](https://togithub.com/PHP-CS-Fixer/shim/compare/v3.26.1...v3.27.0) </details> <details> <summary>phpstan/phpstan (phpstan/phpstan)</summary> ### [`v1.10.34`](https://togithub.com/phpstan/phpstan/releases/tag/1.10.34) [Compare Source](https://togithub.com/phpstan/phpstan/compare/1.10.33...1.10.34) # Improvements 🔧 - Add support and tests for `$this` type assertions ([#​2609](https://togithub.com/phpstan/phpstan-src/pull/2609)), [#​8904](https://togithub.com/phpstan/phpstan/issues/8904), thanks [@​ekisu](https://togithub.com/ekisu)! - Update [phpstan/phpdoc-parser to 1.24.0](https://togithub.com/phpstan/phpdoc-parser/releases/tag/1.24.0) - Allow asserting the type of `$this` ([phpstan/phpdoc-parser#209), thanks [@​ekisu](https://togithub.com/ekisu)! - Avoid creating an Exception when it is not necessary ([phpstan/phpdoc-parser#208), thanks [@​mad-briller](https://togithub.com/mad-briller)! - Added `--fail-without-result-cache` CLI option ([#​2611](https://togithub.com/phpstan/phpstan-src/pull/2611)), thanks [@​staabm](https://togithub.com/staabm)! - Make result cache independent from configs include order ([#​2606](https://togithub.com/phpstan/phpstan-src/pull/2606)), thanks [@​staabm](https://togithub.com/staabm)! - Reduce unnecessary calls into reflection ([#​2614](https://togithub.com/phpstan/phpstan-src/pull/2614)), thanks [@​staabm](https://togithub.com/staabm)! - Micro-optimize with `in_array()` ([#​2618](https://togithub.com/phpstan/phpstan-src/pull/2618)), thanks [@​zonuexe](https://togithub.com/zonuexe)! - Cover ArgumentsNormalizer with BC promise (phpstan/phpstan-src@b87db62) - LastConditionVisitor: condition followed by throw is marked as last ([#​2405](https://togithub.com/phpstan/phpstan-src/pull/2405)), thanks [@​JanTvrdik](https://togithub.com/JanTvrdik)! # Function signature fixes 🤖 - fix incorrect doc for `inotify_read` ([#​2605](https://togithub.com/phpstan/phpstan-src/pull/2605)), thanks [@​taka-oyama](https://togithub.com/taka-oyama)! # Internals 🔍 - name-collision-detector (phpstan/phpstan-src@95cdbe5) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://togithub.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/Lendable/composer-license-checker). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi44My4wIiwidXBkYXRlZEluVmVyIjoiMzYuODMuMCIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [phpstan/phpstan](https://togithub.com/phpstan/phpstan) | `1.10.33` -> `1.10.35` | [![age](https://developer.mend.io/api/mc/badges/age/packagist/phpstan%2fphpstan/1.10.35?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/packagist/phpstan%2fphpstan/1.10.35?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/packagist/phpstan%2fphpstan/1.10.33/1.10.35?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/packagist/phpstan%2fphpstan/1.10.33/1.10.35?slim=true)](https://docs.renovatebot.com/merge-confidence/) | | [phpunit/phpunit](https://phpunit.de/) ([source](https://togithub.com/sebastianbergmann/phpunit)) | `10.3.3` -> `10.3.5` | [![age](https://developer.mend.io/api/mc/badges/age/packagist/phpunit%2fphpunit/10.3.5?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/packagist/phpunit%2fphpunit/10.3.5?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/packagist/phpunit%2fphpunit/10.3.3/10.3.5?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/packagist/phpunit%2fphpunit/10.3.3/10.3.5?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>phpstan/phpstan (phpstan/phpstan)</summary> ### [`v1.10.35`](https://togithub.com/phpstan/phpstan/releases/tag/1.10.35) [Compare Source](https://togithub.com/phpstan/phpstan/compare/1.10.34...1.10.35) # Major new features 🚀 - Generics: **Type projections aka call-site variance** ([#​2485](https://togithub.com/phpstan/phpstan-src/pull/2485)), thanks [@​jiripudil](https://togithub.com/jiripudil)! - Learn more: https://phpstan.org/blog/guide-to-call-site-generic-variance # Bugfixes 🐛 - Make `value-of<...>` lazier (phpstan/phpstan-src@234f77d), [#​9881](https://togithub.com/phpstan/phpstan/issues/9881) - Update BetterReflection, [#​9877](https://togithub.com/phpstan/phpstan/issues/9877) - Fix `ReflectionAttribute::newInstance()` with nested class using named arguments (ondrejmirtes/BetterReflection@8d751dd), thanks [@​enumag](https://togithub.com/enumag)! - Improve typing of filters that do not accept non-falsy strings ([#​2620](https://togithub.com/phpstan/phpstan-src/pull/2620)), thanks [@​zonuexe](https://togithub.com/zonuexe)! # Internals 🔍 - name-collision-detector 2.0 (phpstan/phpstan-src@c3cb573) - Remove `phpstan/phpstan-php-parser` ([#​2632](https://togithub.com/phpstan/phpstan-src/pull/2632)), thanks [@​staabm](https://togithub.com/staabm)! ### [`v1.10.34`](https://togithub.com/phpstan/phpstan/releases/tag/1.10.34) [Compare Source](https://togithub.com/phpstan/phpstan/compare/1.10.33...1.10.34) # Improvements 🔧 - Add support and tests for `$this` type assertions ([#​2609](https://togithub.com/phpstan/phpstan-src/pull/2609)), [#​8904](https://togithub.com/phpstan/phpstan/issues/8904), thanks [@​ekisu](https://togithub.com/ekisu)! - Update [phpstan/phpdoc-parser to 1.24.0](https://togithub.com/phpstan/phpdoc-parser/releases/tag/1.24.0) - Allow asserting the type of `$this` ([phpstan/phpdoc-parser#209), thanks [@​ekisu](https://togithub.com/ekisu)! - Avoid creating an Exception when it is not necessary ([phpstan/phpdoc-parser#208), thanks [@​mad-briller](https://togithub.com/mad-briller)! - Added `--fail-without-result-cache` CLI option ([#​2611](https://togithub.com/phpstan/phpstan-src/pull/2611)), thanks [@​staabm](https://togithub.com/staabm)! - Make result cache independent from configs include order ([#​2606](https://togithub.com/phpstan/phpstan-src/pull/2606)), thanks [@​staabm](https://togithub.com/staabm)! - Reduce unnecessary calls into reflection ([#​2614](https://togithub.com/phpstan/phpstan-src/pull/2614)), thanks [@​staabm](https://togithub.com/staabm)! - Micro-optimize with `in_array()` ([#​2618](https://togithub.com/phpstan/phpstan-src/pull/2618)), thanks [@​zonuexe](https://togithub.com/zonuexe)! - Cover ArgumentsNormalizer with BC promise (phpstan/phpstan-src@b87db62) - LastConditionVisitor: condition followed by throw is marked as last ([#​2405](https://togithub.com/phpstan/phpstan-src/pull/2405)), thanks [@​JanTvrdik](https://togithub.com/JanTvrdik)! # Function signature fixes 🤖 - fix incorrect doc for `inotify_read` ([#​2605](https://togithub.com/phpstan/phpstan-src/pull/2605)), thanks [@​taka-oyama](https://togithub.com/taka-oyama)! # Internals 🔍 - name-collision-detector (phpstan/phpstan-src@95cdbe5) </details> <details> <summary>sebastianbergmann/phpunit (phpunit/phpunit)</summary> ### [`v10.3.5`](https://togithub.com/sebastianbergmann/phpunit/compare/10.3.4...10.3.5) [Compare Source](https://togithub.com/sebastianbergmann/phpunit/compare/10.3.4...10.3.5) ### [`v10.3.4`](https://togithub.com/sebastianbergmann/phpunit/compare/10.3.3...10.3.4) [Compare Source](https://togithub.com/sebastianbergmann/phpunit/compare/10.3.3...10.3.4) </details> --- ### Configuration 📅 **Schedule**: Branch creation - "before 4am on Monday" (UTC), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://togithub.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/cerbos/cerbos-sdk-php). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi44My4wIiwidXBkYXRlZEluVmVyIjoiMzYuOTcuMSIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==--> Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Signed-off-by: Oğuzhan Durgun <oguzhandurgun95@gmail.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [phpstan/phpstan](https://togithub.com/phpstan/phpstan) | `1.9.2` -> `1.10.39` | [![age](https://developer.mend.io/api/mc/badges/age/packagist/phpstan%2fphpstan/1.10.39?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/packagist/phpstan%2fphpstan/1.10.39?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/packagist/phpstan%2fphpstan/1.9.2/1.10.39?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/packagist/phpstan%2fphpstan/1.9.2/1.10.39?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>phpstan/phpstan (phpstan/phpstan)</summary> ### [`v1.10.39`](https://togithub.com/phpstan/phpstan/releases/tag/1.10.39) [Compare Source](https://togithub.com/phpstan/phpstan/compare/1.10.38...1.10.39) # Improvements 🔧 - More information about thrown exception in child process (https://github.com/phpstan/phpstan-src/commit/d6a576adcdaf3c6d64ccbeb6fcbae7100cc674f4) - PHPStan Pro - allow overriding `pro.tmpDir` config parameter (https://github.com/phpstan/phpstan-src/commit/4a952068df57b09e8920de756ab2a6b8a0ffdf10, https://github.com/phpstan/phpstan-src/commit/7c4ef6b2aa246a31128b035cd07e64ff202ecc2b) - Optimize memory consumption when doing sha1 file hash ([#​2680](https://togithub.com/phpstan/phpstan-src/pull/2680)), thanks [@​staabm](https://togithub.com/staabm)! - Optimize memory consumption in ResultCacheManager ([#​2681](https://togithub.com/phpstan/phpstan-src/pull/2681)), thanks [@​staabm](https://togithub.com/staabm)! # Bugfixes 🐛 - Filter right side of `??=` with `=== null` (https://github.com/phpstan/phpstan-src/commit/f407ac69ba1d967b2258ff2a506f53c8cf0a8e5d) - Fix possible internal error when analysing code with enums on PHP 7.x (https://github.com/phpstan/phpstan-src/commit/b9d96266478461696d8db461a15601c7b4654d9a), [#​9974](https://togithub.com/phpstan/phpstan/issues/9974) - NonexistentOffsetInArrayDimFetchRule - do not report errors on expressions after truthy `isset` check (https://github.com/phpstan/phpstan-src/commit/6fbd6e48b86b995b7ab118e0575c747fe224165b), [#​9991](https://togithub.com/phpstan/phpstan/issues/9991) - Use real native function name instead of lowercase one ([#​2673](https://togithub.com/phpstan/phpstan-src/pull/2673)), [#​10003](https://togithub.com/phpstan/phpstan/issues/10003), thanks [@​fredden](https://togithub.com/fredden)! - Include property intializations from parent scope for anonymous functions ([#​2607](https://togithub.com/phpstan/phpstan-src/pull/2607)), [#​9831](https://togithub.com/phpstan/phpstan/issues/9831), thanks [@​fabacino](https://togithub.com/fabacino)! - FileFinder - make list of found files unique (https://github.com/phpstan/phpstan-src/commit/749126094d4ea84f770251dd41a277a46567b47e) - Fix internal error with first-class callable in `array_filter` (https://github.com/phpstan/phpstan-src/commit/0228643a9062c6ceb2eadba4b3f64f8b1a35fea5), [#​9994](https://togithub.com/phpstan/phpstan/issues/9994) - Fix subclass acceptability when class alias is involved on "ours" side (https://github.com/phpstan/phpstan-src/commit/d5c599c962cadc13acb206b932a8e3a74fc46025), [#​10023](https://togithub.com/phpstan/phpstan/issues/10023) # Function signature fixes 🤖 - Fix incorrect doc for `SQLite3::openBlob` ([#​2668](https://togithub.com/phpstan/phpstan-src/pull/2668)), thanks [@​rodrigoq](https://togithub.com/rodrigoq)! - Update `number_format` return from `string` to `non-empty-string` ([#​2678](https://togithub.com/phpstan/phpstan-src/pull/2678)), thanks [@​devnix](https://togithub.com/devnix)! ### [`v1.10.38`](https://togithub.com/phpstan/phpstan/releases/tag/1.10.38) [Compare Source](https://togithub.com/phpstan/phpstan/compare/1.10.37...1.10.38) # Improvements 🔧 - Remove function signatures that were removed in PHP 8.0 ([#​2662](https://togithub.com/phpstan/phpstan-src/pull/2662)), [#​9954](https://togithub.com/phpstan/phpstan/issues/9954), thanks [@​Th3Cod3](https://togithub.com/Th3Cod3)! # Bugfixes 🐛 - Update BetterReflection - Fix for non-backed enums (https://github.com/ondrejmirtes/BetterReflection/commit/4dd0f2bb17810ab0ee8f2a77c63d6b02f7b6d0d4) - Do not invalidate types passed by value (https://github.com/phpstan/phpstan-src/commit/0b8dca74e5345244a955535b54e9874beae76713), [https://github.com/phpstan/phpstan/discussions/9927](https://togithub.com/phpstan/phpstan/discussions/9927) - Do not influence types of arguments before the function is called (https://github.com/phpstan/phpstan-src/commit/c45d42dd1d031016668099957d2b77706f208d67) - Fixed collapsing of constant arrays (https://github.com/phpstan/phpstan-src/commit/746de74c5cdd339c9020cfb03784fb39229ed86a), [#​9985](https://togithub.com/phpstan/phpstan/issues/9985) # Internals 🔍 - Lazier type-resolving in `isset` checks ([#​2664](https://togithub.com/phpstan/phpstan-src/pull/2664)), thanks [@​staabm](https://togithub.com/staabm)! - Refactor to invalidate args inside `processArgs` (https://github.com/phpstan/phpstan-src/commit/52eb6f8e5f19a41b8a00ca331ba67c7cba8aa952) - Merge array types a bit later (https://github.com/phpstan/phpstan-src/commit/adbc35a1c72585df4586131f8e99b882bb64677d) ### [`v1.10.37`](https://togithub.com/phpstan/phpstan/releases/tag/1.10.37) [Compare Source](https://togithub.com/phpstan/phpstan/compare/1.10.36...1.10.37) # Bugfixes 🐛 - Support array shape covariance when the optional key is missing in the subtype ([#​2655](https://togithub.com/phpstan/phpstan-src/pull/2655)), [#​9905](https://togithub.com/phpstan/phpstan/issues/9905), [#​5655](https://togithub.com/phpstan/phpstan/issues/5655), [#​7273](https://togithub.com/phpstan/phpstan/issues/7273), thanks [@​staabm](https://togithub.com/staabm)! - Fix conditional types ([#​2659](https://togithub.com/phpstan/phpstan-src/pull/2659)), [#​9951](https://togithub.com/phpstan/phpstan/issues/9951), [#​9963](https://togithub.com/phpstan/phpstan/issues/9963), thanks [@​rvanvelzen](https://togithub.com/rvanvelzen)! - Handle exception thrown from callable object's `__invoke` method ([#​2502](https://togithub.com/phpstan/phpstan-src/pull/2502)), [#​6233](https://togithub.com/phpstan/phpstan/issues/6233), thanks [@​VincentLanglet](https://togithub.com/VincentLanglet)! - Update BetterReflection - ReflectionSourceStubber - fix enum as default function parameter value (https://github.com/ondrejmirtes/BetterReflection/commit/135a394e2fba447a788ac3a36818e4cde8b87ac4), [https://github.com/nunomaduro/larastan/issues/1749](https://togithub.com/nunomaduro/larastan/issues/1749) ### [`v1.10.36`](https://togithub.com/phpstan/phpstan/releases/tag/1.10.36) [Compare Source](https://togithub.com/phpstan/phpstan/compare/1.10.35...1.10.36) # Improvements 🔧 - DumpParametersCommand: `--json` option (https://github.com/phpstan/phpstan-src/commit/91a0002402123b96a08978ba400b5d76d5456693) - Implement `reportUncheckedExceptionDeadCatch` option (defaults to `true`) ([#​2648](https://togithub.com/phpstan/phpstan-src/pull/2648)), [#​9921](https://togithub.com/phpstan/phpstan/issues/9921), thanks [@​VincentLanglet](https://togithub.com/VincentLanglet)! - Support union types in `array_chunk()` ([#​2635](https://togithub.com/phpstan/phpstan-src/pull/2635)), thanks [@​staabm](https://togithub.com/staabm)! - Result cache: Indicate key differences in cache metadata ([#​2630](https://togithub.com/phpstan/phpstan-src/pull/2630)), thanks [@​staabm](https://togithub.com/staabm)! - Get rid of annoying "on an unknown class ReflectionEnum" error on PHP < 8.0 (https://github.com/phpstan/phpstan-src/commit/2b9af363a3d2a9620c4b9bfb65e81813b69623d0) # Bugfixes 🐛 - Fix resolving nested conditional types with union subjects ([#​2641](https://togithub.com/phpstan/phpstan-src/pull/2641)), [#​9860](https://togithub.com/phpstan/phpstan/issues/9860), thanks [@​rvanvelzen](https://togithub.com/rvanvelzen)! - Detect array_rand second parameter ([#​2633](https://togithub.com/phpstan/phpstan-src/pull/2633)), [#​9803](https://togithub.com/phpstan/phpstan/issues/9803), thanks [@​staabm](https://togithub.com/staabm)! - Fix subtracting types from union template types ([#​2652](https://togithub.com/phpstan/phpstan-src/pull/2652)), [#​9939](https://togithub.com/phpstan/phpstan/issues/9939), thanks [@​rvanvelzen](https://togithub.com/rvanvelzen)! - fix infinite cycle due to incorrect implements/extends ([#​2483](https://togithub.com/phpstan/phpstan-src/pull/2483)), thanks [@​schlndh](https://togithub.com/schlndh)! - Fix ConstantFloatType value dump precision ([#​2358](https://togithub.com/phpstan/phpstan-src/pull/2358)), thanks [@​mvorisek](https://togithub.com/mvorisek)! - Do not trigger PhpDocInheritanceResolver if we do not need the PHPDoc type when resolving the type of ClassConstFetch ([#​2414](https://togithub.com/phpstan/phpstan-src/pull/2414)), [#​9039](https://togithub.com/phpstan/phpstan/issues/9039), thanks [@​VincentLanglet](https://togithub.com/VincentLanglet)! # Function signature fixes 🤖 - `connection_*` functions are impure ([#​2555](https://togithub.com/phpstan/phpstan-src/pull/2555)), thanks [@​staabm](https://togithub.com/staabm)! - Add stubs for `mysqli` and `mysqli_result` classes ([#​2295](https://togithub.com/phpstan/phpstan-src/pull/2295)), thanks [@​phansys](https://togithub.com/phansys)! # Internals 🔍 - E2E test about env variables in config parameters (https://github.com/phpstan/phpstan-src/commit/980ab5bba4de0246587647e8cf6b7abe95697379) - Prevent unnecessary calls to `getFiniteTypes()` ([#​2636](https://togithub.com/phpstan/phpstan-src/pull/2636)), thanks [@​staabm](https://togithub.com/staabm)! - Remove unnecessary IO ([#​2613](https://togithub.com/phpstan/phpstan-src/pull/2613)), thanks [@​staabm](https://togithub.com/staabm)! - Restrict "Merge maintained branch" workflow to the main repository ([#​2654](https://togithub.com/phpstan/phpstan-src/pull/2654)), thanks [@​thg2k](https://togithub.com/thg2k)! ### [`v1.10.35`](https://togithub.com/phpstan/phpstan/releases/tag/1.10.35) [Compare Source](https://togithub.com/phpstan/phpstan/compare/1.10.34...1.10.35) # Major new features 🚀 - Generics: **Type projections aka call-site variance** ([#​2485](https://togithub.com/phpstan/phpstan-src/pull/2485)), thanks [@​jiripudil](https://togithub.com/jiripudil)! - Learn more: https://phpstan.org/blog/guide-to-call-site-generic-variance # Bugfixes 🐛 - Make `value-of<...>` lazier (https://github.com/phpstan/phpstan-src/commit/234f77d652bf6326be4bf5c25c7aab67145aca71), [#​9881](https://togithub.com/phpstan/phpstan/issues/9881) - Update BetterReflection, [#​9877](https://togithub.com/phpstan/phpstan/issues/9877) - Fix `ReflectionAttribute::newInstance()` with nested class using named arguments (https://github.com/ondrejmirtes/BetterReflection/commit/8d751dd38f4d089715e748863d0d8e4113bc408c), thanks [@​enumag](https://togithub.com/enumag)! - Improve typing of filters that do not accept non-falsy strings ([#​2620](https://togithub.com/phpstan/phpstan-src/pull/2620)), thanks [@​zonuexe](https://togithub.com/zonuexe)! # Internals 🔍 - name-collision-detector 2.0 (https://github.com/phpstan/phpstan-src/commit/c3cb573c595bf5cc72471fd8d773aa3b0296b035) - Remove `phpstan/phpstan-php-parser` ([#​2632](https://togithub.com/phpstan/phpstan-src/pull/2632)), thanks [@​staabm](https://togithub.com/staabm)! ### [`v1.10.34`](https://togithub.com/phpstan/phpstan/releases/tag/1.10.34) [Compare Source](https://togithub.com/phpstan/phpstan/compare/1.10.33...1.10.34) # Improvements 🔧 - Add support and tests for `$this` type assertions ([#​2609](https://togithub.com/phpstan/phpstan-src/pull/2609)), [#​8904](https://togithub.com/phpstan/phpstan/issues/8904), thanks [@​ekisu](https://togithub.com/ekisu)! - Update [phpstan/phpdoc-parser to 1.24.0](https://togithub.com/phpstan/phpdoc-parser/releases/tag/1.24.0) - Allow asserting the type of `$this` ([https://github.com/phpstan/phpdoc-parser/pull/209](https://togithub.com/phpstan/phpdoc-parser/pull/209)), thanks [@​ekisu](https://togithub.com/ekisu)! - Avoid creating an Exception when it is not necessary ([https://github.com/phpstan/phpdoc-parser/pull/208](https://togithub.com/phpstan/phpdoc-parser/pull/208)), thanks [@​mad-briller](https://togithub.com/mad-briller)! - Added `--fail-without-result-cache` CLI option ([#​2611](https://togithub.com/phpstan/phpstan-src/pull/2611)), thanks [@​staabm](https://togithub.com/staabm)! - Make result cache independent from configs include order ([#​2606](https://togithub.com/phpstan/phpstan-src/pull/2606)), thanks [@​staabm](https://togithub.com/staabm)! - Reduce unnecessary calls into reflection ([#​2614](https://togithub.com/phpstan/phpstan-src/pull/2614)), thanks [@​staabm](https://togithub.com/staabm)! - Micro-optimize with `in_array()` ([#​2618](https://togithub.com/phpstan/phpstan-src/pull/2618)), thanks [@​zonuexe](https://togithub.com/zonuexe)! - Cover ArgumentsNormalizer with BC promise (https://github.com/phpstan/phpstan-src/commit/b87db6233f08414e176f02ba2dcf08414cb1d83d) - LastConditionVisitor: condition followed by throw is marked as last ([#​2405](https://togithub.com/phpstan/phpstan-src/pull/2405)), thanks [@​JanTvrdik](https://togithub.com/JanTvrdik)! # Function signature fixes 🤖 - fix incorrect doc for `inotify_read` ([#​2605](https://togithub.com/phpstan/phpstan-src/pull/2605)), thanks [@​taka-oyama](https://togithub.com/taka-oyama)! # Internals 🔍 - name-collision-detector (https://github.com/phpstan/phpstan-src/commit/95cdbe577513286c36dcf513fe76f269e8a32125) ### [`v1.10.33`](https://togithub.com/phpstan/phpstan/releases/tag/1.10.33) [Compare Source](https://togithub.com/phpstan/phpstan/compare/1.10.32...1.10.33) # Improvements 🔧 - Support for referencing environment variables in the config ([#​2559](https://togithub.com/phpstan/phpstan-src/pull/2559)), [#​1918](https://togithub.com/phpstan/phpstan/issues/1918) - Made parent class reflection resolving lazier ([#​2584](https://togithub.com/phpstan/phpstan-src/pull/2584)), thanks [@​staabm](https://togithub.com/staabm)! - FileTypeMapper - optimization of type aliases (https://github.com/phpstan/phpstan-src/commit/2be81ac1cffa02da2bd0e3b52961cd3d528f2325) - Use NonAcceptingNeverType in more places (https://github.com/phpstan/phpstan-src/commit/3e03e9d7c15fdf64e6d55539a6c3045b3b8c6604) - MethodCall: mark virtual nullsafe call with attribute ([#​2598](https://togithub.com/phpstan/phpstan-src/pull/2598)), [#​9830](https://togithub.com/phpstan/phpstan/issues/9830), thanks [@​janedbal](https://togithub.com/janedbal)! # Bugfixes 🐛 - Fix `checkBenevolentUnionTypes: true` along with `@template` with `array-key` bound ([#​2587](https://togithub.com/phpstan/phpstan-src/pull/2587)), [#​9766](https://togithub.com/phpstan/phpstan/issues/9766), thanks [@​VincentLanglet](https://togithub.com/VincentLanglet)! - Fix type inference of `array_sum()` ([#​2591](https://togithub.com/phpstan/phpstan-src/pull/2591)), [#​9808](https://togithub.com/phpstan/phpstan/issues/9808), thanks [@​zer0-star](https://togithub.com/zer0-star)! - Update Symfony polyfills (https://github.com/phpstan/phpstan-src/commit/dfcaa3082c975b13847ff9de5e55438ce7b65fc4), [#​8538](https://togithub.com/phpstan/phpstan/issues/8538) # Function signature fixes 🤖 - More precise `inotify` related function signatures ([#​2599](https://togithub.com/phpstan/phpstan-src/pull/2599)), thanks [@​thg2k](https://togithub.com/thg2k)! # Internals 🔍 - Prevent most `$parentPhpDocBlock->getClassReflection()->isBuiltin()` calls ([#​2585](https://togithub.com/phpstan/phpstan-src/pull/2585)), thanks [@​staabm](https://togithub.com/staabm)! - micro: use `spl_object_id()` ([#​2592](https://togithub.com/phpstan/phpstan-src/pull/2592)), thanks [@​staabm](https://togithub.com/staabm)! - Update `nette/di` ([#​2597](https://togithub.com/phpstan/phpstan-src/pull/2597)) ### [`v1.10.32`](https://togithub.com/phpstan/phpstan/releases/tag/1.10.32) [Compare Source](https://togithub.com/phpstan/phpstan/compare/1.10.31...1.10.32) # Improvements 🔧 - Optimize FileTypeMapper for huge PHPDocs ([#​2582](https://togithub.com/phpstan/phpstan-src/pull/2582)), [#​9498](https://togithub.com/phpstan/phpstan/issues/9498) - This fixes performance issue for projects that use Carbon (`nesbot/carbon`) - Optimize DumpParametersCommand (https://github.com/phpstan/phpstan-src/commit/379008a6a632e6e657ad920147a87772c41438e1) ### [`v1.10.31`](https://togithub.com/phpstan/phpstan/releases/tag/1.10.31) [Compare Source](https://togithub.com/phpstan/phpstan/compare/1.10.30...1.10.31) # Improvements 🔧 - Cache OptimizedDirectorySourceLocator data for faster subsequent runs and less work needed by child processes (https://github.com/phpstan/phpstan-src/commit/b66210f114f695a23d62f884615874cf5f7c6bab) - `NonAcceptingNeverType` ([#​2540](https://togithub.com/phpstan/phpstan-src/pull/2540)), [#​9133](https://togithub.com/phpstan/phpstan/issues/9133), [#​6485](https://togithub.com/phpstan/phpstan/issues/6485), thanks [@​jiripudil](https://togithub.com/jiripudil)! - ClearResultCacheCommand - `--xdebug` option (https://github.com/phpstan/phpstan-src/commit/3befb53be3acb9c6807d1ac0834eafb399762440) # Internals 🔍 - Do not pass a fake path to analyse in ClearResultCacheCommand; check paths count later when asking for files (https://github.com/phpstan/phpstan-src/commit/4e37a2d78baed28974f140775bcc7f5cba62cf6b) - FileCacheStorage - reference cache key in a comment (https://github.com/phpstan/phpstan-src/commit/0fbf0eed7ba63bdae6a8ce7ef33a96bd12236b45) ### [`v1.10.30`](https://togithub.com/phpstan/phpstan/releases/tag/1.10.30) [Compare Source](https://togithub.com/phpstan/phpstan/compare/1.10.29...1.10.30) # Improvements 🔧 - NotAnalysedTraitRule - do not report for analysis of files-only paths (https://github.com/phpstan/phpstan-src/commit/5f59d58b62ba130aaeedd7d804f3d0bb2b19e4fd) # Bugfixes 🐛 - Fix several issues with nullsafe type specification ([#​2577](https://togithub.com/phpstan/phpstan-src/pull/2577)), [#​9105](https://togithub.com/phpstan/phpstan/issues/9105), [#​5172](https://togithub.com/phpstan/phpstan/issues/5172), [#​8517](https://togithub.com/phpstan/phpstan/issues/8517), [#​7980](https://togithub.com/phpstan/phpstan/issues/7980), [#​8664](https://togithub.com/phpstan/phpstan/issues/8664), [#​9293](https://togithub.com/phpstan/phpstan/issues/9293), thanks [@​schlndh](https://togithub.com/schlndh)! - Do not report unused class elements if the element is used on an uncertain type like `mixed` (https://github.com/phpstan/phpstan-src/commit/cbdb30d596d44cd00361989df72cb15f33f26109), [#​9765](https://togithub.com/phpstan/phpstan/issues/9765) - ConditionalTagsExtension: add missing tags ([#​2574](https://togithub.com/phpstan/phpstan-src/pull/2574)), thanks [@​janedbal](https://togithub.com/janedbal)! - CleaningVisitor - keep closures and arrow functions (https://github.com/phpstan/phpstan-src/commit/0501aaf259f16cd1bd27e2a6ec2d8b1de5af5edf), [#​9776](https://togithub.com/phpstan/phpstan/issues/9776) - Fix baseline for access to uninitialized property from trait ([#​2568](https://togithub.com/phpstan/phpstan-src/pull/2568)), thanks [@​schlndh](https://togithub.com/schlndh)! - Fix generalizing types in loops (https://github.com/phpstan/phpstan-src/commit/c09be9ec0e8ca6b448da52ee5320417bc692adf9), [#​9753](https://togithub.com/phpstan/phpstan/issues/9753) - Fix foreach scope when iterating non-array and `polluteScopeWithAlwaysIterableForeach` is `true` (https://github.com/phpstan/phpstan-src/commit/853a1e693eb18b9c1eef87f264c90b4d446db710), [#​9784](https://togithub.com/phpstan/phpstan/issues/9784) # Internals 🔍 - Issue bot - special NotAnalysedTraitRule that runs even with `onlyFiles=true` (https://github.com/phpstan/phpstan-src/commit/6c941aecbfd47dd09315d995821eb904288f04c1) - Ability to disable `implicitThrows` in tests ([#​2576](https://togithub.com/phpstan/phpstan-src/pull/2576)), thanks [@​janedbal](https://togithub.com/janedbal)! - Rename duplicate symbols (https://github.com/phpstan/phpstan-src/commit/21717178796e2081d3c4275e6cc54821cfcdcba6) ### [`v1.10.29`](https://togithub.com/phpstan/phpstan/releases/tag/1.10.29) [Compare Source](https://togithub.com/phpstan/phpstan/compare/1.10.28...1.10.29) # Improvements 🔧 - Update nikic/php-parser to v4.17.1 - PHP 8.3 features are no longer parse errors. Full-fledged PHP 8.3 support is coming later this year. - Update BetterReflection to 6.12.0 # Bugfixes 🐛 - PHPStan Pro - when launching, `PHP_BINARY` needs to be escaped (https://github.com/phpstan/phpstan-src/commit/2c7cfd8b82beb355c1125524049cf6d16495e067) # Function signature fixes 🤖 - Fix FTP-related function signatures ([#​2551](https://togithub.com/phpstan/phpstan-src/pull/2551)), thanks [@​thg2k](https://togithub.com/thg2k)! ### [`v1.10.28`](https://togithub.com/phpstan/phpstan/releases/tag/1.10.28) [Compare Source](https://togithub.com/phpstan/phpstan/compare/1.10.27...1.10.28) # Improvements 🔧 - Update BetterReflection to 6.12.0 (https://github.com/phpstan/phpstan-src/commit/7c49c944c7a40a2065f27d2ba94eb90f0f2fc22d) # Bugfixes 🐛 - Nullsafe operator on `null` results in `null` (https://github.com/phpstan/phpstan-src/commit/5c40c853ff91d518dea2afee9449ef58d8479314), [#​9721](https://togithub.com/phpstan/phpstan/issues/9721) - Properties set in the native constructor are initialized in additional constructors (https://github.com/phpstan/phpstan-src/commit/1b0c6a0166e6e5199407377d124cfe5cdac74b87), [#​9619](https://togithub.com/phpstan/phpstan/issues/9619) - Fix performance problem with nested BooleanOr and BooleanAnd (https://github.com/phpstan/phpstan-src/commit/9adae6c4f8c4797c8e60353430ba9a66dc897bb7), [#​9690](https://togithub.com/phpstan/phpstan/issues/9690), [#​9676](https://togithub.com/phpstan/phpstan/issues/9676) - CallableTypeHelper - copy variadic parameters if the accepting closure has more parameters (https://github.com/phpstan/phpstan-src/commit/31ed326fb113238df762bf9237da50e4613bde32), [#​9699](https://togithub.com/phpstan/phpstan/issues/9699) # Internals 🔍 - Simplify access to ClassReflection in ClassPropertyNode ([#​2565](https://togithub.com/phpstan/phpstan-src/pull/2565)), thanks [@​mad-briller](https://togithub.com/mad-briller)! ### [`v1.10.27`](https://togithub.com/phpstan/phpstan/releases/tag/1.10.27) [Compare Source](https://togithub.com/phpstan/phpstan/compare/1.10.26...1.10.27) # Bleeding edge 🔪 - More precise `stream_socket_client()` signature ([#​2519](https://togithub.com/phpstan/phpstan-src/pull/2519)), thanks [@​staabm](https://togithub.com/staabm)! - More precise `scandir()` signature ([#​2518](https://togithub.com/phpstan/phpstan-src/pull/2518)), thanks [@​staabm](https://togithub.com/staabm)! - More precise `extract()` signature ([#​2517](https://togithub.com/phpstan/phpstan-src/pull/2517)), thanks [@​staabm](https://togithub.com/staabm)! *If you want to see the shape of things to come and adopt bleeding edge features early, you can include this config file in your project's `phpstan.neon`:* includes: - vendor/phpstan/phpstan/conf/bleedingEdge.neon *Of course, there are no backwards compatibility guarantees when you include this file. The behaviour and reported errors can change in minor versions with this file included. [Learn more](https://phpstan.org/blog/what-is-bleeding-edge)* # Improvements 🔧 - Report trait access to unititialized property in the trait instead of class ([#​2531](https://togithub.com/phpstan/phpstan-src/pull/2531)), thanks [@​schlndh](https://togithub.com/schlndh)! - Type projections, part 2: enforce elementary rules ([#​2481](https://togithub.com/phpstan/phpstan-src/pull/2481)), thanks [@​jiripudil](https://togithub.com/jiripudil)! - Unify ignoring lines in traits with parser tokens (https://github.com/phpstan/phpstan-src/commit/01294d86b811444b72d7c67c5e75f115daddbd13), [#​6175](https://togithub.com/phpstan/phpstan/issues/6175) # Bugfixes 🐛 - Fix json method exception ([#​2524](https://togithub.com/phpstan/phpstan-src/pull/2524)), [#​9568](https://togithub.com/phpstan/phpstan/issues/9568), thanks [@​VincentLanglet](https://togithub.com/VincentLanglet)! - Support of printf with dynamic width ([#​2543](https://togithub.com/phpstan/phpstan-src/pull/2543)), [#​9674](https://togithub.com/phpstan/phpstan/issues/9674), thanks [@​kukulich](https://togithub.com/kukulich)! - Support of printf with dynamic precision (and improved support of dynamic width) ([#​2544](https://togithub.com/phpstan/phpstan-src/pull/2544)), [#​9677](https://togithub.com/phpstan/phpstan/issues/9677), thanks [@​kukulich](https://togithub.com/kukulich)! - Fix types for conditional parameters after checks ([#​2548](https://togithub.com/phpstan/phpstan-src/pull/2548)), [#​7915](https://togithub.com/phpstan/phpstan/issues/7915), thanks [@​rvanvelzen](https://togithub.com/rvanvelzen)! - Prevent `Call to end() on null` (https://github.com/phpstan/phpstan-src/commit/a5e5719bcbe3385f2bac77704e7da850da766a01), [#​9722](https://togithub.com/phpstan/phpstan/issues/9722) - Fix internal error in SimpleXMLElementConstructorThrowTypeExtension ([#​2561](https://togithub.com/phpstan/phpstan-src/pull/2561)), [#​9716](https://togithub.com/phpstan/phpstan/issues/9716), thanks [@​staabm](https://togithub.com/staabm)! - Method extensions class name is case-insensitive ([#​2562](https://togithub.com/phpstan/phpstan-src/pull/2562)), [#​9716](https://togithub.com/phpstan/phpstan/issues/9716), thanks [@​staabm](https://togithub.com/staabm)! - InArrayFunctionTypeSpecifyingExtension - fix calls with less than 2 parameters (https://github.com/phpstan/phpstan-src/commit/4d77e98e151599d12fd828df969929ed419a0924), [#​9711](https://togithub.com/phpstan/phpstan/issues/9711) # Function signature fixes 🤖 - `uopz_flags` - flags are optional (https://github.com/phpstan/phpstan-src/commit/917750efd8550446492e91ca3069179416fa80f1), [#​9611](https://togithub.com/phpstan/phpstan/issues/9611) - Add `base64_decode` overloads to PHP 8+ ([#​2529](https://togithub.com/phpstan/phpstan-src/pull/2529)), [#​9428](https://togithub.com/phpstan/phpstan/issues/9428), thanks [@​dktapps](https://togithub.com/dktapps)! - Mark few Ds methods as impure ([#​2550](https://togithub.com/phpstan/phpstan-src/pull/2550)), thanks [@​simPod](https://togithub.com/simPod)! # Internals 🔍 - Avoid doing work before its necessary in mutating scope. ([#​2537](https://togithub.com/phpstan/phpstan-src/pull/2537)), thanks [@​mad-briller](https://togithub.com/mad-briller)! - Changed `linesToIgnore` attribute format (https://github.com/phpstan/phpstan-src/commit/2862a7bf7927a7e76771b71f43206d01dfc5d6ef) - Prevent unnecessary work in MutatingScope ([#​2554](https://togithub.com/phpstan/phpstan-src/pull/2554)), thanks [@​staabm](https://togithub.com/staabm)! - Validate parameters with parametersSchema each time after container creation ([#​2558](https://togithub.com/phpstan/phpstan-src/pull/2558)) ### [`v1.10.26`](https://togithub.com/phpstan/phpstan/releases/tag/1.10.26) [Compare Source](https://togithub.com/phpstan/phpstan/compare/1.10.25...1.10.26) # Improvements 🔧 - More precise return type for trigger_error ([#​2526](https://togithub.com/phpstan/phpstan-src/pull/2526)), thanks [@​paulbalandan](https://togithub.com/paulbalandan)! # Bugfixes 🐛 - Fix filtering default stub files on Windows ([#​2406](https://togithub.com/phpstan/phpstan-src/pull/2406)), thanks [@​maryo](https://togithub.com/maryo)! - FileHelper absolutize and normalize: Fix path with scheme ([#​2506](https://togithub.com/phpstan/phpstan-src/pull/2506)), thanks [@​mvorisek](https://togithub.com/mvorisek)! - Fix `array_keys()` and \`array_values()\`\` on constant arrays ([#​2516](https://togithub.com/phpstan/phpstan-src/pull/2516)), thanks [@​jlherren](https://togithub.com/jlherren)! - Fix access to uninitialized property via extension in additional constructor (https://github.com/phpstan/phpstan-src/commit/218aad0804bebd8f0ad60eea69afb24d8fa4ca48), [#​9619](https://togithub.com/phpstan/phpstan/issues/9619) - Fix result cache bug with imported type aliases (https://github.com/phpstan/phpstan-src/commit/553c4b141b62244f629b22fe7e8054196cd73a58), [#​9622](https://togithub.com/phpstan/phpstan/issues/9622) - Fix result cache bug with imported type aliases in a trait (https://github.com/phpstan/phpstan-src/commit/d8071d0904e4b06a814a0b8b8d7f343d72db0633) - Fix PHP 8.3 deprecation (`$foo--` with a non-numeric string no longer allowed) (https://github.com/phpstan/phpstan-src/commit/c6f4c4ceb7d7355ef761a6ffaa1b1574469789c6) - Array shape with optional keys might be a list (https://github.com/phpstan/phpstan-src/commit/97f0039fe568eec83607861c36718e8f79c481ff) - ArrayMapFunctionReturnTypeExtension - preserve array being a list (https://github.com/phpstan/phpstan-src/commit/d55c4f2c207a6a07712cff2cdaba670fee950258) # Function signature fixes 🤖 - More precise `ftp_*` mode parameter type ([#​2513](https://togithub.com/phpstan/phpstan-src/pull/2513)), thanks [@​staabm](https://togithub.com/staabm)! - Fix signature of `DOMNode::lookupNamespaceURI` ([#​2527](https://togithub.com/phpstan/phpstan-src/pull/2527)), thanks [@​paulbalandan](https://togithub.com/paulbalandan)! # Internals 🔍 - Simplify access to class reflections in InClassNode rules ([#​2514](https://togithub.com/phpstan/phpstan-src/pull/2514)), thanks [@​mad-briller](https://togithub.com/mad-briller)! - Simplify access to class reflections in ClassPropertiesNode ([#​2520](https://togithub.com/phpstan/phpstan-src/pull/2520)), thanks [@​mad-briller](https://togithub.com/mad-briller)! - Simplify access to function reflection in FunctionReturnStatementsNode rules ([#​2522](https://togithub.com/phpstan/phpstan-src/pull/2522)), thanks [@​mad-briller](https://togithub.com/mad-briller)! - Set class and method reflection in the MethodReturnStatementNode ([#​2515](https://togithub.com/phpstan/phpstan-src/pull/2515)), thanks [@​mad-briller](https://togithub.com/mad-briller)! - Simplify access to class reflections in ClassConstantsNode and ClassMethodsNode rules ([#​2521](https://togithub.com/phpstan/phpstan-src/pull/2521)), thanks [@​mad-briller](https://togithub.com/mad-briller)! - Introduce InTraitNode (https://github.com/phpstan/phpstan-src/commit/657fc54b7d358622b791828f94a6a6d9d0f8207c) - TrinaryLogic for `isList` in ConstantArrayType (https://github.com/phpstan/phpstan-src/commit/158c61c6777acb416fb5ff243916c1483b0f220a, https://github.com/phpstan/phpstan-src/commit/f0a9fd796e1b1d023affdb7fb4ffd344d79becd4) - Add polyfill for PHP 8.1 (https://github.com/phpstan/phpstan-src/commit/a8818be2f31d2bc33ac6ccb3c3f221248e70a514, https://github.com/phpstan/phpstan-src/commit/cda7e69587a3d46afe098bf7657af364f3980356) ### [`v1.10.25`](https://togithub.com/phpstan/phpstan/releases/tag/1.10.25) [Compare Source](https://togithub.com/phpstan/phpstan/compare/1.10.24...1.10.25) # Improvements 🔧 - Understand that promoted property can come from renamed trait constructor (https://github.com/phpstan/phpstan-src/commit/eafba2e09164846a010dc29e65bbc49c814941ae) - Understand that methods called from constructor throwing exception cannot leave object in an uninitializad state (https://github.com/phpstan/phpstan-src/commit/f4d060b6888c8ef4469e99becfd23eb64c40da89) # Bugfixes 🐛 - Allow promoted properties in trait `__construct` even when renamed (https://github.com/phpstan/phpstan-src/commit/4dd3f753b1438c30e9ee882a3f2b4632b1a8cecc), [#​9577](https://togithub.com/phpstan/phpstan/issues/9577) - IllegalConstructorStaticCallRule - fix for renamed trait constructor (https://github.com/phpstan/phpstan-src/commit/65330d3be77c4c7e28a2eb51b19850f8895c147a), [#​9577](https://togithub.com/phpstan/phpstan/issues/9577) ### [`v1.10.24`](https://togithub.com/phpstan/phpstan/releases/tag/1.10.24) [Compare Source](https://togithub.com/phpstan/phpstan/compare/1.10.23...1.10.24) # Improvements 🔧 - Evaluate uninitialized properties based on each execution end in constructor (https://github.com/phpstan/phpstan-src/commit/b2d2a9d08df092e78fa0cd652e158e13f2e63a7d), [#​7649](https://togithub.com/phpstan/phpstan/issues/7649) - ConstructorReturnTypeRule (https://github.com/phpstan/phpstan-src/commit/2ebbb5303aad6b757c65ca6f12cafebed79bed83) # Bugfixes 🐛 - Fix `processCalledMethod` when anonymous classes are involved (https://github.com/phpstan/phpstan-src/commit/3f5277975a4c625b0fd6a29ea256a672d0bb77fa) - Do not require return type for renamed trait constructor (https://github.com/phpstan/phpstan-src/commit/f6ca9c88d66af8d272e4baec19dbd63a0ec54a5f), [#​9571](https://togithub.com/phpstan/phpstan/issues/9571) - FileTypeMapper - fix PHPDocs for renamed trait methods (https://github.com/phpstan/phpstan-src/commit/0bd48b4ae0f397de435ba657f7a36284d90ef2dd), [#​9571](https://togithub.com/phpstan/phpstan/issues/9571), [#​6856](https://togithub.com/phpstan/phpstan/issues/6856) - Register `json_validate` stub only on PHP 8.3+ (https://github.com/phpstan/phpstan-src/commit/8f8c1af790395a07eb46016ec20f20485bc42c66), [#​9574](https://togithub.com/phpstan/phpstan/issues/9574) # Function signature fixes 🤖 - More precise `session_status()` return type ([#​2509](https://togithub.com/phpstan/phpstan-src/pull/2509)), thanks [@​staabm](https://togithub.com/staabm)! ### [`v1.10.23`](https://togithub.com/phpstan/phpstan/releases/tag/1.10.23) [Compare Source](https://togithub.com/phpstan/phpstan/compare/1.10.22...1.10.23) # Improvements 🔧 - Fix false positives and false negatives about uninitialized properties (https://github.com/phpstan/phpstan-src/commit/348debc5c3b38c5f40448bae63d76cc99a6baea8), [#​7198](https://togithub.com/phpstan/phpstan/issues/7198) - This leads to uninitialized properties being detected in more places - Lazy initialization of `AnalyserResult::$errors` ([#​2400](https://togithub.com/phpstan/phpstan-src/pull/2400)), thanks [@​takaram](https://togithub.com/takaram)! - Check additional assign of promoted readonly property (https://github.com/phpstan/phpstan-src/commit/8fe4401489c58da040889ed18bffda10ba89f05c) # Bugfixes 🐛 - Fix readonly property assigned in if-else (https://github.com/phpstan/phpstan-src/commit/ce3c1641926e8abf7ce6dca055717e1657deb792), [#​6402](https://togithub.com/phpstan/phpstan/issues/6402) - Fix ConstantArrayTypeBuilder's isList flag ([#​2408](https://togithub.com/phpstan/phpstan-src/pull/2408)), thanks [@​jlherren](https://togithub.com/jlherren)! - TypeSpecifier - handle AlwaysRememberedExpr in handling Identical (https://github.com/phpstan/phpstan-src/commit/a769a1c90c7d9b051e42225104dbc3c83768a553), [#​9499](https://togithub.com/phpstan/phpstan/issues/9499) - Fix processing traits with renamed methods (https://github.com/phpstan/phpstan-src/commit/c6035f3ca1511332c9fec762135a24f5963dee06), [#​7198](https://togithub.com/phpstan/phpstan/issues/7198), [#​6039](https://togithub.com/phpstan/phpstan/issues/6039), [#​4758](https://togithub.com/phpstan/phpstan/issues/4758) # Function signature fixes 🤖 - Allow `null` in `mysqli*real_connect` arguments ([#​2508](https://togithub.com/phpstan/phpstan-src/pull/2508)), thanks [@​staabm](https://togithub.com/staabm)! # Internals 🔍 - Cheap checks first in IgnoredRegexValidator ([#​2505](https://togithub.com/phpstan/phpstan-src/pull/2505)), thanks [@​mad-briller](https://togithub.com/mad-briller)! - Do not use `instanceof ThisType` as it can be unreliable in case of intersection types (https://github.com/phpstan/phpstan-src/commit/79359450f36c073fa8444a7e87c0e29867f6b4c1) ### [`v1.10.22`](https://togithub.com/phpstan/phpstan/releases/tag/1.10.22) [Compare Source](https://togithub.com/phpstan/phpstan/compare/1.10.21...1.10.22) # Bleeding edge 🔪 - More precise `file()` flags args ([#​2476](https://togithub.com/phpstan/phpstan-src/pull/2476), [#​2482](https://togithub.com/phpstan/phpstan-src/pull/2482)), thanks [@​staabm](https://togithub.com/staabm)! - Non-static methods cannot be used as static callables in PHP 8+ ([#​2420](https://togithub.com/phpstan/phpstan-src/pull/2420)), thanks [@​staabm](https://togithub.com/staabm)! - More precise `flock()` operation flags ([#​2477](https://togithub.com/phpstan/phpstan-src/pull/2477)), thanks [@​staabm](https://togithub.com/staabm)! - Rule for `call_user_func()` ([#​2479](https://togithub.com/phpstan/phpstan-src/pull/2479)), thanks [@​staabm](https://togithub.com/staabm)! *If you want to see the shape of things to come and adopt bleeding edge features early, you can include this config file in your project's `phpstan.neon`:* includes: - vendor/phpstan/phpstan/conf/bleedingEdge.neon *Of course, there are no backwards compatibility guarantees when you include this file. The behaviour and reported errors can change in minor versions with this file included. [Learn more](https://phpstan.org/blog/what-is-bleeding-edge)* # Improvements 🔧 - Add return type extension for `constant()` ([#​2474](https://togithub.com/phpstan/phpstan-src/pull/2474)), thanks [@​herndlm](https://togithub.com/herndlm)! - Dynamic `assert()` throw type extension ([#​2427](https://togithub.com/phpstan/phpstan-src/pull/2427)), thanks [@​patrickkusebauch](https://togithub.com/patrickkusebauch)! - Update nikic/PHP-Parser (https://github.com/phpstan/phpstan-src/commit/79b3034acf926b23ec3bcfed1ad36ea375f01981) - PHP 8.3: `json_validate()` stub (https://github.com/phpstan/phpstan-src/commit/828b269c0dccda404e33a5cca1ac4be1998e18ba), thanks [@​staabm](https://togithub.com/staabm)! - Implement `call_user_func()` DynamicFunctionReturnTypeExtension ([#​2479](https://togithub.com/phpstan/phpstan-src/pull/2479)), thanks [@​staabm](https://togithub.com/staabm)! # Bugfixes 🐛 - Add support for math with constant numeric string ([#​2209](https://togithub.com/phpstan/phpstan-src/pull/2209)), [#​8803](https://togithub.com/phpstan/phpstan/issues/8803), [#​8827](https://togithub.com/phpstan/phpstan/issues/8827), thanks [@​VincentLanglet](https://togithub.com/VincentLanglet)! - Use case insensitive matching to detect usages of private methods ([#​2484](https://togithub.com/phpstan/phpstan-src/pull/2484)), [#​8346](https://togithub.com/phpstan/phpstan/issues/8346), thanks [@​stof](https://togithub.com/stof)! - fix array_splice with non-array replacement ([#​2457](https://togithub.com/phpstan/phpstan-src/pull/2457)), thanks [@​schlndh](https://togithub.com/schlndh)! - Resolve key and value type of partially non-iterable types when entering foreach (https://github.com/phpstan/phpstan-src/commit/cb5a2b4575bee005c33fcbdc3748abc160cbda14), [#​9535](https://togithub.com/phpstan/phpstan/issues/9535), [#​4907](https://togithub.com/phpstan/phpstan/issues/4907), [#​8924](https://togithub.com/phpstan/phpstan/issues/8924), [#​5998](https://togithub.com/phpstan/phpstan/issues/5998) - Foreach can append to the array but it does not change the number of iterations (https://github.com/phpstan/phpstan-src/commit/27085c5516f6864d73e660d6e897a1466c4169a6), [#​4612](https://togithub.com/phpstan/phpstan/issues/4612) - MutatingScope - process left side of BooleanAnd and BooleanOr before getting type of the whole expression (https://github.com/phpstan/phpstan-src/commit/989dd6fab8b0bf66777e20c533c90c7841d05c3a), [#​5365](https://togithub.com/phpstan/phpstan/issues/5365), [#​6551](https://togithub.com/phpstan/phpstan/issues/6551), [#​7491](https://togithub.com/phpstan/phpstan/issues/7491), [#​4004](https://togithub.com/phpstan/phpstan/issues/4004), [#​2499](https://togithub.com/phpstan/phpstan/issues/2499) - MutatingScope - process ternary cond before getting type of the whole expression (https://github.com/phpstan/phpstan-src/commit/faba80560516dc2780ff014f36171e806a7b19c2) - Fix processing switch with complex case conditions (https://github.com/phpstan/phpstan-src/commit/f6b34f2ac86d2830f53ba51601067232ea1bf6d6), [#​5326](https://togithub.com/phpstan/phpstan/issues/5326) - Fix ClassConstFetch Identical specification with Yoda conditions ([#​2498](https://togithub.com/phpstan/phpstan-src/pull/2498)), [#​9542](https://togithub.com/phpstan/phpstan/issues/9542), thanks [@​herndlm](https://togithub.com/herndlm)! # Function signature fixes 🤖 - Update functionMap for ext-mongodb 1.16 ([#​2473](https://togithub.com/phpstan/phpstan-src/pull/2473)), thanks [@​alcaeus](https://togithub.com/alcaeus)! - Add false to the `db2_num_rows()` return type ([#​2456](https://togithub.com/phpstan/phpstan-src/pull/2456)), thanks [@​morozov](https://togithub.com/morozov)! - More precise `ignore_user_abort()` return type ([#​2489](https://togithub.com/phpstan/phpstan-src/pull/2489)), thanks [@​staabm](https://togithub.com/staabm)! # Internals 🔍 - Type projections, part 1: call-site variance in GenericObjectType ([#​2471](https://togithub.com/phpstan/phpstan-src/pull/2471)), thanks [@​jiripudil](https://togithub.com/jiripudil)! - Test PHP 8.3 ([#​2486](https://togithub.com/phpstan/phpstan-src/pull/2486)) - Cleanup NodeScopeResolver ([#​2499](https://togithub.com/phpstan/phpstan-src/pull/2499)), thanks [@​staabm](https://togithub.com/staabm)! ### [`v1.10.21`](https://togithub.com/phpstan/phpstan/releases/tag/1.10.21) [Compare Source](https://togithub.com/phpstan/phpstan/compare/1.10.20...1.10.21) # Bugfixes 🐛 - Fix defining variables in match condition (https://github.com/phpstan/phpstan-src/commit/d6c2752b4edf145120d7b0ac7908828fde2289e8), [#​9474](https://togithub.com/phpstan/phpstan/issues/9474) - Fix UnusedClosureUsesRule for already traversed match (https://github.com/phpstan/phpstan-src/commit/a7194865487069a0c718227e5a39cd6eab32b8ea), [https://github.com/phpstan/phpstan-phpunit/issues/190](https://togithub.com/phpstan/phpstan-phpunit/issues/190), [#​9478](https://togithub.com/phpstan/phpstan/issues/9478) - Update BetterReflection (https://github.com/phpstan/phpstan-src/commit/a540e44a3649f722464488db3b786c5c894c1775), [#​9477](https://togithub.com/phpstan/phpstan/issues/9477) - Fix newInstance on ReflectionAttribute adapter with enum argument (https://github.com/ondrejmirtes/BetterReflection/commit/277b96077b3c15c12605d876be1b87dd1a88b6f8) # Internals 🔍 - Cheap checks first in ObjectType ([#​2475](https://togithub.com/phpstan/phpstan-src/pull/2475)), thanks [@​mad-briller](https://togithub.com/mad-briller)! ### [`v1.10.20`](https://togithub.com/phpstan/phpstan/releases/tag/1.10.20) [Compare Source](https://togithub.com/phpstan/phpstan/compare/1.10.19...1.10.20) # Improvements 🔧 - PHPStan Pro: Change Cloudflare DNS for to family version ([#​2467](https://togithub.com/phpstan/phpstan-src/pull/2467)), thanks [@​spaze](https://togithub.com/spaze)! - Add `non-zero-int` type ([#​2449](https://togithub.com/phpstan/phpstan-src/pull/2449)), thanks [@​PrinsFrank](https://togithub.com/PrinsFrank)! - Implement `gettype()` return type extension ([#​2437](https://togithub.com/phpstan/phpstan-src/pull/2437)), thanks [@​staabm](https://togithub.com/staabm)! # Bugfixes 🐛 - Allow to remember constant and impure expressions in `match` condition (https://github.com/phpstan/phpstan-src/commit/0cdda0b210a623ee299323da80771c2c84c602f9), [#​4451](https://togithub.com/phpstan/phpstan/issues/4451), [#​6064](https://togithub.com/phpstan/phpstan/issues/6064), [#​9457](https://togithub.com/phpstan/phpstan/issues/9457) - Fix `gettype` in `match` condition (https://github.com/phpstan/phpstan-src/commit/e4ef00c0573daea5e83199d182e35ea988a7d95b, https://github.com/phpstan/phpstan-src/commit/caa0a5b5247b2ff58c56b543aa3cb286b00ffde7), [#​8614](https://togithub.com/phpstan/phpstan/issues/8614) - Fix `get_class` in `match` condition (https://github.com/phpstan/phpstan-src/commit/106526db8bd64880af81faa61d9f970e793e3c38), [#​1885](https://togithub.com/phpstan/phpstan/issues/1885), [#​8536](https://togithub.com/phpstan/phpstan/issues/8536), [#​8092](https://togithub.com/phpstan/phpstan/issues/8092) - Understand `get_class` compared with `static::class` (https://github.com/phpstan/phpstan-src/commit/590eb03e0ce2b5b02562ee9bb0af803fcbb1dc95), [#​1885](https://togithub.com/phpstan/phpstan/issues/1885) - Understand `gettype` when there's a union of strings on the other side (https://github.com/phpstan/phpstan-src/commit/36e412ffed0ab6f4220c58276b06041a7a487db3), [#​6294](https://togithub.com/phpstan/phpstan/issues/6294), [#​2580](https://togithub.com/phpstan/phpstan/issues/2580) - Treat ConstantArrayType as covariant in its keys and values ([#​2464](https://togithub.com/phpstan/phpstan-src/pull/2464)), [#​9161](https://togithub.com/phpstan/phpstan/issues/9161), thanks [@​jiripudil](https://togithub.com/jiripudil)! - Treat ArrayType as covariant in its keys and values ([#​2465](https://togithub.com/phpstan/phpstan-src/pull/2465)), thanks [@​jiripudil](https://togithub.com/jiripudil)! - Make `NonEmptyArrayType::toArray()` return `$this` ([#​2349](https://togithub.com/phpstan/phpstan-src/pull/2349)), [#​9208](https://togithub.com/phpstan/phpstan/issues/9208), thanks [@​zonuexe](https://togithub.com/zonuexe)! - Retain list type via `array_push()` and `array_unshift()` ([#​2451](https://togithub.com/phpstan/phpstan-src/pull/2451)), [#​8449](https://togithub.com/phpstan/phpstan/issues/8449), thanks [@​herndlm](https://togithub.com/herndlm)! - For `@var` above throw and return, change the type of expr only for the stmt callback (https://github.com/phpstan/phpstan-src/commit/b55109537dd62ac0e352b0a55df62cfc83f12f08), [#​9459](https://togithub.com/phpstan/phpstan/issues/9459) # Internals 🔍 - Remove redundant conditions from RemoveUnusedCodeByPhpVersionIdVisitor. ([#​2459](https://togithub.com/phpstan/phpstan-src/pull/2459)), thanks [@​mad-briller](https://togithub.com/mad-briller)! - Return early in CachingVistor to avoid always-false instanceof checks. ([#​2460](https://togithub.com/phpstan/phpstan-src/pull/2460)), thanks [@​mad-briller](https://togithub.com/mad-briller)! - Introduce CombinationsHelper (https://github.com/phpstan/phpstan-src/commit/175307e12de100632a05f6a122e0873a3c1fc6a1) - `Type::getFiniteTypes()` (https://github.com/phpstan/phpstan-src/commit/7912caf4b66bdff65d3d6795d4c584c17ece5e51, https://github.com/phpstan/phpstan-src/commit/fa9a951f808466be36792ba65f128f9838ab617e, https://github.com/phpstan/phpstan-src/commit/b5cf52b916ad4d155f1809356c96cbe924f51dbe) ### [`v1.10.19`](https://togithub.com/phpstan/phpstan/releases/tag/1.10.19) [Compare Source](https://togithub.com/phpstan/phpstan/compare/1.10.18...1.10.19) # Bleeding edge 🔪 - Analysis with zero files results in non-zero exit code (https://github.com/phpstan/phpstan-src/commit/46ff440648e62617df86aa74ba905ffa99897737), [#​9410](https://togithub.com/phpstan/phpstan/issues/9410) *If you want to see the shape of things to come and adopt bleeding edge features early, you can include this config file in your project's `phpstan.neon`:* includes: - vendor/phpstan/phpstan/conf/bleedingEdge.neon *Of course, there are no backwards compatibility guarantees when you include this file. The behaviour and reported errors can change in minor versions with this file included. [Learn more](https://phpstan.org/blog/what-is-bleeding-edge)* # Improvements 🔧 - Detect invalid key in multi dimensional array fetch ([#​2445](https://togithub.com/phpstan/phpstan-src/pull/2445)), [#​6315](https://togithub.com/phpstan/phpstan/issues/6315), thanks [@​schlndh](https://togithub.com/schlndh)! - Support unions of scalars in `sprintf()` arguments (https://github.com/phpstan/phpstan-src/commit/1f955703eea90b7bdf8439ede81a5c6adda85af1) - Update nikic/php-parser (https://github.com/phpstan/phpstan-src/commit/51a284b8a8c04a06f430063f0267e168c048d88a) - Update BetterReflection (https://github.com/phpstan/phpstan-src/commit/ff8ad7e9b3933911d321846bc43f678a43b067d8) # Bugfixes 🐛 - UnusedPrivatePropertyRule - recognize static properties fetched on expr (https://github.com/phpstan/phpstan-src/commit/503978b05e412477d72bb5d846dade3c246f0f70), [#​9409](https://togithub.com/phpstan/phpstan/issues/9409), [#​8541](https://togithub.com/phpstan/phpstan/issues/8541) - Union of enum cases accepts the enum class type with negated cases ([#​2418](https://togithub.com/phpstan/phpstan-src/pull/2418)), [#​8846](https://togithub.com/phpstan/phpstan/issues/8846), thanks [@​takaram](https://togithub.com/takaram)! - Fix key type of superglobal variables ([#​2446](https://togithub.com/phpstan/phpstan-src/pull/2446)), [#​9306](https://togithub.com/phpstan/phpstan/issues/9306), thanks [@​schlndh](https://togithub.com/schlndh)! - Do not treat definition of functions and class-likes as unreachable ([#​2263](https://togithub.com/phpstan/phpstan-src/pull/2263)), [#​4002](https://togithub.com/phpstan/phpstan/issues/4002), [#​8966](https://togithub.com/phpstan/phpstan/issues/8966), [#​8319](https://togithub.com/phpstan/phpstan/issues/8319), thanks [@​takaram](https://togithub.com/takaram)! # Function signature fixes 🤖 - Allow `Redis::connect()` to have 7 parameters ([#​2442](https://togithub.com/phpstan/phpstan-src/pull/2442)), [#​9413](https://togithub.com/phpstan/phpstan/issues/9413), thanks [@​thbley](https://togithub.com/thbley)! # Internals 🔍 - StringAlwaysAcceptingObjectWithToStringType is supertype of Stringable objects (https://github.com/phpstan/phpstan-src/commit/9de9efa67facca90b5c5c97851eaf8afff310b4e) ### [`v1.10.18`](https://togithub.com/phpstan/phpstan/releases/tag/1.10.18) [Compare Source](https://togithub.com/phpstan/phpstan/compare/1.10.17...1.10.18) Implicit throw point is enough to no longer mark multi-catch as dead (https://github.com/phpstan/phpstan-src/commit/c587dd1d870f7a67623e1a3bb7f2811fda688bab), [#​9406](https://togithub.com/phpstan/phpstan/issues/9406) ### [`v1.10.17`](https://togithub.com/phpstan/phpstan/releases/tag/1.10.17) [Compare Source](https://togithub.com/phpstan/phpstan/compare/1.10.16...1.10.17) # Improvements 🔧 - StubValidator - add missing rules about type aliases (https://github.com/phpstan/phpstan-src/commit/8bb45376ca37a9d67a9a0362809b663cd7567e11) # Bugfixes 🐛 - Fix more `in_array` issues ([#​2432](https://togithub.com/phpstan/phpstan-src/pull/2432)), [#​6959](https://togithub.com/phpstan/phpstan/issues/6959), thanks [@​schlndh](https://togithub.com/schlndh)! - Fix overriding `__debugInfo` with covariant return type ([#​2435](https://togithub.com/phpstan/phpstan-src/pull/2435)), [#​9391](https://togithub.com/phpstan/phpstan/issues/9391), thanks [@​staabm](https://togithub.com/staabm)! - Improve `Map::remove()` `@throws` inference ([#​2434](https://togithub.com/phpstan/phpstan-src/pull/2434)), [#​9066](https://togithub.com/phpstan/phpstan/issues/9066), thanks [@​baci266](https://togithub.com/baci266)! - `array_is_list` narrows the type even when not on Bleeding Edge (https://github.com/phpstan/phpstan-src/commit/de2566adeafe5ca36a3517f0a4e3c147d63f037a), [#​9381](https://togithub.com/phpstan/phpstan/issues/9381) - AutoloadSourceLocator - do not execute autoloader if the class already exists but is evaled (https://github.com/phpstan/phpstan-src/commit/32b889dd29202eb545d8558b1c93a6b804828d8d), [#​7960](https://togithub.com/phpstan/phpstan/issues/7960) - EnumSanityRule - use scope inside enum (https://github.com/phpstan/phpstan-src/commit/04af510e5649a834f2e99750007048ba686ad995), [#​9402](https://togithub.com/phpstan/phpstan/issues/9402) - Fix native type of array after `array_push()` (https://github.com/phpstan/phpstan-src/commit/564f79f96c6104cda479a3d0319af356d1b166ad), [#​9403](https://togithub.com/phpstan/phpstan/issues/9403) - Refactor pieces looking for dead code for more precise detection of properties, methods, constants (https://github.com/phpstan/phpstan-src/commit/d09401df4514a16eb38334cf4187093a4e66eefb, https://github.com/phpstan/phpstan-src/commit/ffc0495d89763b65d93256928cb95bc4b07f6138), [#​8412](https://togithub.com/phpstan/phpstan/issues/8412), [#​8958](https://togithub.com/phpstan/phpstan/issues/8958), [#​8563](https://togithub.com/phpstan/phpstan/issues/8563), thanks [@​takaram](https://togithub.com/takaram)! - Fix param-type specification interfering with root-expression types ([#​2439](https://togithub.com/phpstan/phpstan-src/pull/2439)), [#​9404](https://togithub.com/phpstan/phpstan/issues/9404), thanks [@​staabm](https://togithub.com/staabm)! # Function signature fixes 🤖 - More precise `getimagesize*` return type ([#​2438](https://togithub.com/phpstan/phpstan-src/pull/2438)), thanks [@​staabm](https://togithub.com/staabm)! - base64\_decode returns false only in strict mode ([#​2419](https://togithub.com/phpstan/phpstan-src/pull/2419)), thanks [@​kamil-tekiela](https://togithub.com/kamil-tekiela)! # Internals 🔍 - Minor refinements to MutatingScope `empty()` and typehint helper ([#​2430](https://togithub.com/phpstan/phpstan-src/pull/2430)), thanks [@​mad-briller](https://togithub.com/mad-briller)! ### [`v1.10.16`](https://togithub.com/phpstan/phpstan/releases/tag/1.10.16) [Compare Source](https://togithub.com/phpstan/phpstan/compare/1.10.15...1.10.16) # Bleeding edge 🔪 - Report dead types even in multi-exception catch ([#​2399](https://togithub.com/phpstan/phpstan-src/pull/2399)), thanks [@​JanTvrdik](https://togithub.com/JanTvrdik)! - `error_log` errors with `message_type=2` ([#​2428](https://togithub.com/phpstan/phpstan-src/pull/2428)), [#​9380](https://togithub.com/phpstan/phpstan/issues/9380), thanks [@​staabm](https://togithub.com/staabm)! *If you want to see the shape of things to come and adopt bleeding edge features early, you can include this config file in your project's `phpstan.neon`:* includes: - vendor/phpstan/phpstan/conf/bleedingEdge.neon *Of course, there are no backwards compatibility guarantees when you include this file. The behaviour and reported errors can change in minor versions with this file included. [Learn more](https://phpstan.org/blog/what-is-bleeding-edge)* # Improvements 🔧 - `CallableType` and `ClosureType::describe()` - use phpdoc-parser Printer for better precision (https://github.com/phpstan/phpstan-src/commit/30f60c18f5efa9e7d5a5495c90f901178cf17a57), [#​9268](https://togithub.com/phpstan/phpstan/issues/9268) - `OffsetAccessType::describe()` uses toPhpDocNode and phpdoc-parser printer (https://github.com/phpstan/phpstan-src/commit/347fdbf2caa4d889d9e59af12fc1049a2aa608bb) - Smarter `extract()` with constant arrays ([#​2417](https://togithub.com/phpstan/phpstan-src/pull/2417)), [#​9331](https://togithub.com/phpstan/phpstan/issues/9331), thanks [@​MartinMystikJonas](https://togithub.com/MartinMystikJonas)! - Detect more issues in enum declarations ([#​2371](https://togithub.com/phpstan/phpstan-src/pull/2371)), [#​9184](https://togithub.com/phpstan/phpstan/issues/9184), thanks [@​kubk](https://togithub.com/kubk)! - Correct magic signature methods when typehints are missing ([#​2409](https://togithub.com/phpstan/phpstan-src/pull/2409)), thanks [@​staabm](https://togithub.com/staabm)! # Bugfixes 🐛 - Fix `SplDoublyLinkedList::offsetGet` return type ([#​2373](https://togithub.com/phpstan/phpstan-src/pull/2373)), [#​9274](https://togithub.com/phpstan/phpstan/issues/9274), thanks [@​takaram](https://togithub.com/takaram)! - Delegate `get_called_class()` to `static::class` (https://github.com/phpstan/phpstan-src/commit/188acf440787c611fa86344b84fe1f41f027e4f6), [#​7574](https://togithub.com/phpstan/phpstan/issues/7574), [#​5252](https://togithub.com/phpstan/phpstan/issues/5252), [#​4061](https://togithub.com/phpstan/phpstan/issues/4061) - Fix enum type subtracting ([#​2415](https://togithub.com/phpstan/phpstan-src/pull/2415)), thanks [@​schlndh](https://togithub.com/schlndh)! - Fix loose comparison against enum ([#​2410](https://togithub.com/phpstan/phpstan-src/pull/2410)), thanks [@​schlndh](https://togithub.c </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/kayman-mk/blog-tech-at-work). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zMS41IiwidXBkYXRlZEluVmVyIjoiMzcuMzEuNSIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Exceptions capture a stack trace when they are created, not when they are thrown:
https://3v4l.org/m1b9H
Capturing this stacktrace can be fairly expensive, especially when on a hot path that is potentially very deep in the callstack such as when recursively parsing.
Moving this exception to be only be created only when necessary reduces the time to parse a fairly significantly sized phpdoc (4x the size of a carbon phpdoc) by 2-5% from my profiling with xdebug, reducing the total cost from ~52m to about ~48m on average.