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

Breadcrumb

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

function AbstractPatternSniff::prepareError

Prepares an error for the specified patternCode.

Parameters

string $found The actual found string in the code.:

string $patternCode The expected pattern code.:

Return value

string The error message.

1 call to AbstractPatternSniff::prepareError()
AbstractPatternSniff::processPattern in vendor/squizlabs/php_codesniffer/src/Sniffs/AbstractPatternSniff.php
Processes the pattern and verifies the code at $stackPtr.

File

vendor/squizlabs/php_codesniffer/src/Sniffs/AbstractPatternSniff.php, line 706

Class

AbstractPatternSniff

Namespace

PHP_CodeSniffer\Sniffs

Code

protected function prepareError($found, $patternCode) {
    $found = str_replace("\r\n", '\\n', $found);
    $found = str_replace("\n", '\\n', $found);
    $found = str_replace("\r", '\\n', $found);
    $found = str_replace("\t", '\\t', $found);
    $found = str_replace('EOL', '\\n', $found);
    $expected = str_replace('EOL', '\\n', $patternCode);
    $error = "Expected \"{$expected}\"; found \"{$found}\"";
    return $error;
}

API Navigation

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