Skip to content

Don't mark test code that is marked @api internal - #285

Merged
danog merged 1 commit into
psalm:masterfrom
danog:api-test-cases
Nov 16, 2026
Merged

danog merged 1 commit into
psalm:masterfrom
danog:api-test-cases

Conversation

@danog

@danog danog commented Nov 16, 2026

Copy link
Copy Markdown
Member

The plugin marks test cases and the code of the test suites internal even when they are marked @api, so library code can't use a test case it ships for its users to extend.

Before

<?php
// testing/LogTestCase.php
namespace Testing;

/** @api */
class LogTestCase extends \PHPUnit\Framework\TestCase
{
    public static function getRecord(): void {}
}

// code.php
/** @psalm-cli-only */
final class Client
{
    public function send(): void
    {
        \Testing\LogTestCase::getRecord(); // InternalClass: Testing\LogTestCase is internal to Testing but called from NS\Client::send
    }
}

After

        \Testing\LogTestCase::getRecord(); // no issue

@danog danog added the release:fix The PR will be included in 'Fixes' section of the release notes label Nov 16, 2026
@danog
danog merged commit 0bc9c97 into psalm:master Nov 16, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release:fix The PR will be included in 'Fixes' section of the release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant