Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ColumnDefinitionParser #299

Merged
merged 8 commits into from
Jan 22, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
rearrange methods
Tigrov committed Jan 18, 2025
commit 752248246ec140b45e1ceba4c38978121fa006c6
10 changes: 5 additions & 5 deletions src/Column/ColumnDefinitionBuilder.php
Original file line number Diff line number Diff line change
@@ -51,11 +51,6 @@ public function build(ColumnInterface $column): string
. $this->buildExtra($column);
}

protected function isAllowSize(string $dbType): bool
{
return in_array(strtolower(preg_replace('/\([^)]+\)/', '', $dbType)), self::TYPES_WITH_SIZE, true);
}

protected function buildOnDelete(string $onDelete): string
{
return match ($onDelete = strtoupper($onDelete)) {
@@ -110,4 +105,9 @@ protected function getDefaultUuidExpression(): string
{
return 'sys_guid()';
}

protected function isAllowSize(string $dbType): bool
{
return in_array(strtolower(preg_replace('/\([^)]+\)/', '', $dbType)), self::TYPES_WITH_SIZE, true);
}
}

Unchanged files with check annotations Beta

? $this->skipQuotedWithQ()
: null,
'-' => $this->sql[$this->position] === '-'
? ++$this->position && $this->skipToAfterChar("\n")

Check warning on line 29 in src/SqlParser.php

GitHub Actions / PHP 8.3-ubuntu-latest

Escaped Mutant for Mutator "Increment": --- Original +++ New @@ @@ '"' => $this->skipToAfterChar('"'), "'" => $this->skipQuotedWithoutEscape($this->sql[$pos]), 'q', 'Q' => $this->sql[$this->position] === "'" ? $this->skipQuotedWithQ() : null, - '-' => $this->sql[$this->position] === '-' ? ++$this->position && $this->skipToAfterChar("\n") : null, + '-' => $this->sql[$this->position] === '-' ? --$this->position && $this->skipToAfterChar("\n") : null, '/' => $this->sql[$this->position] === '*' ? ++$this->position && $this->skipToAfterString('*/') : null, default => null, };

Check warning on line 29 in src/SqlParser.php

GitHub Actions / PHP 8.3-ubuntu-latest

Escaped Mutant for Mutator "LogicalAndNegation": --- Original +++ New @@ @@ '"' => $this->skipToAfterChar('"'), "'" => $this->skipQuotedWithoutEscape($this->sql[$pos]), 'q', 'Q' => $this->sql[$this->position] === "'" ? $this->skipQuotedWithQ() : null, - '-' => $this->sql[$this->position] === '-' ? ++$this->position && $this->skipToAfterChar("\n") : null, + '-' => $this->sql[$this->position] === '-' ? !(++$this->position && $this->skipToAfterChar("\n")) : null, '/' => $this->sql[$this->position] === '*' ? ++$this->position && $this->skipToAfterString('*/') : null, default => null, };

Check warning on line 29 in src/SqlParser.php

GitHub Actions / PHP 8.3-ubuntu-latest

Escaped Mutant for Mutator "LogicalAndSingleSubExprNegation": --- Original +++ New @@ @@ '"' => $this->skipToAfterChar('"'), "'" => $this->skipQuotedWithoutEscape($this->sql[$pos]), 'q', 'Q' => $this->sql[$this->position] === "'" ? $this->skipQuotedWithQ() : null, - '-' => $this->sql[$this->position] === '-' ? ++$this->position && $this->skipToAfterChar("\n") : null, + '-' => $this->sql[$this->position] === '-' ? ++$this->position && !$this->skipToAfterChar("\n") : null, '/' => $this->sql[$this->position] === '*' ? ++$this->position && $this->skipToAfterString('*/') : null, default => null, };
: null,
'/' => $this->sql[$this->position] === '*'
? ++$this->position && $this->skipToAfterString('*/')

Check warning on line 32 in src/SqlParser.php

GitHub Actions / PHP 8.3-ubuntu-latest

