Fix bin/publish: copy docs.dist from project root

Fix bin/publish: use correct .env path for rspade_system
Fix bin/publish script: prevent grep exit code 1 from terminating script

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
root
2025-10-21 02:08:33 +00:00
commit f6fac6c4bc
79758 changed files with 10547827 additions and 0 deletions

View File

@@ -0,0 +1,168 @@
<?php
declare(strict_types=1);
/*
* This file is part of PHP CS Fixer.
*
* (c) Fabien Potencier <fabien@symfony.com>
* Dariusz Rumiński <dariusz.ruminski@gmail.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace PhpCsFixer\Doctrine\Annotation;
use PhpCsFixer\Preg;
/**
* Copyright (c) 2006-2013 Doctrine Project.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* @internal
*/
final class DocLexer
{
public const T_NONE = 1;
public const T_INTEGER = 2;
public const T_STRING = 3;
public const T_FLOAT = 4;
// All tokens that are also identifiers should be >= 100
public const T_IDENTIFIER = 100;
public const T_AT = 101;
public const T_CLOSE_CURLY_BRACES = 102;
public const T_CLOSE_PARENTHESIS = 103;
public const T_COMMA = 104;
public const T_EQUALS = 105;
public const T_NAMESPACE_SEPARATOR = 107;
public const T_OPEN_CURLY_BRACES = 108;
public const T_OPEN_PARENTHESIS = 109;
public const T_COLON = 112;
public const T_MINUS = 113;
/** @var array<string, self::T_*> */
private array $noCase = [
'@' => self::T_AT,
',' => self::T_COMMA,
'(' => self::T_OPEN_PARENTHESIS,
')' => self::T_CLOSE_PARENTHESIS,
'{' => self::T_OPEN_CURLY_BRACES,
'}' => self::T_CLOSE_CURLY_BRACES,
'=' => self::T_EQUALS,
':' => self::T_COLON,
'-' => self::T_MINUS,
'\\' => self::T_NAMESPACE_SEPARATOR,
];
/** @var list<Token> */
private array $tokens = [];
private int $position = 0;
private int $peek = 0;
private ?string $regex = null;
public function setInput(string $input): void
{
$this->tokens = [];
$this->reset();
$this->scan($input);
}
public function reset(): void
{
$this->peek = 0;
$this->position = 0;
}
public function peek(): ?Token
{
if (isset($this->tokens[$this->position + $this->peek])) {
return $this->tokens[$this->position + $this->peek++];
}
return null;
}
/**
* @return list<string>
*/
private function getCatchablePatterns(): array
{
return [
'[a-z_\\\][a-z0-9_\:\\\]*[a-z_][a-z0-9_]*',
'(?:[+-]?[0-9]+(?:[\.][0-9]+)*)(?:[eE][+-]?[0-9]+)?',
'"(?:""|[^"])*+"',
];
}
/**
* @return list<string>
*/
private function getNonCatchablePatterns(): array
{
return ['\s+', '\*+', '(.)'];
}
/**
* @return self::T_*
*/
private function getType(string &$value): int
{
$type = self::T_NONE;
if ('"' === $value[0]) {
$value = str_replace('""', '"', substr($value, 1, \strlen($value) - 2));
return self::T_STRING;
}
if (isset($this->noCase[$value])) {
return $this->noCase[$value];
}
if ('_' === $value[0] || '\\' === $value[0] || !Preg::match('/[^A-Za-z]/', $value[0])) {
return self::T_IDENTIFIER;
}
if (is_numeric($value)) {
return str_contains($value, '.') || false !== stripos($value, 'e')
? self::T_FLOAT : self::T_INTEGER;
}
return $type;
}
private function scan(string $input): void
{
$this->regex ??= \sprintf(
'/(%s)|%s/%s',
implode(')|(', $this->getCatchablePatterns()),
implode('|', $this->getNonCatchablePatterns()),
'iu'
);
$flags = \PREG_SPLIT_NO_EMPTY | \PREG_SPLIT_DELIM_CAPTURE | \PREG_SPLIT_OFFSET_CAPTURE;
$matches = Preg::split($this->regex, $input, -1, $flags);
foreach ($matches as $match) {
// Must remain before 'value' assignment since it can change content
$firstMatch = $match[0];
$type = $this->getType($firstMatch);
$this->tokens[] = new Token($type, $firstMatch, (int) $match[1]);
}
}
}

View File

