Skip to content

Commit

Permalink
MySQL 8.4 removed keywords (#6408)
Browse files Browse the repository at this point in the history
  • Loading branch information
wmouwen authored May 17, 2024
1 parent 9631339 commit 7d67d25
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/Platforms/Keywords/MySQL84Keywords.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
<?php

declare(strict_types=1);

namespace Doctrine\DBAL\Platforms\Keywords;

use Doctrine\Deprecations\Deprecation;

use function array_diff;
use function array_merge;

/**
Expand All @@ -30,12 +33,19 @@ public function getName()
/**
* {@inheritDoc}
*
* @link https://dev.mysql.com/doc/refman/8.4/en/keywords.html#keywords-new-in-current-series
* @link https://dev.mysql.com/doc/refman/8.4/en/keywords.html
*/
protected function getKeywords()
{
$keywords = parent::getKeywords();

// Removed Keywords and Reserved Words
$keywords = array_diff($keywords, [
'MASTER_BIND',
'MASTER_SSL_VERIFY_SERVER_CERT',
]);

// New Keywords and Reserved Words
$keywords = array_merge($keywords, [
'AUTO',
'BERNOULLI',
Expand Down
27 changes: 27 additions & 0 deletions tests/Platforms/MySQL84PlatformTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

declare(strict_types=1);

namespace Doctrine\DBAL\Tests\Platforms;

use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Platforms\Keywords\KeywordList;
use Doctrine\DBAL\Platforms\MySQL84Platform;

class MySQL84PlatformTest extends MySQL57PlatformTest
{
public function createPlatform(): AbstractPlatform
{
return new MySQL84Platform();
}

public function testMySQL84KeywordList(): void
{
$keywordList = $this->platform->getReservedKeywordsList();
self::assertInstanceOf(KeywordList::class, $keywordList);

self::assertTrue($keywordList->isKeyword('persist'));
self::assertTrue($keywordList->isKeyword('manual'));
self::assertFalse($keywordList->isKeyword('master_bind'));
}
}

0 comments on commit 7d67d25

Please sign in to comment.