← All results

@not-deprecated

Group: Advanced PHPDoc types · Category: ecosystem · File: phpdoc_advanced_phpstan_not_deprecated.php · Kind: Style / opinionated (no runtime-safety impact)

@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 results

AnalyzerVersionResultDiagnostics
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]
  • Recognition: spelling resolved
  • Enforcement: not measured — this test carries no rejection probes
phpstan 2.2.8PHPStan - PHP Static Analysis Tool 2.2.8 Recognized (no probes)

No diagnostics reported.

  • Recognition: spelling resolved
  • Enforcement: not measured — this test carries no rejection probes
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]
  • Recognition: spelling resolved
  • Enforcement: not measured — this test carries no rejection probes
mago 1.46.0mago 1.46.0 Recognized (no probes)
phpdoc_advanced_phpstan_not_deprecated.php:43: Call to deprecated method: `Conformance\Tests\PhpdocAdvancedPhpstanNotDeprecated\Base::run`. [deprecated-method]
  • Recognition: spelling resolved
  • Enforcement: not measured — this test carries no rejection probes
mir 0.70.1mir 0.70.1 Recognized (no probes)

No diagnostics reported.

  • Recognition: spelling resolved
  • Enforcement: not measured — this test carries no rejection probes
phpantom 0.9.0phpantom_lsp 0.9.0 Recognized (no probes)

No diagnostics reported.

  • Recognition: spelling resolved
  • Enforcement: not measured — this test carries no rejection probes
intelephense 1.18.5intelephense 1.18.5 Recognized (no probes)
phpdoc_advanced_phpstan_not_deprecated.php:43: 'run' is deprecated. [P1007]
  • Recognition: spelling resolved
  • Enforcement: not measured — this test carries no rejection probes
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
  • Recognition: spelling resolved
  • Enforcement: not measured — this test carries no rejection probes
qodana 262.8665.325Qodana 262.8665.325 Recognized (no probes)

No diagnostics reported.

  • Recognition: spelling resolved
  • Enforcement: not measured — this test carries no rejection probes
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]
  • Recognition: spelling resolved
  • Enforcement: not measured — this test carries no rejection probes
steins 0.1.5steins 0.1.5 (2026-08-12 revision 39b4cc1) Recognized (no probes)

No diagnostics reported.

  • Recognition: spelling resolved
  • Enforcement: not measured — this test carries no rejection probes
phpstan-strict 2.2.8PHPStan - PHP Static Analysis Tool 2.2.8 Recognized (no probes)

No diagnostics reported.

  • Recognition: spelling resolved
  • Enforcement: not measured — this test carries no rejection probes
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]
  • Recognition: spelling resolved
  • Enforcement: not measured — this test carries no rejection probes

Source

<?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