← All results

Unprefixed @internal as PHPStan 2.1.13+ bleeding edge reads it: usages outside the declaration's *top* namespace are reported. Psalm's @psalm-internal names the allowed namespace explicitly and is measured separately

Group: Advanced PHPDoc types · Category: ecosystem · File: phpdoc_advanced_phpstan_internal.php

The class lives in a dedicated top-level namespace so an in-suite caller can sit outside it. Conformance\Tests\… would share the Conformance top segment with every other test and could never be "outside". References: - PHPStan phpdocs-basics: Internal symbols (2.1.13 + Bleeding Edge)

Analyzer results

AnalyzerVersionResultDiagnostics
phan 6.0.11Phan 6.0.11 php-ast version 1.1.3 PHP version used to run Phan: 8.5.12 Enforced
phpdoc_advanced_phpstan_internal.php:44: Cannot access internal method \PhpdocAdvancedPhpstanInternalLib\Secret::token() of namespace \PhpdocAdvancedPhpstanInternalLib defined at /Users/megurine/repo/php/php-typing-conformance/conformance/tests/phpdoc_advanced_phpstan_internal.php:26 from namespace \PhpdocAdvancedPhpstanInternalApp [PhanAccessMethodInternal]
  • Recognition: spelling resolved
  • Enforcement: 1/1 of the expected violations reported
phpstan 2.3.7PHPStan - PHP Static Analysis Tool 2.3.7 Enforced reported Lv.2+
phpdoc_advanced_phpstan_internal.php:44: Call to static method token() of internal class PhpdocAdvancedPhpstanInternalLib\Secret from outside its root namespace PhpdocAdvancedPhpstanInternalLib. [reported-from-level=2]
With strict-rules
phpdoc_advanced_phpstan_internal.php:44: Call to static method token() of internal class PhpdocAdvancedPhpstanInternalLib\Secret from outside its root namespace PhpdocAdvancedPhpstanInternalLib.
  • Recognition: spelling resolved
  • Enforcement: 1/1 of the expected violations reported
phpstan-strict 2.3.7PHPStan - PHP Static Analysis Tool 2.3.7 Enforced
phpdoc_advanced_phpstan_internal.php:44: Call to static method token() of internal class PhpdocAdvancedPhpstanInternalLib\Secret from outside its root namespace PhpdocAdvancedPhpstanInternalLib.
  • Recognition: spelling resolved
  • Enforcement: 1/1 of the expected violations reported
psalm 6.21.4Psalm 6.21.4@72023213487628df0bc5b2e02d68cbac614b7ef5 Enforced
phpdoc_advanced_phpstan_internal.php:44: The method PhpdocAdvancedPhpstanInternalLib\Secret::token is internal to PhpdocAdvancedPhpstanInternalLib but called from PhpdocAdvancedPhpstanInternalApp\PhpdocAdvancedPhpstanInternalApp\outside [InternalMethod]
  • Recognition: spelling resolved
  • Enforcement: 1/1 of the expected violations reported
psalm 7 7.21.0Psalm 7.21.0@1a665f0114bd40cf12ad57a1a82066549d92f1b6 Enforced
phpdoc_advanced_phpstan_internal.php:44: PhpdocAdvancedPhpstanInternalLib\Secret is internal to PhpdocAdvancedPhpstanInternalLib but called from PhpdocAdvancedPhpstanInternalApp\outside [InternalClass]
phpdoc_advanced_phpstan_internal.php:44: The method PhpdocAdvancedPhpstanInternalLib\Secret::token is internal to PhpdocAdvancedPhpstanInternalLib but called from PhpdocAdvancedPhpstanInternalApp\outside [InternalMethod]
  • Recognition: spelling resolved
  • Enforcement: 1/1 of the expected violations reported
mago 1.61.0mago 1.61.0 Not enforced

No diagnostics reported.

  • Recognition: spelling resolved
  • Enforcement: 0/1 of the expected violations reported
mir 0.101.0mir 0.101.0 Not enforced

No diagnostics reported.

  • Recognition: spelling resolved
  • Enforcement: 0/1 of the expected violations reported
phpantom 1.1.0phpantom_lsp 1.1.0 Not enforced

No diagnostics reported.

  • Recognition: spelling resolved
  • Enforcement: 0/1 of the expected violations reported
pun 0.4.3pun 0.4.3 Not enforced

No diagnostics reported.

  • Recognition: spelling resolved
  • Enforcement: 0/1 of the expected violations reported
intelephense 1.18.5intelephense 1.18.5 Not enforced

No diagnostics reported.

  • Recognition: spelling resolved
  • Enforcement: 0/1 of the expected violations reported
phpactor 2026.11.22.0Phpactor 2026.11.22.0 Not enforced

No diagnostics reported.

  • Recognition: spelling resolved
  • Enforcement: 0/1 of the expected violations reported
phpy 1.0.19566phpy 1.0.19566 Not enforced

No diagnostics reported.

  • Recognition: spelling resolved
  • Enforcement: 0/1 of the expected violations reported
qodana 263.7307.215PhpStorm 263.7307.215 Not enforced

No diagnostics reported.

  • Recognition: spelling resolved
  • Enforcement: 0/1 of the expected violations reported
noverify 0.5.5NoVerify, version 0.5.5: built on: 2025.04.22 14:36:46 OS: r-kuchinskas arm64 Commit: 4774b82f8adc53fbef38f95e97af4b953b4d1529 Not enforced

No diagnostics reported.

  • Recognition: spelling resolved
  • Enforcement: 0/1 of the expected violations reported
steins 0.1.8steins 0.1.8 (2026-09-21 revision 76306a9) Not enforced

No diagnostics reported.

  • Recognition: spelling resolved
  • Enforcement: 0/1 of the expected violations reported

Source

<?php

declare(strict_types=1);

namespace PhpdocAdvancedPhpstanInternalLib;

/**
 * Cross-tool handling of unprefixed `@internal` as PHPStan 2.1.13+ bleeding
 * edge reads it: usages outside the declaration's *top* namespace are
 * reported. Psalm's `@psalm-internal` names the allowed namespace explicitly
 * and is measured separately.
 *
 * The class lives in a dedicated top-level namespace so an in-suite caller
 * can sit outside it. `Conformance\Tests\…` would share the `Conformance`
 * top segment with every other test and could never be "outside".
 *
 * References:
 * - PHPStan phpdocs-basics: Internal symbols (2.1.13 + Bleeding Edge)
 */

/**
 * @internal
 */
final class Secret // T: @internal
{
    public static function token(): string
    {
        return 'secret';
    }
}

// Same namespace as the declaration: OK for both PHPStan's top-namespace
// rule and tools that require an exact namespace match.
function inside(): string
{
    return Secret::token(); // V
}

namespace PhpdocAdvancedPhpstanInternalApp;

// Different top namespace: error when the tag is honoured.
function outside(): string
{
    return \PhpdocAdvancedPhpstanInternalLib\Secret::token(); // E?: @internal Lib called from App
}