@@ -0,0 +1,87 @@
<?php
declare(strict_types=1);
/*
* This file is part of PHP CS Fixer.
*
* (c) Fabien Potencier <fabien@symfony.com>
* Dariusz Rumiński <dariusz.ruminski@gmail.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace PhpCsFixer\Doctrine\Annotation;
/**
* A Doctrine annotation token.
*
* @internal
*/
final class Token
{
private int $type;
private string $content;
private int $position;
/**
* @param int $type The type
* @param string $content The content
*/
public function __construct(int $type = DocLexer::T_NONE, string $content = '', int $position = 0)
{
$this->type = $type;
$this->content = $content;
$this->position = $position;
}
public function getType(): int
{
return $this->type;
}
public function setType(int $type): void
{
$this->type = $type;
}
public function getContent(): string
{
return $this->content;
}
public function setContent(string $content): void
{
$this->content = $content;
}
public function getPosition(): int
{
return $this->position;
}
/**
* Returns whether the token type is one of the given types.
*
* @param int|list<int> $types
*/
public function isType($types): bool
{
if (!\is_array($types)) {
$types = [$types];
}
return \in_array($this->getType(), $types, true);
}
/**
* Overrides the content with an empty string.
*/
public function clear(): void
{
$this->setContent('');
}
}

View File

