zend-coding-standard icon indicating copy to clipboard operation
zend-coding-standard copied to clipboard

[v2] Intersection types not recognized in docblocks

Open Xerkus opened this issue 6 years ago • 2 comments

2.0.0-alpha.3 standard does not recognize and improperly reformats intersect types(&) in phpdoc:

     /**
      * Inject a service into the container mock.
      *
      * Adjust `has('service')` and `get('service')` returns.
      *
-     * @param ContainerInterface&ObjectProphecy $container
+     * @param ContainerInterface &ObjectProphecy $container
      * @param mixed              $service
      */
     protected function injectServiceInContainer(ObjectProphecy $container, string $serviceName, $service) : void
     {
         $container->has($serviceName)->willReturn(true);
         $container->get($serviceName)->willReturn($service);
     }

Intersections types are supported by PhpStorm, phpstan and present in the draft for phpdoc PSR https://github.com/php-fig/fig-standards/blob/master/proposed/phpdoc.md#details

Xerkus avatar Feb 04 '19 23:02 Xerkus

For reference, please see: https://github.com/squizlabs/PHP_CodeSniffer/issues/2410

michalbundyra avatar Feb 07 '19 17:02 michalbundyra

This repository has been closed and moved to laminas/laminas-coding-standard; a new issue has been opened at https://github.com/laminas/laminas-coding-standard/issues/6.

weierophinney avatar Dec 31 '19 21:12 weierophinney