@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.10Phan 6.0.10 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.1PHPStan - PHP Static Analysis Tool 2.3.1 | Recognized (no probes) | No diagnostics reported.
|
| psalm | 6.20.0Psalm 6.20.0@804f03c0c183d149fcd4b8c7c0c9b3fbf836d34c next: 7.0.0-rc2 |
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.57.0mago 1.57.0 | Recognized (no probes) | phpdoc_advanced_phpstan_not_deprecated.php:43: Call to deprecated method: `Conformance\Tests\PhpdocAdvancedPhpstanNotDeprecated\Base::run`. [deprecated-method]
|
| mir | 0.87.0mir 0.87.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.19409phpy 1.0.19409 | Recognized (no probes) | phpdoc_advanced_phpstan_not_deprecated.php:43: Function 'run' has been deprecated. Use child instead
|
| qodana | 262.10968.76PhpStorm 262.10968.76 | 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.1PHPStan - PHP Static Analysis Tool 2.3.1 | Recognized (no probes) | No diagnostics reported.
|
| psalm-next | 7.0.0-rc2Psalm 7.0.0-rc2@20339e3fe5b8d03bcd8061030eb2a83ad50e5783 | 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