From 1fc4b3828a149817793245f09fcd5841cfd2af51 Mon Sep 17 00:00:00 2001 From: Alexei Tenitski <alexei@vendhq.com> Date: Tue, 26 Jan 2016 16:26:07 +1300 Subject: [PATCH 1/2] Rename String class due to 'String' being a reserved word in PHP7 --- src/Formats/{String.php => PlainString.php} | 2 +- src/Formats/ReorderedString.php | 2 +- src/Uuid.php | 4 ++-- test/MysqlUuid/ConvertTest.php | 12 ++++++------ .../Formats/{StringTest.php => PlainStringTest.php} | 4 ++-- test/MysqlUuid/UuidTest.php | 6 +++--- 6 files changed, 15 insertions(+), 15 deletions(-) rename src/Formats/{String.php => PlainString.php} (96%) rename test/MysqlUuid/Formats/{StringTest.php => PlainStringTest.php} (90%) diff --git a/src/Formats/String.php b/src/Formats/PlainString.php similarity index 96% rename from src/Formats/String.php rename to src/Formats/PlainString.php index 37b1c1f..af088f3 100644 --- a/src/Formats/String.php +++ b/src/Formats/PlainString.php @@ -5,7 +5,7 @@ /** * The traditional UUID string format */ -class String implements Format +class PlainString implements Format { const FORMAT = '/[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}/i'; diff --git a/src/Formats/ReorderedString.php b/src/Formats/ReorderedString.php index 402e451..fd6ae6a 100644 --- a/src/Formats/ReorderedString.php +++ b/src/Formats/ReorderedString.php @@ -8,7 +8,7 @@ * To retain the 4,2,2,2,6 byte separators, we have to split the node field when * we move it, and combine the time_mid and time_low fields. */ -class ReorderedString extends String +class ReorderedString extends PlainString { /** * @inheritDoc diff --git a/src/Uuid.php b/src/Uuid.php index cf82053..9297b01 100644 --- a/src/Uuid.php +++ b/src/Uuid.php @@ -4,7 +4,7 @@ use InvalidArgumentException; use MysqlUuid\Formats\Format; -use MysqlUuid\Formats\String; +use MysqlUuid\Formats\PlainString; /** * MySQL UUID format utilities @@ -39,7 +39,7 @@ public function __construct($value, Format $format = null) if ($format) { $this->format = $format; } else { - $this->format = new String(); + $this->format = new PlainString(); } } diff --git a/test/MysqlUuid/ConvertTest.php b/test/MysqlUuid/ConvertTest.php index 8a20d97..225de41 100644 --- a/test/MysqlUuid/ConvertTest.php +++ b/test/MysqlUuid/ConvertTest.php @@ -6,7 +6,7 @@ use MysqlUuid\Formats\Format; use MysqlUuid\Formats\Hex; use MysqlUuid\Formats\ReorderedString; -use MysqlUuid\Formats\String; +use MysqlUuid\Formats\PlainString; use MysqlUuid\Test\BaseTest; class ConvertTest extends BaseTest @@ -62,8 +62,8 @@ public function testConvert() protected function getFormat($format) { switch ($format) { - case 'string': - return new String(); + case 'plain': + return new PlainString(); case 'reordered': return new ReorderedString(); case 'binary': @@ -77,7 +77,7 @@ protected function conversions() { return [ [ - 'from' => 'string', + 'from' => 'plain', 'to' => 'reordered', 'cases' => [ 'b8e2adff-0331-11e4-9583-080027f3add4' => '080027f3-add4-11e4-9583-0331b8e2adff', @@ -85,7 +85,7 @@ protected function conversions() ], ], [ - 'from' => 'string', + 'from' => 'plain', 'to' => 'hex', 'cases' => [ 'b8e2adff-0331-11e4-9583-080027f3add4' => 'b8e2adff033111e49583080027f3add4', @@ -93,7 +93,7 @@ protected function conversions() ], ], [ - 'from' => 'string', + 'from' => 'plain', 'to' => 'binary', 'cases' => [ 'b8e2adff-0331-11e4-9583-080027f3add4' => "\x08\x00\x27\xf3\xad\xd4\x95\x83\x11\xe4\x03\x31\xb8\xe2\xad\xff", diff --git a/test/MysqlUuid/Formats/StringTest.php b/test/MysqlUuid/Formats/PlainStringTest.php similarity index 90% rename from test/MysqlUuid/Formats/StringTest.php rename to test/MysqlUuid/Formats/PlainStringTest.php index ab65586..ef7b9e1 100644 --- a/test/MysqlUuid/Formats/StringTest.php +++ b/test/MysqlUuid/Formats/PlainStringTest.php @@ -2,14 +2,14 @@ namespace MysqlUuid\Formats; -class StringTest extends FormatTest +class PlainStringTest extends FormatTest { /** * @return Format */ protected function getSut() { - return new String(); + return new PlainString(); } protected function good() diff --git a/test/MysqlUuid/UuidTest.php b/test/MysqlUuid/UuidTest.php index 4506233..11aeab4 100644 --- a/test/MysqlUuid/UuidTest.php +++ b/test/MysqlUuid/UuidTest.php @@ -2,7 +2,7 @@ namespace MysqlUuid; -use MysqlUuid\Formats\String; +use MysqlUuid\Formats\PlainString; use MysqlUuid\Test\BaseTest; class UuidTest extends BaseTest @@ -30,7 +30,7 @@ public function testBadFormat() ->will($this->returnValue(null)); $uuid = new Uuid('b8fc7a3e-0331-11e4-9583-080027f3add4', $format); - $uuid->toFormat(new String()); + $uuid->toFormat(new PlainString()); } public function testFieldCrud() @@ -42,6 +42,6 @@ public function testFieldCrud() $uuid->setField('clock_seq', 'ffff'); - $this->assertEquals($uuid->toFormat(new String()), 'b8fc7a3e-0331-11e4-ffff-080027f3add4'); + $this->assertEquals($uuid->toFormat(new PlainString()), 'b8fc7a3e-0331-11e4-ffff-080027f3add4'); } } From 15af4dd9e15db8fe219254defd9fe494bb2115e3 Mon Sep 17 00:00:00 2001 From: Alexei Tenitski <alexei@vendhq.com> Date: Tue, 26 Jan 2016 16:39:49 +1300 Subject: [PATCH 2/2] Added latest versions of php to .travis.yml --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index 12c0024..48f7db6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,9 @@ language: php php: - 5.5 - 5.4 + - 5.6 + - 7 + - hhvm install: - composer install