Skip to content
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

Add support of template for docblock methods #7385

Merged
merged 1 commit into from Jan 15, 2022

Conversation

vincent4vx
Copy link
Contributor

See fix #7320

Add the support of template type on return type and parameter of a method declared using @method annotation, on class or interface :

<?php
/**
 * @template T
 * @method T get()
 * @method void set(T $value)
 */
class Container
{
    public function __call(string $name, array $args) {}
}

class A {}
function foo(A $a): void {}

/** @var Container<A> $container */
$container = new Container();
$container->set(new A());
foo($container->get());

Current version do not process template types, so calling those pseudo methods will always result to InvalidArgument error.

@vincent4vx vincent4vx marked this pull request as ready for review January 13, 2022 10:32
@weirdan weirdan added the release:feature The PR will be included in 'Features' section of the release notes label Jan 13, 2022
@orklah
Copy link
Collaborator

orklah commented Jan 15, 2022

Thanks!

@orklah orklah merged commit 9a9243e into vimeo:4.x Jan 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release:feature The PR will be included in 'Features' section of the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Template return type is not resolved on docblock @method
3 participants