@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.11Phan 6.0.11 php-ast version 1.1.3 PHP version used to run Phan: 8.5.11 | 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.3.5PHPStan - PHP Static Analysis Tool 2.3.5 | Recognized (no probes) | No diagnostics reported.
|
| psalm | 6.20.9Psalm 6.20.9@f67170ac3c3b931f5088681e21d6c8babc601c08 next: 7.0.4 |
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.59.0mago 1.59.0 | Recognized (no probes) | phpdoc_advanced_phpstan_not_deprecated.php:43: Call to deprecated method: `Conformance\Tests\PhpdocAdvancedPhpstanNotDeprecated\Base::run`. [deprecated-method]
|
| mir | 0.91.0mir 0.91.0 | 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.11.1phpantom_lsp 0.11.1 | 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.10.07.0Phpactor 2026.10.07.0 | Recognized (no probes) | phpdoc_advanced_phpstan_not_deprecated.php:43: Call to deprecated method "run": Use child instead [deprecated_usage]
|
| phpy | 1.0.19490phpy 1.0.19490 | Recognized (no probes) | phpdoc_advanced_phpstan_not_deprecated.php:43: Function 'run' has been deprecated. Use child instead
|
| qodana | 262.11879.104PhpStorm 262.11879.104 | 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.8steins 0.1.8 (2026-09-21 revision 76306a9) | Recognized (no probes) | No diagnostics reported.
|
| phpstan-strict | 2.3.5PHPStan - PHP Static Analysis Tool 2.3.5 | Recognized (no probes) | No diagnostics reported.
|
| psalm-next | 7.0.4Psalm 7.0.4@fa5b1f6e665cb743838ffd865b8fc96207f9409f | 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