diff --git a/typo3/sysext/core/Classes/Database/Schema/EventListener/SchemaColumnDefinitionListener.php b/typo3/sysext/core/Classes/Database/Schema/EventListener/SchemaColumnDefinitionListener.php index d345d9af89e46005176f79ac8e58b062b6b7b3bc..168a6309644008be532825c447a3a0c9bf5d7183 100644 --- a/typo3/sysext/core/Classes/Database/Schema/EventListener/SchemaColumnDefinitionListener.php +++ b/typo3/sysext/core/Classes/Database/Schema/EventListener/SchemaColumnDefinitionListener.php @@ -65,21 +65,21 @@ class SchemaColumnDefinitionListener protected function getEnumerationTableColumnDefinition(array $tableColumn, AbstractPlatform $platform): Column { $options = [ - 'length' => $tableColumn['length'] ?: null, + 'length' => $tableColumn['length'] ?? null, 'unsigned' => false, 'fixed' => false, - 'default' => $tableColumn['default'] ?: null, - 'notnull' => (bool)($tableColumn['null'] !== 'YES'), + 'default' => $tableColumn['default'] ?? null, + 'notnull' => ($tableColumn['null'] ?? '') !== 'YES', 'scale' => null, 'precision' => null, 'autoincrement' => false, - 'comment' => $tableColumn['comment'] ?: null, + 'comment' => $tableColumn['comment'] ?? null, ]; $dbType = $this->getDatabaseType($tableColumn['type']); $doctrineType = $platform->getDoctrineTypeMapping($dbType); - $column = new Column($tableColumn['field'], Type::getType($doctrineType), $options); + $column = new Column($tableColumn['field'] ?? null, Type::getType($doctrineType), $options); $column->setPlatformOption('unquotedValues', $this->getUnquotedEnumerationValues($tableColumn['type'])); return $column; diff --git a/typo3/sysext/core/Tests/Unit/Database/Schema/EventListener/SchemaColumnDefinitionListenerTest.php b/typo3/sysext/core/Tests/Unit/Database/Schema/EventListener/SchemaColumnDefinitionListenerTest.php index 1fdac50f17b10b286c4296888cace4bcdb030abc..e15e4c1e82a7fcaac5399c280db43b0ee2eb0327 100644 --- a/typo3/sysext/core/Tests/Unit/Database/Schema/EventListener/SchemaColumnDefinitionListenerTest.php +++ b/typo3/sysext/core/Tests/Unit/Database/Schema/EventListener/SchemaColumnDefinitionListenerTest.php @@ -1,6 +1,5 @@ <?php declare(strict_types = 1); - namespace TYPO3\CMS\Core\Tests\Unit\Database; /* @@ -26,17 +25,13 @@ use TYPO3\CMS\Core\Database\Schema\EventListener\SchemaColumnDefinitionListener; use TYPO3\CMS\Core\Database\Schema\Types\EnumType; use TYPO3\CMS\Core\Database\Schema\Types\SetType; use TYPO3\CMS\Core\Utility\GeneralUtility; +use TYPO3\TestingFramework\Core\Unit\UnitTestCase; /** * Test case */ -class SchemaColumnDefinitionListenerTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase +class SchemaColumnDefinitionListenerTest extends UnitTestCase { - /** - * Subject is not notice free, disable E_NOTICES - */ - protected static $suppressNotices = true; - /** * @var SchemaColumnDefinitionListener */ @@ -50,7 +45,7 @@ class SchemaColumnDefinitionListenerTest extends \TYPO3\TestingFramework\Core\Un /** * Set up the test subject */ - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->subject = GeneralUtility::makeInstance(SchemaColumnDefinitionListener::class); @@ -60,7 +55,7 @@ class SchemaColumnDefinitionListenerTest extends \TYPO3\TestingFramework\Core\Un /** * @test */ - public function isInactiveForStandardColumnTypes() + public function isInactiveForStandardColumnTypes(): void { $event = new SchemaColumnDefinitionEventArgs( ['Type' => 'int(11)'], @@ -77,7 +72,7 @@ class SchemaColumnDefinitionListenerTest extends \TYPO3\TestingFramework\Core\Un /** * @test */ - public function buildsColumnForEnumDataType() + public function buildsColumnForEnumDataType(): void { if (Type::hasType('enum')) { Type::overrideType('enum', EnumType::class); @@ -105,7 +100,7 @@ class SchemaColumnDefinitionListenerTest extends \TYPO3\TestingFramework\Core\Un /** * @test */ - public function buildsColumnForSetDataType() + public function buildsColumnForSetDataType(): void { if (Type::hasType('set')) { Type::overrideType('set', SetType::class);