Escaped Mutant for Mutator "Increment": --- Original +++ New @@ @@ "'" => $this->skipQuotedWithoutEscape($this->sql[$pos]), 'q', 'Q' => $this->sql[$this->position] === "'" ? $this->skipQuotedWithQ() : null, '-' => $this->sql[$this->position] === '-' ? ++$this->position && $this->skipToAfterChar("\n") : null, - '/' => $this->sql[$this->position] === '*' ? ++$this->position && $this->skipToAfterString('*/') : null, + '/' => $this->sql[$this->position] === '*' ? --$this->position && $this->skipToAfterString('*/') : null, default => null, }; if ($result !== null) {

Check warning on line 32 in src/SqlParser.php

GitHub Actions / PHP 8.3-ubuntu-latest

Escaped Mutant for Mutator "LogicalAndNegation": --- Original +++ New @@ @@ "'" => $this->skipQuotedWithoutEscape($this->sql[$pos]), 'q', 'Q' => $this->sql[$this->position] === "'" ? $this->skipQuotedWithQ() : null, '-' => $this->sql[$this->position] === '-' ? ++$this->position && $this->skipToAfterChar("\n") : null, - '/' => $this->sql[$this->position] === '*' ? ++$this->position && $this->skipToAfterString('*/') : null, + '/' => $this->sql[$this->position] === '*' ? !(++$this->position && $this->skipToAfterString('*/')) : null, default => null, }; if ($result !== null) {

Check warning on line 32 in src/SqlParser.php

GitHub Actions / PHP 8.3-ubuntu-latest

Escaped Mutant for Mutator "LogicalAndSingleSubExprNegation": --- Original +++ New @@ @@ "'" => $this->skipQuotedWithoutEscape($this->sql[$pos]), 'q', 'Q' => $this->sql[$this->position] === "'" ? $this->skipQuotedWithQ() : null, '-' => $this->sql[$this->position] === '-' ? ++$this->position && $this->skipToAfterChar("\n") : null, - '/' => $this->sql[$this->position] === '*' ? ++$this->position && $this->skipToAfterString('*/') : null, + '/' => $this->sql[$this->position] === '*' ? ++$this->position && !$this->skipToAfterString('*/') : null, default => null, }; if ($result !== null) {
: null,
default => null,
};
*/
private function skipQuotedWithQ(): void
{
$endChar = match ($this->sql[++$this->position]) {

Check warning on line 52 in src/SqlParser.php

GitHub Actions / PHP 8.3-ubuntu-latest

Escaped Mutant for Mutator "MatchArmRemoval": --- Original +++ New @@ @@ { $endChar = match ($this->sql[++$this->position]) { '[' => ']', - '<' => '>', '{' => '}', '(' => ')', default => $this->sql[$this->position],

Check warning on line 52 in src/SqlParser.php

GitHub Actions / PHP 8.3-ubuntu-latest

Escaped Mutant for Mutator "MatchArmRemoval": --- Original +++ New @@ @@ $endChar = match ($this->sql[++$this->position]) { '[' => ']', '<' => '>', - '{' => '}', '(' => ')', default => $this->sql[$this->position], };

Check warning on line 52 in src/SqlParser.php

GitHub Actions / PHP 8.3-ubuntu-latest

Escaped Mutant for Mutator "MatchArmRemoval": --- Original +++ New @@ @@ '[' => ']', '<' => '>', '{' => '}', - '(' => ')', default => $this->sql[$this->position], }; ++$this->position;
'[' => ']',
'<' => '>',
'{' => '}',
$this->prepare(false);
/** @psalm-var array<string, array{column: string, value: mixed, dataType: DataType::*, size: int}> $returnParams */
foreach ($returnParams as $name => &$value) {

Check failure on line 69 in src/Command.php

GitHub Actions / PHP 8.1

UndefinedDocblockClass

src/Command.php:69:35: UndefinedDocblockClass: Docblock-defined class, interface or enum named Yiisoft\Db\Command\DataType does not exist (see https://psalm.dev/200)

Check failure on line 69 in src/Command.php

GitHub Actions / PHP 8.1

UndefinedDocblockClass

src/Command.php:69:45: UndefinedDocblockClass: Docblock-defined class, interface or enum named Yiisoft\Db\Command\DataType does not exist (see https://psalm.dev/200)
$this->bindParam($name, $value['value'], $value['dataType'], $value['size']);

Check failure on line 70 in src/Command.php

GitHub Actions / PHP 8.1

InvalidArgument

src/Command.php:70:54: InvalidArgument: Argument 3 of Yiisoft\Db\Oracle\Command::bindParam expects 0|1|2|3|4|5|null, but Yiisoft\Db\Command\DataType::* provided (see https://psalm.dev/004)
}
unset($value);