Skip to content

Strange behavior of Magento2.Annotation.MethodAnnotationStructure.MethodAnnotation check #303

Closed
@hostep

Description

@hostep

Preconditions

  1. magento/magento-coding-standard version 12

Steps to reproduce

  1. Have a class like this:
<?php

declare(strict_types=1);

namespace Some\Namespace;

use Symfony\Component\Console\Output\OutputInterface;

class Progress
{
    /** @var OutputInterface */
    private $output;

    private function methodOne(): bool
    {
        return false;
    }

    private function methodTwo(): bool
    {
        return false;
    }

    private function methodThree(): bool
    {
        return false;
    }
}
  1. Run vendor/bin/phpcs -s --standard=Magento2 --ignore=./vendor/ .

Expected result

  1. No confusing Missing short description and There must be exactly one blank line before tags warnings for the $output parameter

Actual result

  1. Getting this output:
FILE: Progress.php
----------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 9 WARNINGS AFFECTING 4 LINES
----------------------------------------------------------------------------------------------------------------------------------
 11 | WARNING | Missing short description (Magento2.Annotation.MethodAnnotationStructure.MethodAnnotation)
 11 | WARNING | Missing short description (Magento2.Annotation.MethodAnnotationStructure.MethodAnnotation)
 11 | WARNING | Missing short description (Magento2.Annotation.MethodAnnotationStructure.MethodAnnotation)
 11 | WARNING | There must be exactly one blank line before tags
    |         | (Magento2.Annotation.MethodAnnotationStructure.MethodAnnotation)
 11 | WARNING | There must be exactly one blank line before tags
    |         | (Magento2.Annotation.MethodAnnotationStructure.MethodAnnotation)
 11 | WARNING | There must be exactly one blank line before tags
    |         | (Magento2.Annotation.MethodAnnotationStructure.MethodAnnotation)
 14 | WARNING | Comment block is missing (Magento2.Annotation.MethodArguments.MethodArguments)
 19 | WARNING | Comment block is missing (Magento2.Annotation.MethodArguments.MethodArguments)
 24 | WARNING | Comment block is missing (Magento2.Annotation.MethodArguments.MethodArguments)
----------------------------------------------------------------------------------------------------------------------------------

Each time I add a new method, 2 more warnings for Missing short description and There must be exactly one blank line before tags appear that claim to have something to do with the $output variable. Which is really confusing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions