← 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.15PHPStan - PHP Static Analysis Tool 2.2.15 Recognized (no probes)

No diagnostics reported.

  • Recognition: spelling resolved
  • Enforcement: not measured — this test carries no rejection probes
psalm 6.18.0Psalm 6.18.0@536dd6236b39a5115385b0307b42d6d1ad431a02
next: 7.0.0-beta22
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.50.0mago 1.50.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.78.0mir 0.78.0 Recognized (no probes)
phpdoc_advanced_phpstan_not_deprecated.php:43: DeprecatedMethod: Method Conformance\Tests\PhpdocAdvancedPhpstanNotDeprecated\Base::run() is deprecated: Use child instead [MIR1002]
  • Recognition: spelling resolved
  • Enforcement: not measured — this test carries no rejection probes
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]
  • 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
phpactor 2026.06.23.0Phpactor 2026.06.23.0 Recognized (no probes)
phpdoc_advanced_phpstan_not_deprecated.php:43: Call to deprecated method "run": Use child instead [deprecated_usage]
  • Recognition: spelling resolved
  • Enforcement: not measured — this test carries no rejection probes
phpy 1.0.19274phpy 1.0.19274 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.9437.196Qodana 262.9437.196 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.8steins 0.1.8 (2026-09-21 revision 76306a9) Recognized (no probes)

No diagnostics reported.

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

No diagnostics reported.

  • Recognition: spelling resolved
  • Enforcement: not measured — this test carries no rejection probes
psalm-next 7.0.0-beta22Psalm 7.0.0-beta22@de27e5724ee5997a1e3baee4d394ca6f4e46eba0 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