diff --git a/composer.json b/composer.json index ee5ce7f..1eb79c5 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,7 @@ } ], "require": { - "php": ">=5.2", + "php": ">=5.6", "ext-curl": "*", "ext-json": "*", "ext-mbstring": "*" @@ -30,6 +30,8 @@ "phpunit/phpunit": "5.5.*" }, "autoload": { - "classmap": ["lib/Shippo/"] + "psr-4": { + "Shippo\\": "lib/" + } } } diff --git a/lib/Shippo/Address.php b/lib/Shippo/Address.php index f2e58e1..f3eec22 100644 --- a/lib/Shippo/Address.php +++ b/lib/Shippo/Address.php @@ -1,5 +1,7 @@ refresh(); return $instance; } - + /** * @returns Shippo_ApiResource The refreshed resource. */ diff --git a/lib/Shippo/AttachedObject.php b/lib/Shippo/AttachedObject.php index 2c4e083..04c21cc 100644 --- a/lib/Shippo/AttachedObject.php +++ b/lib/Shippo/AttachedObject.php @@ -1,5 +1,7 @@ ' . $k . ' = NULL to delete the property'); + throw new \InvalidArgumentException('You cannot set \'' . $k . '\'to an empty string. ' . 'We interpret empty strings as NULL in requests. ' . 'You may set obj->' . $k . ' = NULL to delete the property'); } if (self::$nestedUpdatableAttributes->includes($k) && isset($this->$k) && is_array($v)) { @@ -179,7 +184,7 @@ public function refreshFrom($values, $apiKey, $partial = false) continue; if (self::$nestedUpdatableAttributes->includes($k) && is_array($v)) { - $this->_values[$k] = Shippo_Object::scopedConstructFrom('Shippo_AttachedObject', $v, $apiKey); + $this->_values[$k] = Shippo_Object::scopedConstructFrom(Shippo_AttachedObject::class, $v, $apiKey); } else { $this->_values[$k] = Shippo_Util::convertToShippoObject($v, $apiKey); } diff --git a/lib/Shippo/Parcel.php b/lib/Shippo/Parcel.php index c5005b6..53015de 100644 --- a/lib/Shippo/Parcel.php +++ b/lib/Shippo/Parcel.php @@ -1,5 +1,7 @@ = // 5.3 if (version_compare(PHP_VERSION, '5.3.2', '>=')) { - $reflector = new ReflectionClass('Shippo_APIRequestor'); + $reflector = new ReflectionClass(Shippo_ApiRequestor::class); $method = $reflector->getMethod('_encodeObjects'); $method->setAccessible(true); diff --git a/test/AuthenticationErrorTest.php b/test/AuthenticationErrorTest.php index 8ca04c9..c5416bc 100644 --- a/test/AuthenticationErrorTest.php +++ b/test/AuthenticationErrorTest.php @@ -1,5 +1,9 @@ assertEquals(Shippo::getApiKey(), 'dW5pdHRlc3Q6dW5pdHRlc3Q='); } -} \ No newline at end of file +} diff --git a/test/TestCase.php b/test/TestCase.php index 34c3ade..235d748 100644 --- a/test/TestCase.php +++ b/test/TestCase.php @@ -1,6 +1,10 @@ mock) { - $this->mock = $this->createMock('CurlClient'); + $this->mock = $this->createMock(CurlClient::class); Shippo_ApiRequestor::setHttpClient($this->mock); } return $this->mock; diff --git a/test/TrackTest.php b/test/TrackTest.php index 6e28eaf..7541772 100644 --- a/test/TrackTest.php +++ b/test/TrackTest.php @@ -1,5 +1,7 @@ $pagesize, 'page' => '1' diff --git a/test/UtilTest.php b/test/UtilTest.php index 265b6fa..795c5ae 100644 --- a/test/UtilTest.php +++ b/test/UtilTest.php @@ -1,5 +1,7 @@