Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
129 changes: 128 additions & 1 deletion psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="6.4.0@04f312ac6ea48ba1c3e5db4d815bf6d74641c0ee">
<files psalm-version="6.12.1@e71404b0465be25cf7f8a631b298c01c5ddd864f">
<file src="src/Atomizer/Renderer.php">
<ArgumentTypeCoercion>
<code><![CDATA[$comparator]]></code>
Expand All @@ -12,6 +12,12 @@
<code><![CDATA[$comparator]]></code>
<code><![CDATA[$comparator]]></code>
</ArgumentTypeCoercion>
<MissingOverrideAttribute>
<code><![CDATA[public function createTable(Method $method, AbstractTable $table): void]]></code>
<code><![CDATA[public function dropTable(Method $method, AbstractTable $table): void]]></code>
<code><![CDATA[public function revertTable(Method $method, AbstractTable $table): void]]></code>
<code><![CDATA[public function updateTable(Method $method, AbstractTable $table): void]]></code>
</MissingOverrideAttribute>
<MixedArgument>
<code><![CDATA[$pair[self::NEW_STATE]]]></code>
<code><![CDATA[$pair[self::NEW_STATE]]]></code>
Expand Down Expand Up @@ -65,6 +71,12 @@
<ArgumentTypeCoercion>
<code><![CDATA[$table]]></code>
</ArgumentTypeCoercion>
<MissingOverrideAttribute>
<code><![CDATA[public function execute(array $operations): void]]></code>
<code><![CDATA[public function getDatabase(): DatabaseInterface]]></code>
<code><![CDATA[public function getSchema(string $table): AbstractTable]]></code>
<code><![CDATA[public function getTable(string $table): TableInterface]]></code>
</MissingOverrideAttribute>
<MixedPropertyTypeCoercion>
<code><![CDATA[$this->schemas]]></code>
</MixedPropertyTypeCoercion>
Expand All @@ -88,10 +100,54 @@
<code><![CDATA[$this->config['table'] ?? 'migrations']]></code>
</MixedReturnStatement>
</file>
<file src="src/Exception/BlueprintException.php">
<ClassMustBeFinal>
<code><![CDATA[BlueprintException]]></code>
</ClassMustBeFinal>
</file>
<file src="src/Exception/CapsuleException.php">
<ClassMustBeFinal>
<code><![CDATA[CapsuleException]]></code>
</ClassMustBeFinal>
</file>
<file src="src/Exception/ContextException.php">
<ClassMustBeFinal>
<code><![CDATA[ContextException]]></code>
</ClassMustBeFinal>
</file>
<file src="src/Exception/Operation/ColumnException.php">
<ClassMustBeFinal>
<code><![CDATA[ColumnException]]></code>
</ClassMustBeFinal>
</file>
<file src="src/Exception/Operation/ForeignKeyException.php">
<ClassMustBeFinal>
<code><![CDATA[ForeignKeyException]]></code>
</ClassMustBeFinal>
</file>
<file src="src/Exception/Operation/IndexException.php">
<ClassMustBeFinal>
<code><![CDATA[IndexException]]></code>
</ClassMustBeFinal>
</file>
<file src="src/Exception/Operation/TableException.php">
<ClassMustBeFinal>
<code><![CDATA[TableException]]></code>
</ClassMustBeFinal>
</file>
<file src="src/Exception/RepositoryException.php">
<ClassMustBeFinal>
<code><![CDATA[RepositoryException]]></code>
</ClassMustBeFinal>
</file>
<file src="src/FileRepository.php">
<ArgumentTypeCoercion>
<code><![CDATA[$directory]]></code>
</ArgumentTypeCoercion>
<MissingOverrideAttribute>
<code><![CDATA[public function getMigrations(): array]]></code>
<code><![CDATA[public function registerMigration(string $name, string $class, ?string $body = null): string]]></code>
</MissingOverrideAttribute>
<MixedArgument>
<code><![CDATA[$directory]]></code>
</MixedArgument>
Expand All @@ -116,6 +172,12 @@
<LessSpecificReturnStatement>
<code><![CDATA[$this->capsule->getDatabase()]]></code>
</LessSpecificReturnStatement>
<MissingOverrideAttribute>
<code><![CDATA[public function getDatabase(): ?string]]></code>
<code><![CDATA[public function getState(): State]]></code>
<code><![CDATA[public function withCapsule(CapsuleInterface $capsule): MigrationInterface]]></code>
<code><![CDATA[public function withState(State $state): MigrationInterface]]></code>
</MissingOverrideAttribute>
<MixedReturnStatement>
<code><![CDATA[static::DATABASE]]></code>
</MixedReturnStatement>
Expand Down Expand Up @@ -199,15 +261,26 @@
<code><![CDATA[MigrationInterface]]></code>
</UnnecessaryVarAnnotation>
</file>
<file src="src/Operation/AbstractOperation.php">
<MissingOverrideAttribute>
<code><![CDATA[public function getTable(): string]]></code>
</MissingOverrideAttribute>
</file>
<file src="src/Operation/Column/Add.php">
<ArgumentTypeCoercion>
<code><![CDATA[$this->getTable()]]></code>
</ArgumentTypeCoercion>
<MissingOverrideAttribute>
<code><![CDATA[public function execute(CapsuleInterface $capsule): void]]></code>
</MissingOverrideAttribute>
</file>
<file src="src/Operation/Column/Alter.php">
<ArgumentTypeCoercion>
<code><![CDATA[$this->getTable()]]></code>
</ArgumentTypeCoercion>
<MissingOverrideAttribute>
<code><![CDATA[public function execute(CapsuleInterface $capsule): void]]></code>
</MissingOverrideAttribute>
</file>
<file src="src/Operation/Column/Column.php">
<ArgumentTypeCoercion>
Expand All @@ -230,13 +303,19 @@
<code><![CDATA[$this->getTable()]]></code>
<code><![CDATA[$this->name]]></code>
</ArgumentTypeCoercion>
<MissingOverrideAttribute>
<code><![CDATA[public function execute(CapsuleInterface $capsule): void]]></code>
</MissingOverrideAttribute>
</file>
<file src="src/Operation/Column/Rename.php">
<ArgumentTypeCoercion>
<code><![CDATA[$this->getTable()]]></code>
<code><![CDATA[$this->name]]></code>
<code><![CDATA[$this->newName]]></code>
</ArgumentTypeCoercion>
<MissingOverrideAttribute>
<code><![CDATA[public function execute(CapsuleInterface $capsule): void]]></code>
</MissingOverrideAttribute>
</file>
<file src="src/Operation/ForeignKey/Add.php">
<ArgumentTypeCoercion>
Expand All @@ -255,6 +334,9 @@
$this->getOption('update', ForeignKeyInterface::NO_ACTION),
)]]></code>
</InvalidArgument>
<MissingOverrideAttribute>
<code><![CDATA[public function execute(CapsuleInterface $capsule): void]]></code>
</MissingOverrideAttribute>
<MixedArgument>
<code><![CDATA[$fk]]></code>
<code><![CDATA[$this->getOption('delete', ForeignKeyInterface::NO_ACTION)]]></code>
Expand Down Expand Up @@ -295,6 +377,9 @@
$this->getOption('update', ForeignKeyInterface::NO_ACTION),
)]]></code>
</InvalidArgument>
<MissingOverrideAttribute>
<code><![CDATA[public function execute(CapsuleInterface $capsule): void]]></code>
</MissingOverrideAttribute>
<MixedArgument>
<code><![CDATA[$fk]]></code>
<code><![CDATA[$this->getOption('delete', ForeignKeyInterface::NO_ACTION)]]></code>
Expand All @@ -320,6 +405,9 @@
<ArgumentTypeCoercion>
<code><![CDATA[$this->getTable()]]></code>
</ArgumentTypeCoercion>
<MissingOverrideAttribute>
<code><![CDATA[public function execute(CapsuleInterface $capsule): void]]></code>
</MissingOverrideAttribute>
</file>
<file src="src/Operation/ForeignKey/ForeignKey.php">
<MixedArgumentTypeCoercion>
Expand All @@ -330,6 +418,9 @@
<ArgumentTypeCoercion>
<code><![CDATA[$this->getTable()]]></code>
</ArgumentTypeCoercion>
<MissingOverrideAttribute>
<code><![CDATA[public function execute(CapsuleInterface $capsule): void]]></code>
</MissingOverrideAttribute>
<MixedArgument>
<code><![CDATA[$this->getOption('name')]]></code>
<code><![CDATA[$this->getOption('unique', false)]]></code>
Expand All @@ -342,6 +433,9 @@
<ArgumentTypeCoercion>
<code><![CDATA[$this->getTable()]]></code>
</ArgumentTypeCoercion>
<MissingOverrideAttribute>
<code><![CDATA[public function execute(CapsuleInterface $capsule): void]]></code>
</MissingOverrideAttribute>
<MixedArgument>
<code><![CDATA[$this->getOption('unique', false)]]></code>
</MixedArgument>
Expand All @@ -353,6 +447,9 @@
<ArgumentTypeCoercion>
<code><![CDATA[$this->getTable()]]></code>
</ArgumentTypeCoercion>
<MissingOverrideAttribute>
<code><![CDATA[public function execute(CapsuleInterface $capsule): void]]></code>
</MissingOverrideAttribute>
<MixedArgumentTypeCoercion>
<code><![CDATA[$this->columns]]></code>
</MixedArgumentTypeCoercion>
Expand All @@ -361,43 +458,73 @@
<ArgumentTypeCoercion>
<code><![CDATA[$this->getTable()]]></code>
</ArgumentTypeCoercion>
<MissingOverrideAttribute>
<code><![CDATA[public function execute(CapsuleInterface $capsule): void]]></code>
</MissingOverrideAttribute>
<MixedAssignment>
<code><![CDATA[$database]]></code>
</MixedAssignment>
<UndefinedThisPropertyFetch>
<code><![CDATA[$this->database]]></code>
</UndefinedThisPropertyFetch>
</file>
<file src="src/Operation/Table/Drop.php">
<ArgumentTypeCoercion>
<code><![CDATA[$this->getTable()]]></code>
</ArgumentTypeCoercion>
<MissingOverrideAttribute>
<code><![CDATA[public function execute(CapsuleInterface $capsule): void]]></code>
</MissingOverrideAttribute>
<MixedAssignment>
<code><![CDATA[$database]]></code>
</MixedAssignment>
<UndefinedThisPropertyFetch>
<code><![CDATA[$this->database]]></code>
</UndefinedThisPropertyFetch>
</file>
<file src="src/Operation/Table/PrimaryKeys.php">
<ArgumentTypeCoercion>
<code><![CDATA[$this->getTable()]]></code>
</ArgumentTypeCoercion>
<MissingOverrideAttribute>
<code><![CDATA[public function execute(CapsuleInterface $capsule): void]]></code>
</MissingOverrideAttribute>
<MixedAssignment>
<code><![CDATA[$database]]></code>
</MixedAssignment>
<UndefinedThisPropertyFetch>
<code><![CDATA[$this->database]]></code>
</UndefinedThisPropertyFetch>
</file>
<file src="src/Operation/Table/Rename.php">
<ArgumentTypeCoercion>
<code><![CDATA[$this->getTable()]]></code>
<code><![CDATA[$this->newName]]></code>
<code><![CDATA[$this->newName]]></code>
</ArgumentTypeCoercion>
<MissingOverrideAttribute>
<code><![CDATA[public function execute(CapsuleInterface $capsule): void]]></code>
</MissingOverrideAttribute>
<MixedAssignment>
<code><![CDATA[$database]]></code>
</MixedAssignment>
<UndefinedThisPropertyFetch>
<code><![CDATA[$this->database]]></code>
</UndefinedThisPropertyFetch>
</file>
<file src="src/Operation/Table/Update.php">
<ArgumentTypeCoercion>
<code><![CDATA[$this->getTable()]]></code>
</ArgumentTypeCoercion>
<MissingOverrideAttribute>
<code><![CDATA[public function execute(CapsuleInterface $capsule): void]]></code>
</MissingOverrideAttribute>
<MixedAssignment>
<code><![CDATA[$database]]></code>
</MixedAssignment>
<UndefinedThisPropertyFetch>
<code><![CDATA[$this->database]]></code>
</UndefinedThisPropertyFetch>
</file>
<file src="src/Operation/Traits/OptionsTrait.php">
<MixedArgument>
Expand Down
6 changes: 6 additions & 0 deletions src/Atomizer/Renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,12 @@ private function columnOptions(AbstractColumn $column): array
if ($attribute === 'size' && $value === 0) {
continue;
}
if ($attribute === 'after' && $value === '') {
continue;
}
if ($attribute === 'first' && $value === false) {
continue;
}
$options[$attribute] = $value;
}

Expand Down
21 changes: 21 additions & 0 deletions tests/Migrations/MySQL/RendererTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

/**
* Spiral Framework.
*
* @license MIT
* @author Anton Titov (Wolfy-J)
*/

declare(strict_types=1);

namespace Cycle\Migrations\Tests\MySQL;

/**
* @group driver
* @group driver-mysql
*/
class RendererTest extends \Cycle\Migrations\Tests\RendererTest
{
public const DRIVER = 'mysql';
}
21 changes: 21 additions & 0 deletions tests/Migrations/Postgres/RendererTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

/**
* Spiral Framework.
*
* @license MIT
* @author Anton Titov (Wolfy-J)
*/

declare(strict_types=1);

namespace Cycle\Migrations\Tests\Postgres;

/**
* @group driver
* @group driver-postgres
*/
class RendererTest extends \Cycle\Migrations\Tests\RendererTest
{
public const DRIVER = 'postgres';
}
Loading
Loading