djoos / Symfony-coding-standard

Development repository for the Symfony coding standard
MIT License
402 stars 102 forks source link

Symfony.Commenting.Annotations.Invalid triggers on PHPdoc annotations grouped by php-cs-fixer #196

Open landure opened 1 year ago

landure commented 1 year ago

With this header added to PHP files:

<?php

/**
 * @author Firstname Lastname
 * @copyright 2023 Company
 * @license MIT
 *
 * This file is part of Project.
 *
 * For the full copyright and license information, please view the LICENSE
 * file distributed with this source code.
 */

When using phpcs in addition to php-cs-fixer,

  1. php-cs-fixer's phpdoc_separation rule group @author, @copyright and @license annotations together (like the example above).
  2. phpcs's Symfony.Commenting.Annotations.Invalid rule detect this grouping as invalid.

Generally, the Symfony.Commenting.Annotations.Invalid rule will trigger on any PHPDoc annotations grouped together if they are not the same.

Fix proposal

Either ignore PHPDoc annotations in the regex (bad fix), or implement php-cs-fixer's phpdoc_separation grouping.