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

Breadcrumb

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

function QuoteAwareConstExprStringNode::__toString

Overrides ConstExprStringNode::__toString

File

vendor/phpstan/phpdoc-parser/src/Ast/ConstExpr/QuoteAwareConstExprStringNode.php, line 37

Class

QuoteAwareConstExprStringNode

Namespace

PHPStan\PhpDocParser\Ast\ConstExpr

Code

public function __toString() : string {
    if ($this->quoteType === self::SINGLE_QUOTED) {
        // from https://github.com/nikic/PHP-Parser/blob/0ffddce52d816f72d0efc4d9b02e276d3309ef01/lib/PhpParser/PrettyPrinter/Standard.php#L1007
        return sprintf("'%s'", addcslashes($this->value, '\'\\'));
    }
    // from https://github.com/nikic/PHP-Parser/blob/0ffddce52d816f72d0efc4d9b02e276d3309ef01/lib/PhpParser/PrettyPrinter/Standard.php#L1010-L1040
    return sprintf('"%s"', $this->escapeDoubleQuotedString());
}

API Navigation

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