Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. RequireOneLinePropertyDocCommentSniff.php

function RequireOneLinePropertyDocCommentSniff::process

* @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint *

Parameters

int $docCommentStartPointer:

Overrides AbstractRequireOneLineDocComment::process

File

vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Commenting/RequireOneLinePropertyDocCommentSniff.php, line 21

Class

RequireOneLinePropertyDocCommentSniff

Namespace

SlevomatCodingStandard\Sniffs\Commenting

Code

public function process(File $phpcsFile, $docCommentStartPointer) : void {
    $propertyPointer = TokenHelper::findNext($phpcsFile, T_VARIABLE, $docCommentStartPointer + 1);
    if ($propertyPointer === null) {
        return;
    }
    // Not a property
    if (!PropertyHelper::isProperty($phpcsFile, $propertyPointer)) {
        return;
    }
    // Check that doc comment belongs to the found property
    $propertyDocCommentStartPointer = DocCommentHelper::findDocCommentOpenPointer($phpcsFile, $propertyPointer);
    if ($propertyDocCommentStartPointer !== $docCommentStartPointer) {
        return;
    }
    // Only validate properties without description
    if (DocCommentHelper::hasDocCommentDescription($phpcsFile, $propertyPointer)) {
        return;
    }
    parent::process($phpcsFile, $docCommentStartPointer);
}
RSS feed
Powered by Drupal