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

Breadcrumb

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

class FixerHelper

@internal

Hierarchy

  • class \SlevomatCodingStandard\Helpers\FixerHelper

Expanded class hierarchy of FixerHelper

86 files declare their use of FixerHelper
AbstractControlStructureSpacing.php in vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/ControlStructures/AbstractControlStructureSpacing.php
AbstractPropertyConstantAndEnumCaseSpacing.php in vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Classes/AbstractPropertyConstantAndEnumCaseSpacing.php
AbstractRequireOneLineDocComment.php in vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Commenting/AbstractRequireOneLineDocComment.php
AlphabeticallySortedByKeysSniff.php in vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Arrays/AlphabeticallySortedByKeysSniff.php
AlphabeticallySortedUsesSniff.php in vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Namespaces/AlphabeticallySortedUsesSniff.php

... See full list

File

vendor/slevomat/coding-standard/SlevomatCodingStandard/Helpers/FixerHelper.php, line 12

Namespace

SlevomatCodingStandard\Helpers
View source
class FixerHelper {
    public static function change(File $phpcsFile, int $startPointer, int $endPointer, string $content) : void {
        self::removeBetweenIncluding($phpcsFile, $startPointer, $endPointer);
        $phpcsFile->fixer
            ->replaceToken($startPointer, $content);
    }
    public static function removeBetween(File $phpcsFile, int $startPointer, int $endPointer) : void {
        self::removeBetweenIncluding($phpcsFile, $startPointer + 1, $endPointer - 1);
    }
    public static function removeBetweenIncluding(File $phpcsFile, int $startPointer, int $endPointer) : void {
        for ($i = $startPointer; $i <= $endPointer; $i++) {
            $phpcsFile->fixer
                ->replaceToken($i, '');
        }
    }
    public static function removeWhitespaceBefore(File $phpcsFile, int $pointer) : void {
        for ($i = $pointer - 1; $i > 0; $i--) {
            if (preg_match('~^\\s+$~', $phpcsFile->fixer
                ->getTokenContent($i)) === 0) {
                break;
            }
            $phpcsFile->fixer
                ->replaceToken($i, '');
        }
    }
    public static function removeWhitespaceAfter(File $phpcsFile, int $pointer) : void {
        for ($i = $pointer + 1; $i < count($phpcsFile->getTokens()); $i++) {
            if (preg_match('~^\\s+$~', $phpcsFile->fixer
                ->getTokenContent($i)) === 0) {
                break;
            }
            $phpcsFile->fixer
                ->replaceToken($i, '');
        }
    }

}

Members

Title Sort descending Modifiers Object type Summary
FixerHelper::change public static function
FixerHelper::removeBetween public static function
FixerHelper::removeBetweenIncluding public static function
FixerHelper::removeWhitespaceAfter public static function
FixerHelper::removeWhitespaceBefore public static function

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal