-
Notifications
You must be signed in to change notification settings - Fork 653
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
Incompatible types found for T #6212
Comments
I found these snippets: https://psalm.dev/r/a1e0f8f6f1<?php
/**
* @template T of object
*/
interface AdminInterface {}
/**
* @template T of object
*/
interface MapperInterface
{
/**
* @return AdminInterface<T>
*/
public function getAdmin();
}
/**
* @template T of object
* @phpstan-implements MapperInterface<T>
*/
class FormMapper implements MapperInterface
{
public function getAdmin()
{
throw new \Exception('TODO');
}
}
/**
* @template T of object
*/
class ConfigureEvent
{
/**
* @param AdminInterface<T> $admin
* @param MapperInterface<T> $mapper
*/
public function __construct(AdminInterface $admin, MapperInterface $mapper)
{
}
}
/**
* @template T of object
*/
class AdminEventExtension
{
/**
* @param FormMapper<T> $form
*/
public function configureFormFields(FormMapper $form): void
{
/** @psalm-trace $admin */
$admin = $form->getAdmin();
/** @psalm-trace $form */
new ConfigureEvent($admin, $form);
}
}
|
Simplified: https://psalm.dev/r/1a83e98791 |
I found these snippets: https://psalm.dev/r/1a83e98791<?php
/**
* @template T of object
*/
interface A {}
/**
* @template T of object
*/
interface B {}
/**
* @template T of object
* @param A<T> $admin
* @param B<T> $mapper
*/
function foo(A $admin, B $mapper): void
{}
/**
* @param A<stdClass> $admin
* @param B<stdClass> $mapper
*/
function configureFormFields(A $admin, B $mapper): void {
foo($admin, $mapper);
}
|
It seems to affect some other repos as well: https://github.com/laminas/automatic-releases/pull/157/checks?check_run_id=3212245604 |
I've created a release for 4.9.2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Since the last version (4.9.1), I'm getting a new error:
Incompatible types found for T
.https://psalm.dev/r/a1e0f8f6f1
I saw that @muglug try to fix the issue #6066
But I don't think my case should be reported.
According to the trace, I'm passing
So it should be compatible with the ConfigureEvent::__construct
The text was updated successfully, but these errors were encountered: