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

Breadcrumb

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

function AttributeEmulator::preprocessCode

Overrides TokenEmulator::preprocessCode

File

vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/AttributeEmulator.php, line 39

Class

AttributeEmulator

Namespace

PhpParser\Lexer\TokenEmulator

Code

public function preprocessCode(string $code, array &$patches) : string {
    $pos = 0;
    while (false !== ($pos = strpos($code, '#[', $pos))) {
        // Replace #[ with %[
        $code[$pos] = '%';
        $patches[] = [
            $pos,
            'replace',
            '#',
        ];
        $pos += 2;
    }
    return $code;
}

API Navigation

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