@@ -0,0 +1,295 @@
<?php
declare(strict_types=1);
/*
* This file is part of PHP CS Fixer.
*
* (c) Fabien Potencier <fabien@symfony.com>
* Dariusz Rumiński <dariusz.ruminski@gmail.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace PhpCsFixer\Doctrine\Annotation;
use PhpCsFixer\Preg;
use PhpCsFixer\Tokenizer\Token as PhpToken;
/**
* A list of Doctrine annotation tokens.
*
* @internal
*
* @extends \SplFixedArray<Token>
*/
final class Tokens extends \SplFixedArray
{
/**
* @param list<string> $ignoredTags
*
* @throws \InvalidArgumentException
*/
public static function createFromDocComment(PhpToken $input, array $ignoredTags = []): self
{
if (!$input->isGivenKind(\T_DOC_COMMENT)) {
throw new \InvalidArgumentException('Input must be a T_DOC_COMMENT token.');
}
$tokens = [];
$content = $input->getContent();
$ignoredTextPosition = 0;
$currentPosition = 0;
$token = null;
while (false !== $nextAtPosition = strpos($content, '@', $currentPosition)) {
if (0 !== $nextAtPosition && !Preg::match('/\s/', $content[$nextAtPosition - 1])) {
$currentPosition = $nextAtPosition + 1;
continue;
}
$lexer = new DocLexer();
$lexer->setInput(substr($content, $nextAtPosition));
$scannedTokens = [];
$index = 0;
$nbScannedTokensToUse = 0;
$nbScopes = 0;
while (null !== $token = $lexer->peek()) {
if (0 === $index && !$token->isType(DocLexer::T_AT)) {
break;
}
if (1 === $index) {
if (!$token->isType(DocLexer::T_IDENTIFIER) || \in_array($token->getContent(), $ignoredTags, true)) {
break;
}
$nbScannedTokensToUse = 2;
}
if ($index >= 2 && 0 === $nbScopes && !$token->isType([DocLexer::T_NONE, DocLexer::T_OPEN_PARENTHESIS])) {
break;
}
$scannedTokens[] = $token;
if ($token->isType(DocLexer::T_OPEN_PARENTHESIS)) {
++$nbScopes;
} elseif ($token->isType(DocLexer::T_CLOSE_PARENTHESIS)) {
if (0 === --$nbScopes) {
$nbScannedTokensToUse = \count($scannedTokens);
break;
}
}
++$index;
}
if (0 !== $nbScopes) {
break;
}
if (0 !== $nbScannedTokensToUse) {
$ignoredTextLength = $nextAtPosition - $ignoredTextPosition;
if (0 !== $ignoredTextLength) {
$tokens[] = new Token(DocLexer::T_NONE, substr($content, $ignoredTextPosition, $ignoredTextLength));
}
$lastTokenEndIndex = 0;
foreach (\array_slice($scannedTokens, 0, $nbScannedTokensToUse) as $scannedToken) {
$token = $scannedToken->isType(DocLexer::T_STRING)
? new Token(
$scannedToken->getType(),
'"'.str_replace('"', '""', $scannedToken->getContent()).'"',
$scannedToken->getPosition()
)
: $scannedToken;
$missingTextLength = $token->getPosition() - $lastTokenEndIndex;
if ($missingTextLength > 0) {
$tokens[] = new Token(DocLexer::T_NONE, substr(
$content,
$nextAtPosition + $lastTokenEndIndex,
$missingTextLength
));
}
$tokens[] = new Token($token->getType(), $token->getContent());
$lastTokenEndIndex = $token->getPosition() + \strlen($token->getContent());
}
$currentPosition = $ignoredTextPosition = $nextAtPosition + $token->getPosition() + \strlen($token->getContent());
} else {
$currentPosition = $nextAtPosition + 1;
}
}
if ($ignoredTextPosition < \strlen($content)) {
$tokens[] = new Token(DocLexer::T_NONE, substr($content, $ignoredTextPosition));
}
return self::fromArray($tokens);
}
/**
* Create token collection from array.
*
* @param array<int, Token> $array the array to import
* @param ?bool $saveIndices save the numeric indices used in the original array, default is yes
*/
public static function fromArray($array, $saveIndices = null): self
{
$tokens = new self(\count($array));
if (null === $saveIndices || $saveIndices) {
foreach ($array as $key => $val) {
$tokens[$key] = $val;
}
} else {
$index = 0;
foreach ($array as $val) {
$tokens[$index++] = $val;
}
}
return $tokens;
}
/**
* Returns the index of the closest next token that is neither a comment nor a whitespace token.
*/
public function getNextMeaningfulToken(int $index): ?int
{
return $this->getMeaningfulTokenSibling($index, 1);
}
/**
* Returns the index of the last token that is part of the annotation at the given index.
*/
public function getAnnotationEnd(int $index): ?int
{
$currentIndex = null;
if (isset($this[$index + 2])) {
if ($this[$index + 2]->isType(DocLexer::T_OPEN_PARENTHESIS)) {
$currentIndex = $index + 2;
} elseif (
isset($this[$index + 3])
&& $this[$index + 2]->isType(DocLexer::T_NONE)
&& $this[$index + 3]->isType(DocLexer::T_OPEN_PARENTHESIS)
&& Preg::match('/^(\R\s*\*\s*)*\s*$/', $this[$index + 2]->getContent())
) {
$currentIndex = $index + 3;
}
}
if (null !== $currentIndex) {
$level = 0;
for ($max = \count($this); $currentIndex < $max; ++$currentIndex) {
if ($this[$currentIndex]->isType(DocLexer::T_OPEN_PARENTHESIS)) {
++$level;
} elseif ($this[$currentIndex]->isType(DocLexer::T_CLOSE_PARENTHESIS)) {
--$level;
}
if (0 === $level) {
return $currentIndex;
}
}
return null;
}
return $index + 1;
}
/**
* Returns the code from the tokens.
*/
public function getCode(): string
{
$code = '';
foreach ($this as $token) {
$code .= $token->getContent();
}
return $code;
}
/**
* Inserts a token at the given index.
*/
public function insertAt(int $index, Token $token): void
{
$this->setSize($this->getSize() + 1);
for ($i = $this->getSize() - 1; $i > $index; --$i) {
$this[$i] = $this[$i - 1] ?? new Token();
}
$this[$index] = $token;
}
public function offsetSet($index, $token): void
{
if (null === $token) {
throw new \InvalidArgumentException('Token must be an instance of PhpCsFixer\Doctrine\Annotation\Token, "null" given.');
}
if (!$token instanceof Token) {
$type = \gettype($token);
if ('object' === $type) {
$type = \get_class($token);
}
throw new \InvalidArgumentException(\sprintf('Token must be an instance of PhpCsFixer\Doctrine\Annotation\Token, "%s" given.', $type));
}
parent::offsetSet($index, $token);
}
/**
* @param mixed $index
*
* @throws \OutOfBoundsException
*/
public function offsetUnset($index): void
{
if (!isset($this[$index])) {
throw new \OutOfBoundsException(\sprintf('Index "%s" is invalid or does not exist.', $index));
}
$max = \count($this) - 1;
while ($index < $max) {
$this[$index] = $this[$index + 1];
++$index;
}
parent::offsetUnset($index);
$this->setSize($max);
}
private function getMeaningfulTokenSibling(int $index, int $direction): ?int
{
while (true) {
$index += $direction;
if (!$this->offsetExists($index)) {
break;
}
if (!$this[$index]->isType(DocLexer::T_NONE)) {
return $index;
}
}
return null;
}
}