diff --git a/phpstan.neon b/phpstan.neon index ebc26f4..764ec03 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -4,3 +4,7 @@ parameters: paths: - src - tests + + fileExtensions: + - php + - phpt diff --git a/src/ForeignKey.php b/src/ForeignKey.php index ffedd61..5e6cbb2 100644 --- a/src/ForeignKey.php +++ b/src/ForeignKey.php @@ -10,7 +10,7 @@ class ForeignKey const ACTION_CASCADE = 'CASCADE'; const ACTION_SET_NULL = 'SET NULL'; - /** @var string */ + /** @var string|NULL */ private $name; /** @var string[] */ @@ -30,7 +30,7 @@ class ForeignKey /** - * @param string $name + * @param string|NULL $name * @param string[]|string $columns * @param string|NULL $targetTable * @param string[]|string $targetColumns @@ -59,7 +59,7 @@ public function __construct($name, $columns, $targetTable, $targetColumns) /** - * @return string + * @return string|NULL */ public function getName() { diff --git a/src/Index.php b/src/Index.php index 01e6dce..1fcfff5 100644 --- a/src/Index.php +++ b/src/Index.php @@ -10,7 +10,7 @@ class Index const TYPE_UNIQUE = 'UNIQUE'; const TYPE_FULLTEXT = 'FULLTEXT'; - /** @var string */ + /** @var string|NULL */ private $name; /** @var string */ @@ -21,7 +21,7 @@ class Index /** - * @param string $name + * @param string|NULL $name * @param string[]|string $columns * @param string $type */ @@ -41,7 +41,7 @@ public function __construct($name, $columns = [], $type = self::TYPE_INDEX) /** - * @return string + * @return string|NULL */ public function getName() { diff --git a/src/Table.php b/src/Table.php index 01fb709..6694a96 100644 --- a/src/Table.php +++ b/src/Table.php @@ -98,7 +98,7 @@ public function getOptions() * @param string|Column $name * @param string|NULL $type * @param array|NULL $parameters - * @param array $options OPTION => NULL + * @param array $options OPTION => NULL * @return Column */ public function addColumn($name, $type = NULL, array $parameters = NULL, array $options = []) @@ -162,7 +162,7 @@ public function getColumns() /** - * @param string|Index $name + * @param string|Index|NULL $name * @param string[]|string $columns * @param string $type * @return Index @@ -229,7 +229,7 @@ public function getIndexes() /** - * @param string|ForeignKey $name + * @param string|ForeignKey|NULL $name * @param string[]|string $columns * @param string $targetTable * @param string[]|string $targetColumns diff --git a/tests/SqlSchema/Table.validate.phpt b/tests/SqlSchema/Table.validate.phpt index 0f85b39..33f9581 100644 --- a/tests/SqlSchema/Table.validate.phpt +++ b/tests/SqlSchema/Table.validate.phpt @@ -29,5 +29,8 @@ test(function () { test(function () { $table = new Table('book'); $table->addColumn('id', 'INT'); - Assert::null($table->validate()); + + Assert::noError(function () use ($table) { + $table->validate(); + }); });