This commit is contained in:
Paolo A
2024-08-13 13:44:16 +00:00
parent 1bbb23088d
commit e796d76612
4001 changed files with 30101 additions and 40075 deletions

View File

@@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
/*
* This file is part of the league/commonmark package.
*
@@ -14,58 +16,50 @@
namespace League\CommonMark\Delimiter;
use League\CommonMark\Inline\Element\AbstractStringContainer;
use League\CommonMark\Node\Inline\AbstractStringContainer;
final class Delimiter implements DelimiterInterface
{
/** @var string */
private $char;
/** @psalm-readonly */
private string $char;
/** @var int */
private $length;
/** @psalm-readonly-allow-private-mutation */
private int $length;
/** @var int */
private $originalLength;
/** @psalm-readonly */
private int $originalLength;
/** @var AbstractStringContainer */
private $inlineNode;
/** @psalm-readonly */
private AbstractStringContainer $inlineNode;
/** @var DelimiterInterface|null */
private $previous;
/** @psalm-readonly-allow-private-mutation */
private ?DelimiterInterface $previous = null;
/** @var DelimiterInterface|null */
private $next;
/** @psalm-readonly-allow-private-mutation */
private ?DelimiterInterface $next = null;
/** @var bool */
private $canOpen;
/** @psalm-readonly */
private bool $canOpen;
/** @var bool */
private $canClose;
/** @psalm-readonly */
private bool $canClose;
/** @var bool */
private $active;
/** @psalm-readonly-allow-private-mutation */
private bool $active;
/** @var int|null */
private $index;
/** @psalm-readonly */
private ?int $index = null;
/**
* @param string $char
* @param int $numDelims
* @param AbstractStringContainer $node
* @param bool $canOpen
* @param bool $canClose
* @param int|null $index
*/
public function __construct(string $char, int $numDelims, AbstractStringContainer $node, bool $canOpen, bool $canClose, ?int $index = null)
{
$this->char = $char;
$this->length = $numDelims;
$this->char = $char;
$this->length = $numDelims;
$this->originalLength = $numDelims;
$this->inlineNode = $node;
$this->canOpen = $canOpen;
$this->canClose = $canClose;
$this->active = true;
$this->index = $index;
$this->inlineNode = $node;
$this->canOpen = $canOpen;
$this->canClose = $canClose;
$this->active = true;
$this->index = $index;
}
public function canClose(): bool
@@ -73,16 +67,6 @@ final class Delimiter implements DelimiterInterface
return $this->canClose;
}
/**
* @param bool $canClose
*
* @return void
*/
public function setCanClose(bool $canClose)
{
$this->canClose = $canClose;
}
public function canOpen(): bool
{
return $this->canOpen;
@@ -93,7 +77,7 @@ final class Delimiter implements DelimiterInterface
return $this->active;
}
public function setActive(bool $active)
public function setActive(bool $active): void
{
$this->active = $active;
}
@@ -113,7 +97,7 @@ final class Delimiter implements DelimiterInterface
return $this->next;
}
public function setNext(?DelimiterInterface $next)
public function setNext(?DelimiterInterface $next): void
{
$this->next = $next;
}
@@ -123,7 +107,7 @@ final class Delimiter implements DelimiterInterface
return $this->length;
}
public function setLength(int $length)
public function setLength(int $length): void
{
$this->length = $length;
}
@@ -143,10 +127,8 @@ final class Delimiter implements DelimiterInterface
return $this->previous;
}
public function setPrevious(?DelimiterInterface $previous): DelimiterInterface
public function setPrevious(?DelimiterInterface $previous): void
{
$this->previous = $previous;
return $this;
}
}