From 82f6aa549b39c6907de30534c9a7c09f8a7ba031 Mon Sep 17 00:00:00 2001 From: Timm Friebe Date: Sun, 5 Apr 2020 15:17:46 +0200 Subject: [PATCH] Refrain from using deprecated annotation key/value pairs --- ChangeLog.md | 5 +++++ src/main/php/rdbms/finder/Finder.class.php | 4 ++-- src/main/php/rdbms/finder/package-info.xp | 6 +++--- .../php/rdbms/unittest/FinderTest.class.php | 19 ++++++++++--------- .../MsSQLIntegrationTest.class.php | 3 ++- .../SybaseIntegrationTest.class.php | 4 ++-- .../MySqlxBufferedResultSetTest.class.php | 13 ++++++++----- .../tds/TdsBufferedResultSetTest.class.php | 13 ++++++++----- .../unittest/tds/TdsDataStreamTest.class.php | 8 +++++--- 9 files changed, 45 insertions(+), 30 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index 96f073d4..0a2b2c8c 100755 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -3,6 +3,11 @@ RDBMS support for the XP Framework: MySQL, Sybase, MSSQL, PostgreSQL, SQLite3, I ## ?.?.? / ????-??-?? +## 12.0.3 / 2020-04-05 + +* Implemented RFC #335: Remove deprecated key/value pair annotation syntax + (@thekid) + ## 12.0.2 / 2019-12-01 * Made compatible with XP 10 - @thekid diff --git a/src/main/php/rdbms/finder/Finder.class.php b/src/main/php/rdbms/finder/Finder.class.php index 0e30a28b..93824279 100644 --- a/src/main/php/rdbms/finder/Finder.class.php +++ b/src/main/php/rdbms/finder/Finder.class.php @@ -15,12 +15,12 @@ * return Job::getPeer(); * } * - * #[@finder(kind= ENTITY)] + * #[@finder(['kind' => ENTITY])] * public function byPrimary($pk) { * return new Criteria(array('job_id', $pk, EQUAL)); * } * - * #[@finder(kind= COLLECTION)] + * #[@finder(['kind' => COLLECTION])] * public function expiredJobs() { * return new Criteria(array('expire_at', Date::now(), GREATER_EQUAL)); * } diff --git a/src/main/php/rdbms/finder/package-info.xp b/src/main/php/rdbms/finder/package-info.xp index 19ef80eb..81455d4a 100644 --- a/src/main/php/rdbms/finder/package-info.xp +++ b/src/main/php/rdbms/finder/package-info.xp @@ -19,17 +19,17 @@ * return News::getPeer(); * } * - * #[@finder(kind= ENTITY)] + * #[@finder(['kind' => ENTITY])] * public function byPrimary($pk) { * return new Criteria(array('news_id', $pk, EQUAL)); * } * - * #[@finder(kind= COLLECTION)] + * #[@finder(['kind' => COLLECTION])] * public function allNews() { * return new Criteria(); * } * - * #[@finder(kind= COLLECTION)] + * #[@finder(['kind' => COLLECTION])] * public function todaysHelloNews() { * return new Criteria(Restrictions::allOf( * Restrictions::like('title', 'Hello%'), diff --git a/src/test/php/rdbms/unittest/FinderTest.class.php b/src/test/php/rdbms/unittest/FinderTest.class.php index 42242174..63a5a65d 100755 --- a/src/test/php/rdbms/unittest/FinderTest.class.php +++ b/src/test/php/rdbms/unittest/FinderTest.class.php @@ -1,25 +1,26 @@ fixture->method($name); - } catch (\rdbms\finder\FinderException $e) { + } catch (FinderException $e) { throw $e->getCause(); } } @@ -321,7 +322,7 @@ public function findAllWrapsSQLException() { $this->fixture->findAll(new \rdbms\Criteria()); } - #[@test, @expect(class= 'rdbms.finder.FinderException', withMessage= '/No such method nonExistantMethod/')] + #[@test, @expect(['class' => FinderException::class, 'withMessage' => '/No such method nonExistantMethod/'])] public function fluentNonExistantFinder() { $this->fixture->findAll()->nonExistantMethod(new \rdbms\Criteria()); } diff --git a/src/test/php/rdbms/unittest/integration/MsSQLIntegrationTest.class.php b/src/test/php/rdbms/unittest/integration/MsSQLIntegrationTest.class.php index af806174..8dc0befe 100755 --- a/src/test/php/rdbms/unittest/integration/MsSQLIntegrationTest.class.php +++ b/src/test/php/rdbms/unittest/integration/MsSQLIntegrationTest.class.php @@ -1,5 +1,6 @@ assertNull($this->db()->query('select cast("" as varbinary) as value')->next('value')); } - #[@test, @expect(class = 'rdbms.SQLStatementFailedException', withMessage= '/More power/')] + #[@test, @expect(['class' => SQLStatementFailedException::class, 'withMessage' => '/More power/'])] public function raiseError() { $this->db()->query('raiserror ("More power", 16, 1)'); } diff --git a/src/test/php/rdbms/unittest/integration/SybaseIntegrationTest.class.php b/src/test/php/rdbms/unittest/integration/SybaseIntegrationTest.class.php index 6bff62fa..cd68a609 100644 --- a/src/test/php/rdbms/unittest/integration/SybaseIntegrationTest.class.php +++ b/src/test/php/rdbms/unittest/integration/SybaseIntegrationTest.class.php @@ -1,9 +1,9 @@ SQLStatementFailedException::class, 'withMessage' => '/More power/'])] public function raiseError() { $this->db()->query('raiserror 61000 "More power"'); } diff --git a/src/test/php/rdbms/unittest/mysql/MySqlxBufferedResultSetTest.class.php b/src/test/php/rdbms/unittest/mysql/MySqlxBufferedResultSetTest.class.php index 63527ada..0c8184b1 100755 --- a/src/test/php/rdbms/unittest/mysql/MySqlxBufferedResultSetTest.class.php +++ b/src/test/php/rdbms/unittest/mysql/MySqlxBufferedResultSetTest.class.php @@ -1,20 +1,23 @@ assertEquals($records[1], $fixture->next()); } - #[@test, @expect(class= 'rdbms.SQLException', withMessage= 'Cannot seek to offset 1, out of bounds')] + #[@test, @expect(['class' => SQLException::class, 'withMessage' => 'Cannot seek to offset 1, out of bounds'])] public function seek_to_offset_exceeding_length() { $fixture= $this->newResultSet([])->seek(1); } - #[@test, @expect(class= 'rdbms.SQLException', withMessage= 'Cannot seek to offset -1, out of bounds')] + #[@test, @expect(['class' => SQLException::class, 'withMessage' => 'Cannot seek to offset -1, out of bounds'])] public function seek_to_negative_offset() { $fixture= $this->newResultSet([])->seek(-1); } - #[@test, @expect(class= 'rdbms.SQLException', withMessage= 'Cannot seek to offset 0, out of bounds')] + #[@test, @expect(['class' => SQLException::class, 'withMessage' => 'Cannot seek to offset 0, out of bounds'])] public function seek_to_zero_offset_on_empty() { $fixture= $this->newResultSet([])->seek(0); } diff --git a/src/test/php/rdbms/unittest/tds/TdsBufferedResultSetTest.class.php b/src/test/php/rdbms/unittest/tds/TdsBufferedResultSetTest.class.php index 81a29f85..7a8e2e12 100755 --- a/src/test/php/rdbms/unittest/tds/TdsBufferedResultSetTest.class.php +++ b/src/test/php/rdbms/unittest/tds/TdsBufferedResultSetTest.class.php @@ -1,20 +1,23 @@ assertEquals($records[1], $fixture->next()); } - #[@test, @expect(class= 'rdbms.SQLException', withMessage= 'Cannot seek to offset 1, out of bounds')] + #[@test, @expect(['class' => SQLException::class, 'withMessage' => 'Cannot seek to offset 1, out of bounds'])] public function seek_to_offset_exceeding_length() { $fixture= $this->newResultSet([])->seek(1); } - #[@test, @expect(class= 'rdbms.SQLException', withMessage= 'Cannot seek to offset -1, out of bounds')] + #[@test, @expect(['class' => SQLException::class, 'withMessage' => 'Cannot seek to offset -1, out of bounds'])] public function seek_to_negative_offset() { $fixture= $this->newResultSet([])->seek(-1); } - #[@test, @expect(class= 'rdbms.SQLException', withMessage= 'Cannot seek to offset 0, out of bounds')] + #[@test, @expect(['class' => SQLException::class, 'withMessage' => 'Cannot seek to offset 0, out of bounds'])] public function seek_to_zero_offset_on_empty() { $fixture= $this->newResultSet([])->seek(0); } diff --git a/src/test/php/rdbms/unittest/tds/TdsDataStreamTest.class.php b/src/test/php/rdbms/unittest/tds/TdsDataStreamTest.class.php index 1427d536..48e0cb62 100755 --- a/src/test/php/rdbms/unittest/tds/TdsDataStreamTest.class.php +++ b/src/test/php/rdbms/unittest/tds/TdsDataStreamTest.class.php @@ -1,9 +1,11 @@ assertEquals("\xA2", $str->getToken()); } - #[@test, @expect(class = 'lang.IllegalArgumentException', withMessage= '/must be at least 9/')] + #[@test, @expect(['class' => IllegalArgumentException::class, 'withMessage' => '/must be at least 9/'])] public function illegalPacketSize() { $this->newDataStream('', 1); }