Support for native return type missing from parent @return tag

Open
#412 0 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
php, symfony
Domain
tooling

Research direction

Start by locating the Symfony EventSubscriberInterface handling and the existing return-type diagnostics in this extension. Add coverage for an implementation of getSubscribedEvents() without a native return type, then run the relevant test suite and confirm PHPStan reports the missing compatibility guidance.

Written by the indexing model from the issue text.

Description

The EventSubscriberInterface from Symfony has an @return annotation, and all classes that implement it and have no native return type get a deprecation error message.

class Foo implements EventSubscriberInterface
{
public static function getSubscribedEvents()
{
}
}
Method "Symfony\Component\EventDispatcher\EventSubscriberInterface::getSubscribedEvents()" might add "array" as a native return type declaration in the future. Do the same in implementation "Foo" now to avoid errors or add an explicit @return annotation to suppress this message.

It would be nice if we could get the error in PHPStan instead of running the actual application :)

Dominant language
PHP
Stars
800
Forks
104
Avg merge
4m
Merged PRs (30d)
1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from phpstan/phpstan-symfony

All issues in phpstan/phpstan-symfony

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.