@not-deprecated@deprecated on a parent method is inherited. @not-deprecated on an
override breaks that chain so callers of the child are clean while direct
calls to the parent stay deprecated (when the tool reports deprecations).
References:
- PHPStan phpdocs-basics: Deprecations / @not-deprecated| Analyzer | Version | Result | Diagnostics |
|---|---|---|---|
| phan | 6.0.7Phan 6.0.7 php-ast version 1.1.3 PHP version used to run Phan: 8.5.9 | Recognized (no probes) | phpdoc_advanced_phpstan_not_deprecated.php:43: Call to deprecated function \Conformance\Tests\PhpdocAdvancedPhpstanNotDeprecated\Base::run() defined at /Users/megurine/repo/php/php-typing-conformance/conformance/tests/phpdoc_advanced_phpstan_not_deprecated.php:23 (Deprecated because: Use child instead) [PhanDeprecatedFunction]
|
| phpstan | 2.2.11PHPStan - PHP Static Analysis Tool 2.2.11 | Recognized (no probes) | No diagnostics reported.
|
| psalm | 6.16.1Psalm 6.16.1@f1f5de594dc76faf8784e02d3dc4716c91c6f6ac next: 7.0.0-beta19 |
Recognized (no probes) | phpdoc_advanced_phpstan_not_deprecated.php:43: The method Conformance\Tests\PhpdocAdvancedPhpstanNotDeprecated\Base::run has been marked as deprecated [DeprecatedMethod]
|
| mago | 1.47.4mago 1.47.4 | Recognized (no probes) | phpdoc_advanced_phpstan_not_deprecated.php:43: Call to deprecated method: `Conformance\Tests\PhpdocAdvancedPhpstanNotDeprecated\Base::run`. [deprecated-method]
|
| mir | 0.72.1mir 0.72.1 | Recognized (no probes) | phpdoc_advanced_phpstan_not_deprecated.php:43: DeprecatedMethod: Method Conformance\Tests\PhpdocAdvancedPhpstanNotDeprecated\Base::run() is deprecated: Use child instead [MIR1002]
|
| phpantom | 0.10.0phpantom_lsp 0.10.0 | Recognized (no probes) | phpdoc_advanced_phpstan_not_deprecated.php:43: 'Conformance\Tests\PhpdocAdvancedPhpstanNotDeprecated\Base::run' is deprecated: Use child instead [deprecated_usage]
|
| intelephense | 1.18.5intelephense 1.18.5 | Recognized (no probes) | phpdoc_advanced_phpstan_not_deprecated.php:43: 'run' is deprecated. [P1007]
|
| phpactor | 2026.07.22.0Phpactor 2026.07.22.0 | Recognized (no probes) ⚠ 1 false positive | phpdoc_advanced_phpstan_not_deprecated.php:28: Call to deprecated class "Conformance\Tests\PhpdocAdvancedPhpstanNotDeprecated\Base": ` on a parent method is inherited. ` phpdoc_advanced_phpstan_not_deprecated.php:43: Call to deprecated method "run": Use child instead phpdoc_advanced_phpstan_not_deprecated.php:43: Call to deprecated class "Conformance\Tests\PhpdocAdvancedPhpstanNotDeprecated\Base": ` on a parent method is inherited. `
Expectation diffLine 28: Unexpected errors ["Call to deprecated class \"Conformance\\Tests\\PhpdocAdvancedPhpstanNotDeprecated\\Base\": ` on a parent method is inherited. `"] |
| phpy | 0.2.0phpy 0.2.0 | Recognized (no probes) | phpdoc_advanced_phpstan_not_deprecated.php:43: Function 'run' has been deprecated. Use child instead
|
| qodana | 262.9437.196Qodana 262.9437.196 | Recognized (no probes) | No diagnostics reported.
|
| noverify | 0.5.5NoVerify, version 0.5.5: built on: 2025.04.22 14:36:46 OS: r-kuchinskas arm64 Commit: 4774b82f8adc53fbef38f95e97af4b953b4d1529 | Recognized (no probes) | phpdoc_advanced_phpstan_not_deprecated.php:43: Call to deprecated method {\Conformance\Tests\PhpdocAdvancedPhpstanNotDeprecated\Base}->run() (reason: Use child instead) [deprecated]
|
| steins | 0.1.6steins 0.1.6 (2026-08-25 revision c13b4c7) | Recognized (no probes) | No diagnostics reported.
|
| phpstan-strict | 2.2.11PHPStan - PHP Static Analysis Tool 2.2.11 | Recognized (no probes) | No diagnostics reported.
|
| psalm-next | 7.0.0-beta19Psalm 7.0.0-beta19@7e751c06a756fa64dc4c759c09fe4a173afcb433 | Recognized (no probes) | phpdoc_advanced_phpstan_not_deprecated.php:43: The method Conformance\Tests\PhpdocAdvancedPhpstanNotDeprecated\Base::run has been marked as deprecated [DeprecatedMethod]
|
<?php
declare(strict_types=1);
namespace Conformance\Tests\PhpdocAdvancedPhpstanNotDeprecated;
/**
* Cross-tool handling of `@not-deprecated`.
*
* `@deprecated` on a parent method is inherited. `@not-deprecated` on an
* override breaks that chain so callers of the child are clean while direct
* calls to the parent stay deprecated (when the tool reports deprecations).
*
* References:
* - PHPStan phpdocs-basics: Deprecations / `@not-deprecated`
*
* @conformance-kind style
*/
class Base
{
/** @deprecated Use child instead */
public function run(): void
{
}
}
class Child extends Base
{
/** @not-deprecated */
#[\Override]
public function run(): void // T: @not-deprecated
{
}
}
(new Child())->run();
// Direct call to the parent's own @deprecated method. This exercises plain
// @deprecated support, not @not-deprecated: no tested analyzer propagates a
// parent's deprecation onto an override, so there is nothing for the tag to
// break, and this diagnostic must not be counted as tag enforcement.
(new Base())->run(); // E?[noise]: deprecated parent method usage