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

Breadcrumb

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

function IndentationHelper::convertTabsToSpaces

4 calls to IndentationHelper::convertTabsToSpaces()
AbstractLineCall::getLineStart in vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Functions/AbstractLineCall.php
AbstractLineCondition::getLineStart in vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/ControlStructures/AbstractLineCondition.php
AbstractMethodSignature::getSignatureWithoutTabs in vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Classes/AbstractMethodSignature.php
RequireMultiLineCallSniff::process in vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Functions/RequireMultiLineCallSniff.php
* @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint *

File

vendor/slevomat/coding-standard/SlevomatCodingStandard/Helpers/IndentationHelper.php, line 95

Class

IndentationHelper
@internal

Namespace

SlevomatCodingStandard\Helpers

Code

public static function convertTabsToSpaces(File $phpcsFile, string $code) : string {
    return preg_replace_callback('~^(\\t+)~', static function (array $matches) use ($phpcsFile) : string {
        $indentation = str_repeat(' ', $phpcsFile->config->tabWidth !== 0 ? $phpcsFile->config->tabWidth : self::DEFAULT_INDENTATION_WIDTH);
        return str_repeat($indentation, strlen($matches[1]));
    }, $code);
}

API Navigation

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