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
Allow DeprecatedScopeResolvers to be aware of the node being processed #107
Comments
So what is the problem here? You have this code: $result = DeprecationHelper::backwardsCompatibleCall(
currentVersion: \Drupal::VERSION,
deprecatedVersion: '10.3',
currentCallable: fn() => Role::loadMultiple(),
deprecatedCallable: fn() => user_roles(),
); And when a deprecated function is called inside |
Correct. Given that The following is OK, callable in DeprecationHelper::backwardsCompatibleCall(
currentVersion: \Drupal::VERSION,
deprecatedVersion: '10.3',
currentCallable: fn() => Role::loadMultiple(),
deprecatedCallable: fn() => user_roles(),
); This is not OK because the deprecated code is in DeprecationHelper::backwardsCompatibleCall(
currentVersion: \Drupal::VERSION,
deprecatedVersion: '10.3',
currentCallable: fn() => user_roles(),
deprecatedCallable: fn() => Role::loadMultiple(),
); |
So how about phpstan/phpstan-src@b87e5c4 ? Would calling |
🤔 maybe! I didn't see that method call, only the |
Because I just added it. |
It worked! mglaman/phpstan-drupal@ This allowed me to target the specific parameter in the function call stack. I love it because this proposal felt super messy. |
I'll close this issue, then :) An example below for anyone who happens to come across this issue. public function isScopeDeprecated(Scope $scope): bool
{
if (!class_exists(DeprecationHelper::class)) {
return false;
}
$callStack = $scope->getFunctionCallStackWithParameters();
if (count($callStack) === 0) {
return false;
}
[$function, $parameter] = $callStack[0];
if (!$function instanceof MethodReflection) {
return false;
}
if ($function->getName() !== 'backwardsCompatibleCall'
|| $function->getDeclaringClass()->getName() !== DeprecationHelper::class
) {
return false;
}
return $parameter !== null && $parameter->getName() === 'deprecatedCallable';
} |
Awesome! You can expect PHPStan 1.10.56 released in the next few days. |
Thank you @ondrejmirtes, amazing as ever. I appreciate it! |
Yay! Great work, and thank you @ondrejmirtes! <3 |
[![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.55` -> `^1.10.56` | [![age](https://developer.mend.io/api/mc/badges/age/packagist/phpstan%2fphpstan/1.10.56?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/packagist/phpstan%2fphpstan/1.10.56?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/packagist/phpstan%2fphpstan/1.10.55/1.10.56?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/packagist/phpstan%2fphpstan/1.10.55/1.10.56?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>phpstan/phpstan (phpstan/phpstan)</summary> ### [`v1.10.56`](https://togithub.com/phpstan/phpstan/releases/tag/1.10.56) [Compare Source](https://togithub.com/phpstan/phpstan/compare/1.10.55...1.10.56) # Major new feature 🚀 - New PHPDoc tags: `@phpstan-require-extends`, `@phpstan-require-implements`, [#​10302](https://togithub.com/phpstan/phpstan/issues/10302), [#​9899](https://togithub.com/phpstan/phpstan/issues/9899), [#​8550](https://togithub.com/phpstan/phpstan/issues/8550), thanks [@​staabm](https://togithub.com/staabm)! - Learn more: [Making `@property` PHPDoc above interfaces work on PHP 8.2+](https://phpstan.org/blog/solving-phpstan-access-to-undefined-property#making-%40property-phpdoc-above-interfaces-work-on-php-8.2%2B) - [Enforcing class inheritance for interfaces and traits](https://phpstan.org/writing-php-code/phpdocs-basics#enforcing-class-inheritance-for-interfaces-and-traits) - [Enforcing implementing an interface for traits](https://phpstan.org/writing-php-code/phpdocs-basics#enforcing-implementing-an-interface-for-traits) - Development of this feature was kindly sponsored by [Pixel & Tonic](https://pixelandtonic.com/), the team behind [Craft CMS](https://craftcms.com/) # Improvements 🔧 - Scope - function call stack includes parameters too (phpstan/phpstan-src@b87e5c4), [phpstan/phpstan-deprecation-rules#107 # Bugfixes 🐛 - Process `match` arm condition before analysing the body (phpstan/phpstan-src@2b74aa8), [#​10418](https://togithub.com/phpstan/phpstan/issues/10418) # Function signature fixes 🤖 - Fix transliterator function maps ([#​2862](https://togithub.com/phpstan/phpstan-src/pull/2862)), thanks [@​PrinsFrank](https://togithub.com/PrinsFrank)! - Fix duplicate array key `Yaf_Response_Http::__clone` ([#​2863](https://togithub.com/phpstan/phpstan-src/pull/2863)), thanks [@​PrinsFrank](https://togithub.com/PrinsFrank)! - Add array shape for `transliterator::listIDs` return type ([#​2865](https://togithub.com/phpstan/phpstan-src/pull/2865)), thanks [@​PrinsFrank](https://togithub.com/PrinsFrank)! - `strtok()` always returns a `non-empty-string` when it does not return false ([#​2869](https://togithub.com/phpstan/phpstan-src/pull/2869)), thanks [@​staabm](https://togithub.com/staabm)! # Internals 🔍 - Prevent repetative calls to `Type::getConstantArrays()` ([#​2864](https://togithub.com/phpstan/phpstan-src/pull/2864)), thanks [@​staabm](https://togithub.com/staabm)! - Remove redundant condition in ParametersAcceptorSelector ([#​2867](https://togithub.com/phpstan/phpstan-src/pull/2867)), thanks [@​mad-briller](https://togithub.com/mad-briller)! - Simplify default return path in extensions ([#​2868](https://togithub.com/phpstan/phpstan-src/pull/2868)), thanks [@​staabm](https://togithub.com/staabm)! - Reduce unnecessary calls to `Scope::getFunctionType()` ([#​2872](https://togithub.com/phpstan/phpstan-src/pull/2872)), thanks [@​staabm](https://togithub.com/staabm)! </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/Lendable/json-serializer). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4xMjcuMCIsInVwZGF0ZWRJblZlciI6IjM3LjEyNy4wIiwidGFyZ2V0QnJhbmNoIjoibWFzdGVyIn0=--> 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.55` -> `^1.10.56` | [![age](https://developer.mend.io/api/mc/badges/age/packagist/phpstan%2fphpstan/1.10.56?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/packagist/phpstan%2fphpstan/1.10.56?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/packagist/phpstan%2fphpstan/1.10.55/1.10.56?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/packagist/phpstan%2fphpstan/1.10.55/1.10.56?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- > [!WARNING] > Some dependencies could not be looked up. Check the Dependency Dashboard for more information. --- ### Release Notes <details> <summary>phpstan/phpstan (phpstan/phpstan)</summary> ### [`v1.10.56`](https://togithub.com/phpstan/phpstan/releases/tag/1.10.56) [Compare Source](https://togithub.com/phpstan/phpstan/compare/1.10.55...1.10.56) # Major new feature 🚀 - New PHPDoc tags: `@phpstan-require-extends`, `@phpstan-require-implements`, [#​10302](https://togithub.com/phpstan/phpstan/issues/10302), [#​9899](https://togithub.com/phpstan/phpstan/issues/9899), [#​8550](https://togithub.com/phpstan/phpstan/issues/8550), thanks [@​staabm](https://togithub.com/staabm)! - Learn more: [Making `@property` PHPDoc above interfaces work on PHP 8.2+](https://phpstan.org/blog/solving-phpstan-access-to-undefined-property#making-%40property-phpdoc-above-interfaces-work-on-php-8.2%2B) - [Enforcing class inheritance for interfaces and traits](https://phpstan.org/writing-php-code/phpdocs-basics#enforcing-class-inheritance-for-interfaces-and-traits) - [Enforcing implementing an interface for traits](https://phpstan.org/writing-php-code/phpdocs-basics#enforcing-implementing-an-interface-for-traits) - Development of this feature was kindly sponsored by [Pixel & Tonic](https://pixelandtonic.com/), the team behind [Craft CMS](https://craftcms.com/) # Improvements 🔧 - Scope - function call stack includes parameters too (phpstan/phpstan-src@b87e5c4), [phpstan/phpstan-deprecation-rules#107 # Bugfixes 🐛 - Process `match` arm condition before analysing the body (phpstan/phpstan-src@2b74aa8), [#​10418](https://togithub.com/phpstan/phpstan/issues/10418) # Function signature fixes 🤖 - Fix transliterator function maps ([#​2862](https://togithub.com/phpstan/phpstan-src/pull/2862)), thanks [@​PrinsFrank](https://togithub.com/PrinsFrank)! - Fix duplicate array key `Yaf_Response_Http::__clone` ([#​2863](https://togithub.com/phpstan/phpstan-src/pull/2863)), thanks [@​PrinsFrank](https://togithub.com/PrinsFrank)! - Add array shape for `transliterator::listIDs` return type ([#​2865](https://togithub.com/phpstan/phpstan-src/pull/2865)), thanks [@​PrinsFrank](https://togithub.com/PrinsFrank)! - `strtok()` always returns a `non-empty-string` when it does not return false ([#​2869](https://togithub.com/phpstan/phpstan-src/pull/2869)), thanks [@​staabm](https://togithub.com/staabm)! # Internals 🔍 - Prevent repetative calls to `Type::getConstantArrays()` ([#​2864](https://togithub.com/phpstan/phpstan-src/pull/2864)), thanks [@​staabm](https://togithub.com/staabm)! - Remove redundant condition in ParametersAcceptorSelector ([#​2867](https://togithub.com/phpstan/phpstan-src/pull/2867)), thanks [@​mad-briller](https://togithub.com/mad-briller)! - Simplify default return path in extensions ([#​2868](https://togithub.com/phpstan/phpstan-src/pull/2868)), thanks [@​staabm](https://togithub.com/staabm)! - Reduce unnecessary calls to `Scope::getFunctionType()` ([#​2872](https://togithub.com/phpstan/phpstan-src/pull/2872)), thanks [@​staabm](https://togithub.com/staabm)! </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:eyJjcmVhdGVkSW5WZXIiOiIzNy4xMjcuMCIsInVwZGF0ZWRJblZlciI6IjM3LjEyNy4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9--> 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 | |---|---|---|---|---|---| | [php-cs-fixer/shim](https://togithub.com/PHP-CS-Fixer/shim) | `^3.46.0` -> `^3.47.0` | [![age](https://developer.mend.io/api/mc/badges/age/packagist/php-cs-fixer%2fshim/3.47.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/packagist/php-cs-fixer%2fshim/3.47.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/packagist/php-cs-fixer%2fshim/3.46.0/3.47.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/packagist/php-cs-fixer%2fshim/3.46.0/3.47.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | | [phpstan/phpstan](https://togithub.com/phpstan/phpstan) | `^1.10.55` -> `^1.10.56` | [![age](https://developer.mend.io/api/mc/badges/age/packagist/phpstan%2fphpstan/1.10.56?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/packagist/phpstan%2fphpstan/1.10.56?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/packagist/phpstan%2fphpstan/1.10.55/1.10.56?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/packagist/phpstan%2fphpstan/1.10.55/1.10.56?slim=true)](https://docs.renovatebot.com/merge-confidence/) | | [rector/rector](https://getrector.org) ([source](https://togithub.com/rectorphp/rector)) | `^0.19.0` -> `^0.19.1` | [![age](https://developer.mend.io/api/mc/badges/age/packagist/rector%2frector/0.19.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/packagist/rector%2frector/0.19.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/packagist/rector%2frector/0.19.0/0.19.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/packagist/rector%2frector/0.19.0/0.19.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>PHP-CS-Fixer/shim (php-cs-fixer/shim)</summary> ### [`v3.47.0`](https://togithub.com/PHP-CS-Fixer/shim/compare/v3.46.0...v3.47.0) [Compare Source](https://togithub.com/PHP-CS-Fixer/shim/compare/v3.46.0...v3.47.0) </details> <details> <summary>phpstan/phpstan (phpstan/phpstan)</summary> ### [`v1.10.56`](https://togithub.com/phpstan/phpstan/releases/tag/1.10.56) [Compare Source](https://togithub.com/phpstan/phpstan/compare/1.10.55...1.10.56) # Major new feature 🚀 - New PHPDoc tags: `@phpstan-require-extends`, `@phpstan-require-implements`, [#​10302](https://togithub.com/phpstan/phpstan/issues/10302), [#​9899](https://togithub.com/phpstan/phpstan/issues/9899), [#​8550](https://togithub.com/phpstan/phpstan/issues/8550), thanks [@​staabm](https://togithub.com/staabm)! - Learn more: [Making `@property` PHPDoc above interfaces work on PHP 8.2+](https://phpstan.org/blog/solving-phpstan-access-to-undefined-property#making-%40property-phpdoc-above-interfaces-work-on-php-8.2%2B) - [Enforcing class inheritance for interfaces and traits](https://phpstan.org/writing-php-code/phpdocs-basics#enforcing-class-inheritance-for-interfaces-and-traits) - [Enforcing implementing an interface for traits](https://phpstan.org/writing-php-code/phpdocs-basics#enforcing-implementing-an-interface-for-traits) - Development of this feature was kindly sponsored by [Pixel & Tonic](https://pixelandtonic.com/), the team behind [Craft CMS](https://craftcms.com/) # Improvements 🔧 - Scope - function call stack includes parameters too (phpstan/phpstan-src@b87e5c4), [phpstan/phpstan-deprecation-rules#107 # Bugfixes 🐛 - Process `match` arm condition before analysing the body (phpstan/phpstan-src@2b74aa8), [#​10418](https://togithub.com/phpstan/phpstan/issues/10418) # Function signature fixes 🤖 - Fix transliterator function maps ([#​2862](https://togithub.com/phpstan/phpstan-src/pull/2862)), thanks [@​PrinsFrank](https://togithub.com/PrinsFrank)! - Fix duplicate array key `Yaf_Response_Http::__clone` ([#​2863](https://togithub.com/phpstan/phpstan-src/pull/2863)), thanks [@​PrinsFrank](https://togithub.com/PrinsFrank)! - Add array shape for `transliterator::listIDs` return type ([#​2865](https://togithub.com/phpstan/phpstan-src/pull/2865)), thanks [@​PrinsFrank](https://togithub.com/PrinsFrank)! - `strtok()` always returns a `non-empty-string` when it does not return false ([#​2869](https://togithub.com/phpstan/phpstan-src/pull/2869)), thanks [@​staabm](https://togithub.com/staabm)! # Internals 🔍 - Prevent repetative calls to `Type::getConstantArrays()` ([#​2864](https://togithub.com/phpstan/phpstan-src/pull/2864)), thanks [@​staabm](https://togithub.com/staabm)! - Remove redundant condition in ParametersAcceptorSelector ([#​2867](https://togithub.com/phpstan/phpstan-src/pull/2867)), thanks [@​mad-briller](https://togithub.com/mad-briller)! - Simplify default return path in extensions ([#​2868](https://togithub.com/phpstan/phpstan-src/pull/2868)), thanks [@​staabm](https://togithub.com/staabm)! - Reduce unnecessary calls to `Scope::getFunctionType()` ([#​2872](https://togithub.com/phpstan/phpstan-src/pull/2872)), thanks [@​staabm](https://togithub.com/staabm)! </details> <details> <summary>rectorphp/rector (rector/rector)</summary> ### [`v0.19.1`](https://togithub.com/rectorphp/rector/compare/0.19.0...0.19.1) [Compare Source](https://togithub.com/rectorphp/rector/compare/0.19.0...0.19.1) </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/aggregate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4xMjcuMCIsInVwZGF0ZWRJblZlciI6IjM3LjEyNy4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9--> 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 | |---|---|---|---|---|---| | [php-cs-fixer/shim](https://togithub.com/PHP-CS-Fixer/shim) | `^3.46.0` -> `^3.47.1` | [![age](https://developer.mend.io/api/mc/badges/age/packagist/php-cs-fixer%2fshim/3.47.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/packagist/php-cs-fixer%2fshim/3.47.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/packagist/php-cs-fixer%2fshim/3.46.0/3.47.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/packagist/php-cs-fixer%2fshim/3.46.0/3.47.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | | [phpstan/phpstan](https://togithub.com/phpstan/phpstan) | `^1.10.55` -> `^1.10.56` | [![age](https://developer.mend.io/api/mc/badges/age/packagist/phpstan%2fphpstan/1.10.56?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/packagist/phpstan%2fphpstan/1.10.56?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/packagist/phpstan%2fphpstan/1.10.55/1.10.56?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/packagist/phpstan%2fphpstan/1.10.55/1.10.56?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>PHP-CS-Fixer/shim (php-cs-fixer/shim)</summary> ### [`v3.47.1`](https://togithub.com/PHP-CS-Fixer/shim/compare/v3.47.0...v3.47.1) [Compare Source](https://togithub.com/PHP-CS-Fixer/shim/compare/v3.47.0...v3.47.1) ### [`v3.47.0`](https://togithub.com/PHP-CS-Fixer/shim/compare/v3.46.0...v3.47.0) [Compare Source](https://togithub.com/PHP-CS-Fixer/shim/compare/v3.46.0...v3.47.0) </details> <details> <summary>phpstan/phpstan (phpstan/phpstan)</summary> ### [`v1.10.56`](https://togithub.com/phpstan/phpstan/releases/tag/1.10.56) [Compare Source](https://togithub.com/phpstan/phpstan/compare/1.10.55...1.10.56) # Major new feature 🚀 - New PHPDoc tags: `@phpstan-require-extends`, `@phpstan-require-implements`, [#​10302](https://togithub.com/phpstan/phpstan/issues/10302), [#​9899](https://togithub.com/phpstan/phpstan/issues/9899), [#​8550](https://togithub.com/phpstan/phpstan/issues/8550), thanks [@​staabm](https://togithub.com/staabm)! - Learn more: [Making `@property` PHPDoc above interfaces work on PHP 8.2+](https://phpstan.org/blog/solving-phpstan-access-to-undefined-property#making-%40property-phpdoc-above-interfaces-work-on-php-8.2%2B) - [Enforcing class inheritance for interfaces and traits](https://phpstan.org/writing-php-code/phpdocs-basics#enforcing-class-inheritance-for-interfaces-and-traits) - [Enforcing implementing an interface for traits](https://phpstan.org/writing-php-code/phpdocs-basics#enforcing-implementing-an-interface-for-traits) - Development of this feature was kindly sponsored by [Pixel & Tonic](https://pixelandtonic.com/), the team behind [Craft CMS](https://craftcms.com/) # Improvements 🔧 - Scope - function call stack includes parameters too (phpstan/phpstan-src@b87e5c4), [phpstan/phpstan-deprecation-rules#107 # Bugfixes 🐛 - Process `match` arm condition before analysing the body (phpstan/phpstan-src@2b74aa8), [#​10418](https://togithub.com/phpstan/phpstan/issues/10418) # Function signature fixes 🤖 - Fix transliterator function maps ([#​2862](https://togithub.com/phpstan/phpstan-src/pull/2862)), thanks [@​PrinsFrank](https://togithub.com/PrinsFrank)! - Fix duplicate array key `Yaf_Response_Http::__clone` ([#​2863](https://togithub.com/phpstan/phpstan-src/pull/2863)), thanks [@​PrinsFrank](https://togithub.com/PrinsFrank)! - Add array shape for `transliterator::listIDs` return type ([#​2865](https://togithub.com/phpstan/phpstan-src/pull/2865)), thanks [@​PrinsFrank](https://togithub.com/PrinsFrank)! - `strtok()` always returns a `non-empty-string` when it does not return false ([#​2869](https://togithub.com/phpstan/phpstan-src/pull/2869)), thanks [@​staabm](https://togithub.com/staabm)! # Internals 🔍 - Prevent repetative calls to `Type::getConstantArrays()` ([#​2864](https://togithub.com/phpstan/phpstan-src/pull/2864)), thanks [@​staabm](https://togithub.com/staabm)! - Remove redundant condition in ParametersAcceptorSelector ([#​2867](https://togithub.com/phpstan/phpstan-src/pull/2867)), thanks [@​mad-briller](https://togithub.com/mad-briller)! - Simplify default return path in extensions ([#​2868](https://togithub.com/phpstan/phpstan-src/pull/2868)), thanks [@​staabm](https://togithub.com/staabm)! - Reduce unnecessary calls to `Scope::getFunctionType()` ([#​2872](https://togithub.com/phpstan/phpstan-src/pull/2872)), thanks [@​staabm](https://togithub.com/staabm)! </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/clock). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4xMjcuMCIsInVwZGF0ZWRJblZlciI6IjM3LjEzNS4wIiwidGFyZ2V0QnJhbmNoIjoibWFzdGVyIn0=--> 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 | |---|---|---|---|---|---| | [php-cs-fixer/shim](https://togithub.com/PHP-CS-Fixer/shim) | `^3.46.0` -> `^3.47.1` | [![age](https://developer.mend.io/api/mc/badges/age/packagist/php-cs-fixer%2fshim/3.47.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/packagist/php-cs-fixer%2fshim/3.47.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/packagist/php-cs-fixer%2fshim/3.46.0/3.47.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/packagist/php-cs-fixer%2fshim/3.46.0/3.47.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | | [phpstan/phpstan](https://togithub.com/phpstan/phpstan) | `^1.10.55` -> `^1.10.56` | [![age](https://developer.mend.io/api/mc/badges/age/packagist/phpstan%2fphpstan/1.10.56?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/packagist/phpstan%2fphpstan/1.10.56?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/packagist/phpstan%2fphpstan/1.10.55/1.10.56?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/packagist/phpstan%2fphpstan/1.10.55/1.10.56?slim=true)](https://docs.renovatebot.com/merge-confidence/) | | [rector/rector](https://getrector.org) ([source](https://togithub.com/rectorphp/rector)) | `^0.19.0` -> `^0.19.1` | [![age](https://developer.mend.io/api/mc/badges/age/packagist/rector%2frector/0.19.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/packagist/rector%2frector/0.19.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/packagist/rector%2frector/0.19.0/0.19.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/packagist/rector%2frector/0.19.0/0.19.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>PHP-CS-Fixer/shim (php-cs-fixer/shim)</summary> ### [`v3.47.1`](https://togithub.com/PHP-CS-Fixer/shim/compare/v3.47.0...v3.47.1) [Compare Source](https://togithub.com/PHP-CS-Fixer/shim/compare/v3.47.0...v3.47.1) ### [`v3.47.0`](https://togithub.com/PHP-CS-Fixer/shim/compare/v3.46.0...v3.47.0) [Compare Source](https://togithub.com/PHP-CS-Fixer/shim/compare/v3.46.0...v3.47.0) </details> <details> <summary>phpstan/phpstan (phpstan/phpstan)</summary> ### [`v1.10.56`](https://togithub.com/phpstan/phpstan/releases/tag/1.10.56) [Compare Source](https://togithub.com/phpstan/phpstan/compare/1.10.55...1.10.56) # Major new feature 🚀 - New PHPDoc tags: `@phpstan-require-extends`, `@phpstan-require-implements`, [#​10302](https://togithub.com/phpstan/phpstan/issues/10302), [#​9899](https://togithub.com/phpstan/phpstan/issues/9899), [#​8550](https://togithub.com/phpstan/phpstan/issues/8550), thanks [@​staabm](https://togithub.com/staabm)! - Learn more: [Making `@property` PHPDoc above interfaces work on PHP 8.2+](https://phpstan.org/blog/solving-phpstan-access-to-undefined-property#making-%40property-phpdoc-above-interfaces-work-on-php-8.2%2B) - [Enforcing class inheritance for interfaces and traits](https://phpstan.org/writing-php-code/phpdocs-basics#enforcing-class-inheritance-for-interfaces-and-traits) - [Enforcing implementing an interface for traits](https://phpstan.org/writing-php-code/phpdocs-basics#enforcing-implementing-an-interface-for-traits) - Development of this feature was kindly sponsored by [Pixel & Tonic](https://pixelandtonic.com/), the team behind [Craft CMS](https://craftcms.com/) # Improvements 🔧 - Scope - function call stack includes parameters too (phpstan/phpstan-src@b87e5c4), [phpstan/phpstan-deprecation-rules#107 # Bugfixes 🐛 - Process `match` arm condition before analysing the body (phpstan/phpstan-src@2b74aa8), [#​10418](https://togithub.com/phpstan/phpstan/issues/10418) # Function signature fixes 🤖 - Fix transliterator function maps ([#​2862](https://togithub.com/phpstan/phpstan-src/pull/2862)), thanks [@​PrinsFrank](https://togithub.com/PrinsFrank)! - Fix duplicate array key `Yaf_Response_Http::__clone` ([#​2863](https://togithub.com/phpstan/phpstan-src/pull/2863)), thanks [@​PrinsFrank](https://togithub.com/PrinsFrank)! - Add array shape for `transliterator::listIDs` return type ([#​2865](https://togithub.com/phpstan/phpstan-src/pull/2865)), thanks [@​PrinsFrank](https://togithub.com/PrinsFrank)! - `strtok()` always returns a `non-empty-string` when it does not return false ([#​2869](https://togithub.com/phpstan/phpstan-src/pull/2869)), thanks [@​staabm](https://togithub.com/staabm)! # Internals 🔍 - Prevent repetative calls to `Type::getConstantArrays()` ([#​2864](https://togithub.com/phpstan/phpstan-src/pull/2864)), thanks [@​staabm](https://togithub.com/staabm)! - Remove redundant condition in ParametersAcceptorSelector ([#​2867](https://togithub.com/phpstan/phpstan-src/pull/2867)), thanks [@​mad-briller](https://togithub.com/mad-briller)! - Simplify default return path in extensions ([#​2868](https://togithub.com/phpstan/phpstan-src/pull/2868)), thanks [@​staabm](https://togithub.com/staabm)! - Reduce unnecessary calls to `Scope::getFunctionType()` ([#​2872](https://togithub.com/phpstan/phpstan-src/pull/2872)), thanks [@​staabm](https://togithub.com/staabm)! </details> <details> <summary>rectorphp/rector (rector/rector)</summary> ### [`v0.19.1`](https://togithub.com/rectorphp/rector/compare/0.19.0...0.19.1) [Compare Source](https://togithub.com/rectorphp/rector/compare/0.19.0...0.19.1) </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:eyJjcmVhdGVkSW5WZXIiOiIzNy4xMjcuMCIsInVwZGF0ZWRJblZlciI6IjM3LjEzNS4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9--> 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.55` -> `1.10.57` | [![age](https://developer.mend.io/api/mc/badges/age/packagist/phpstan%2fphpstan/1.10.57?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/packagist/phpstan%2fphpstan/1.10.57?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/packagist/phpstan%2fphpstan/1.10.55/1.10.57?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/packagist/phpstan%2fphpstan/1.10.55/1.10.57?slim=true)](https://docs.renovatebot.com/merge-confidence/) | | [phpunit/phpunit](https://phpunit.de/) ([source](https://togithub.com/sebastianbergmann/phpunit)) | `10.5.7` -> `10.5.9` | [![age](https://developer.mend.io/api/mc/badges/age/packagist/phpunit%2fphpunit/10.5.9?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/packagist/phpunit%2fphpunit/10.5.9?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/packagist/phpunit%2fphpunit/10.5.7/10.5.9?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/packagist/phpunit%2fphpunit/10.5.7/10.5.9?slim=true)](https://docs.renovatebot.com/merge-confidence/) | | [vimeo/psalm](https://togithub.com/vimeo/psalm) | `5.19.0` -> `5.20.0` | [![age](https://developer.mend.io/api/mc/badges/age/packagist/vimeo%2fpsalm/5.20.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/packagist/vimeo%2fpsalm/5.20.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/packagist/vimeo%2fpsalm/5.19.0/5.20.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/packagist/vimeo%2fpsalm/5.19.0/5.20.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>phpstan/phpstan (phpstan/phpstan)</summary> ### [`v1.10.57`](https://togithub.com/phpstan/phpstan/compare/1.10.56...1.10.57) [Compare Source](https://togithub.com/phpstan/phpstan/compare/1.10.56...1.10.57) ### [`v1.10.56`](https://togithub.com/phpstan/phpstan/releases/tag/1.10.56) [Compare Source](https://togithub.com/phpstan/phpstan/compare/1.10.55...1.10.56) # Major new feature 🚀 - New PHPDoc tags: `@phpstan-require-extends`, `@phpstan-require-implements`, [#​10302](https://togithub.com/phpstan/phpstan/issues/10302), [#​9899](https://togithub.com/phpstan/phpstan/issues/9899), [#​8550](https://togithub.com/phpstan/phpstan/issues/8550), thanks [@​staabm](https://togithub.com/staabm)! - Learn more: [Making `@property` PHPDoc above interfaces work on PHP 8.2+](https://phpstan.org/blog/solving-phpstan-access-to-undefined-property#making-%40property-phpdoc-above-interfaces-work-on-php-8.2%2B) - [Enforcing class inheritance for interfaces and traits](https://phpstan.org/writing-php-code/phpdocs-basics#enforcing-class-inheritance-for-interfaces-and-traits) - [Enforcing implementing an interface for traits](https://phpstan.org/writing-php-code/phpdocs-basics#enforcing-implementing-an-interface-for-traits) - Development of this feature was kindly sponsored by [Pixel & Tonic](https://pixelandtonic.com/), the team behind [Craft CMS](https://craftcms.com/) # Improvements 🔧 - Scope - function call stack includes parameters too (phpstan/phpstan-src@b87e5c4), [phpstan/phpstan-deprecation-rules#107 # Bugfixes 🐛 - Process `match` arm condition before analysing the body (phpstan/phpstan-src@2b74aa8), [#​10418](https://togithub.com/phpstan/phpstan/issues/10418) # Function signature fixes 🤖 - Fix transliterator function maps ([#​2862](https://togithub.com/phpstan/phpstan-src/pull/2862)), thanks [@​PrinsFrank](https://togithub.com/PrinsFrank)! - Fix duplicate array key `Yaf_Response_Http::__clone` ([#​2863](https://togithub.com/phpstan/phpstan-src/pull/2863)), thanks [@​PrinsFrank](https://togithub.com/PrinsFrank)! - Add array shape for `transliterator::listIDs` return type ([#​2865](https://togithub.com/phpstan/phpstan-src/pull/2865)), thanks [@​PrinsFrank](https://togithub.com/PrinsFrank)! - `strtok()` always returns a `non-empty-string` when it does not return false ([#​2869](https://togithub.com/phpstan/phpstan-src/pull/2869)), thanks [@​staabm](https://togithub.com/staabm)! # Internals 🔍 - Prevent repetative calls to `Type::getConstantArrays()` ([#​2864](https://togithub.com/phpstan/phpstan-src/pull/2864)), thanks [@​staabm](https://togithub.com/staabm)! - Remove redundant condition in ParametersAcceptorSelector ([#​2867](https://togithub.com/phpstan/phpstan-src/pull/2867)), thanks [@​mad-briller](https://togithub.com/mad-briller)! - Simplify default return path in extensions ([#​2868](https://togithub.com/phpstan/phpstan-src/pull/2868)), thanks [@​staabm](https://togithub.com/staabm)! - Reduce unnecessary calls to `Scope::getFunctionType()` ([#​2872](https://togithub.com/phpstan/phpstan-src/pull/2872)), thanks [@​staabm](https://togithub.com/staabm)! </details> <details> <summary>sebastianbergmann/phpunit (phpunit/phpunit)</summary> ### [`v10.5.9`](https://togithub.com/sebastianbergmann/phpunit/compare/10.5.8...10.5.9) [Compare Source](https://togithub.com/sebastianbergmann/phpunit/compare/10.5.8...10.5.9) ### [`v10.5.8`](https://togithub.com/sebastianbergmann/phpunit/compare/10.5.7...10.5.8) [Compare Source](https://togithub.com/sebastianbergmann/phpunit/compare/10.5.7...10.5.8) </details> <details> <summary>vimeo/psalm (vimeo/psalm)</summary> ### [`v5.20.0`](https://togithub.com/vimeo/psalm/releases/tag/5.20.0) [Compare Source](https://togithub.com/vimeo/psalm/compare/5.19.1...5.20.0) <!-- Release notes generated using configuration in .github/release.yml at 5.x --> #### What's Changed ##### Features - report error for non-strict or empty comparison on truthy+falsy union by [@​kkmuffme](https://togithub.com/kkmuffme) in [vimeo/psalm#10502 ##### Fixes - Fix template, conditional array keys by [@​danog](https://togithub.com/danog) in [vimeo/psalm#10568 **Full Changelog**: vimeo/psalm@5.19.1...5.20.0 ### [`v5.19.1`](https://togithub.com/vimeo/psalm/releases/tag/5.19.1) [Compare Source](https://togithub.com/vimeo/psalm/compare/5.19.0...5.19.1) <!-- Release notes generated using configuration in .github/release.yml at 5.x --> #### What's Changed ##### Fixes - Deprecated Template Classes are not ignored by [@​psalm-suppress](https://togithub.com/psalm-suppress) DeprecatedClass by [@​samlitowitz](https://togithub.com/samlitowitz) in [vimeo/psalm#10518 - Implement \__set method in SimpleXMLElement stub by [@​kthaler](https://togithub.com/kthaler) in [vimeo/psalm#10536 - Make getrandmax type more specific and unserialize to require class-string by [@​kkmuffme](https://togithub.com/kkmuffme) in [vimeo/psalm#10540 - Fix mb_get_info can return null - CI failing bc of reflection by [@​kkmuffme](https://togithub.com/kkmuffme) in [vimeo/psalm#10543 - make basename & dirname return types more specific by [@​kkmuffme](https://togithub.com/kkmuffme) in [vimeo/psalm#10545 - add support for extract to set variables for keyed arrays and respect EXTR_SKIP by [@​kkmuffme](https://togithub.com/kkmuffme) in [vimeo/psalm#10544 - remove redundat directory separator which caused "//" in path not found errors by [@​kkmuffme](https://togithub.com/kkmuffme) in [vimeo/psalm#10542 - Fix empty literal string becomes non-empty-string by [@​kkmuffme](https://togithub.com/kkmuffme) in [vimeo/psalm#10499 #### New Contributors - [@​samlitowitz](https://togithub.com/samlitowitz) made their first contribution in [vimeo/psalm#10518 - [@​kthaler](https://togithub.com/kthaler) made their first contribution in [vimeo/psalm#10536 **Full Changelog**: vimeo/psalm@5.19.0...5.20.0 </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:eyJjcmVhdGVkSW5WZXIiOiIzNy4xMzUuMCIsInVwZGF0ZWRJblZlciI6IjM3LjEzNS4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9--> 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>
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
This stems from work in mglaman/phpstan-drupal#714 and mglaman/phpstan-drupal#659 in phpstan-drupal.
It's complicated, but it's based on this code:
We want to use a
DeprecatedScopeResolver
to ensure the code called in thedeprecatedCallable
is within a deprecated scope. That's been accomplished in the PR with DeprecationHelperScope so far. However, it is includingcurrentCallable
(we want to find and error on deprecated code within that callable.)Using a NodeVisitor it is possible to traverse the children in the
deprecatedCallable
tree and set adeprecated
attribute. But, this attribute cannot be read using the Scope alone.There are problems with backwards compatibility to modify
\PHPStan\Rules\Deprecations\DeprecatedScopeResolver::isScopeDeprecated
. So, this is my idea.Introduce
NodeAwareDeprecatedScopeResolver
whichDeprecatedScopeResolver
implementations can also implement.DeprecatedScopeHelper
needs to be modified to support this:The text was updated successfully, but these errors were encountered: