StofDoctrineExtensionsBundle icon indicating copy to clipboard operation
StofDoctrineExtensionsBundle copied to clipboard

feat: suppress deprecation warnings for getSubscribedEvents()

Open Chris53897 opened this issue 1 year ago • 6 comments

Chris53897 avatar Feb 16 '24 16:02 Chris53897

hi @stof, could you merge it into a new TAG to fix the deprecated message?

thanks in advance and thanks for this bundle!

ceponcet avatar May 23 '24 12:05 ceponcet

which deprecation warnings is this suppressing ?

stof avatar Jun 10 '24 11:06 stof

Method "Symfony\Component\EventDispatcher\EventSubscriberInterface::getSubscribedEvents()" might add "array" as a native return type declaration in the future. Do the same in implementation "Stof\DoctrineExtensionsBundle\EventListener\LoggerListener" now to avoid errors or add an explicit @return annotation to suppress this message.

Chris53897 avatar Jun 10 '24 11:06 Chris53897

This @inheritdoc will not remove that deprecation though. Only an explicit @return array will skip the warning.

stof avatar Jun 10 '24 12:06 stof

Should i change it to @return array or @return array<string, string|array{0: string, 1: int}|list<array{0: string, 1?: int}>> ?

Chris53897 avatar Jun 10 '24 12:06 Chris53897

array<string, string|array{0: string, 1: int}|list<array{0: string, 1?: int}>>

Seems unnecessarily complicated for a method meant to be used by Symfony and not really by other developers in their code. Symfony's documentation shows a simple array for this specific use case as well as for the vast majority of remaining examples.

Also, such level of details increases the chances of having to update the annotation if in the future the shape of the array changes.

subiabre avatar Jun 20 '24 13:06 subiabre