zend-coding-standard
zend-coding-standard copied to clipboard
[v2] Intersection types not recognized in docblocks
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
For reference, please see: https://github.com/squizlabs/PHP_CodeSniffer/issues/2410
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.