Skip to content

Allow indentation of non-PHPDoc annotations #90

@aik099

Description

@aik099

Currently there are 2 types of annotations:

  • PHPDoc ones (have space after it's name)
  • Non-PHPDoc ones (have opening parenthesis after it's name)

Technically ones that don't have opening parenthesis aren't strictly PHPDoc ones, but still.

The problem I'm facing is DocBlock tag (everything that starts with @) indentation due PHP_CodeSniffer validation (see squizlabs/PHP_CodeSniffer#343).

The DocBlock that triggers an error for PHP_CodeSniffer:

/**
 * Annotation for describing element selector in Selenium style.
 *
 * @link http://bit.ly/qa-tools-find-by-annotation
 * @usage('class'=>true, 'property'=>true, 'inherited'=>true, 'multiple'=>true)
 */

The proposed DocBlock that won't trigger an error for PHP_CodeSniffer, but will trigger an exception for "php-annotations":

/**
 * Annotation for describing element selector in Selenium style.
 *
 * @link     http://bit.ly/qa-tools-find-by-annotation
 * @usage    ('class'=>true, 'property'=>true, 'inherited'=>true, 'multiple'=>true)
 * @internal
 */

Basically what we should allow to do is having variable number of whitespaces after @tagname and opening parenthesis without immediately considering an annotation as PHPDoc one and throwing following exception:

Annotation type 'NoteAnnotation' does not support PHP-DOC style syntax (because it does not implement the mindplay\annotations\IAnnotationParser interface)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions