Skip to content

Avoid reporting with TestContainer::get as internal #441

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: 2.0.x
Choose a base branch
from

Conversation

VincentLanglet
Copy link
Contributor

Hi @ondrejmirtes

I tried to solve both #210 and symfony/symfony#60299 with another implementation (by trying to copy the idea of the QueryType in phpstan-doctrine).

I wonder if it's something going in the right direction or not.

@VincentLanglet VincentLanglet force-pushed the testContainer branch 6 times, most recently from 0d5c53a to 46866b0 Compare May 8, 2025 17:39
@@ -43,11 +44,17 @@ public function processNode(Node $node, Scope $scope): array

$argType = $scope->getType($node->var);

$isTestContainerType = (new ObjectType('Symfony\Bundle\FrameworkBundle\Test\TestContainer'))->isSuperTypeOf($argType);
if (
$argType instanceof TestContainerType
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we simplify this and not report an error when we simply have the upper-most ContainerInterface and are in a subclass of KernelTestCase?

The custom type is wrong since it doesn't implement equals, describe and isSuperTypeOf. But I think we don't need it at all.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we simplify this and not report an error when we simply have the upper-most ContainerInterface and are in a subclass of KernelTestCase?

I think this is not fully true, but this might be good enough.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be better with the last commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants