class DoctrineConstExprStringNode
Hierarchy
- class \PHPStan\PhpDocParser\Ast\ConstExpr\ConstExprStringNode implements \PHPStan\PhpDocParser\Ast\ConstExpr\ConstExprNode uses \PHPStan\PhpDocParser\Ast\NodeAttributes
- class \PHPStan\PhpDocParser\Ast\ConstExpr\DoctrineConstExprStringNode extends \PHPStan\PhpDocParser\Ast\ConstExpr\ConstExprStringNode uses \PHPStan\PhpDocParser\Ast\NodeAttributes
Expanded class hierarchy of DoctrineConstExprStringNode
File
-
vendor/
phpstan/ phpdoc-parser/ src/ Ast/ ConstExpr/ DoctrineConstExprStringNode.php, line 11
Namespace
PHPStan\PhpDocParser\Ast\ConstExprView source
class DoctrineConstExprStringNode extends ConstExprStringNode {
use NodeAttributes;
/** @var string */
public $value;
public function __construct(string $value) {
parent::__construct($value);
$this->value = $value;
}
public function __toString() : string {
return self::escape($this->value);
}
public static function unescape(string $value) : string {
// from https://github.com/doctrine/annotations/blob/a9ec7af212302a75d1f92fa65d3abfbd16245a2a/lib/Doctrine/Common/Annotations/DocLexer.php#L103-L107
return str_replace('""', '"', substr($value, 1, strlen($value) - 2));
}
private static function escape(string $value) : string {
// from https://github.com/phpstan/phpdoc-parser/issues/205#issuecomment-1662323656
return sprintf('"%s"', str_replace('"', '""', $value));
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title |
---|---|---|---|---|
DoctrineConstExprStringNode::$value | public | property | @var string | Overrides ConstExprStringNode::$value |
DoctrineConstExprStringNode::escape | private static | function | ||
DoctrineConstExprStringNode::unescape | public static | function | ||
DoctrineConstExprStringNode::__construct | public | function | Overrides ConstExprStringNode::__construct | |
DoctrineConstExprStringNode::__toString | public | function | Overrides ConstExprStringNode::__toString | |
NodeAttributes::$attributes | private | property | @var array<string, mixed> | |
NodeAttributes::getAttribute | public | function | * | |
NodeAttributes::hasAttribute | public | function | ||
NodeAttributes::setAttribute | public | function | * |