diff --git a/composer.json b/composer.json index 84db042..82b359c 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,5 @@ { "name": "microsoft/azure-storage-common", - "version": "1.5.2", "description": "This project provides a set of common code shared by Azure Storage Blob, Table, Queue and File PHP client libraries.", "keywords": [ "php", "azure", "storage", "sdk", "common" ], "license": "MIT", diff --git a/src/Common/Internal/Middlewares/CommonRequestMiddleware.php b/src/Common/Internal/Middlewares/CommonRequestMiddleware.php index 4da9ba0..76dcc25 100644 --- a/src/Common/Internal/Middlewares/CommonRequestMiddleware.php +++ b/src/Common/Internal/Middlewares/CommonRequestMiddleware.php @@ -60,9 +60,9 @@ class CommonRequestMiddleware extends MiddlewareBase * @param array $headers The headers to be added. */ public function __construct( - IAuthScheme $authenticationScheme = null, - $storageAPIVersion, - $serviceSDKVersion, + ?IAuthScheme $authenticationScheme = null, + ?string $storageAPIVersion = null, + ?string $serviceSDKVersion = null, array $headers = array() ) { $this->authenticationScheme = $authenticationScheme; diff --git a/src/Common/Internal/RestProxy.php b/src/Common/Internal/RestProxy.php index c00bafc..e765c64 100644 --- a/src/Common/Internal/RestProxy.php +++ b/src/Common/Internal/RestProxy.php @@ -54,7 +54,7 @@ class RestProxy * * @param Serialization\ISerializer $dataSerializer The data serializer. */ - public function __construct(Serialization\ISerializer $dataSerializer = null) + public function __construct(?Serialization\ISerializer $dataSerializer = null) { $this->middlewares = array(); $this->dataSerializer = $dataSerializer; diff --git a/src/Common/Internal/Serialization/ISerializer.php b/src/Common/Internal/Serialization/ISerializer.php index 0e3a2eb..00c9815 100644 --- a/src/Common/Internal/Serialization/ISerializer.php +++ b/src/Common/Internal/Serialization/ISerializer.php @@ -56,7 +56,7 @@ public static function objectSerialize($targetObject, $rootName); * * @return string */ - public function serialize(array $array, array $properties = null); + public function serialize(array $array, ?array $properties = null); /** diff --git a/src/Common/Internal/Serialization/XmlSerializer.php b/src/Common/Internal/Serialization/XmlSerializer.php index ebd1243..8ba990e 100644 --- a/src/Common/Internal/Serialization/XmlSerializer.php +++ b/src/Common/Internal/Serialization/XmlSerializer.php @@ -54,7 +54,7 @@ class XmlSerializer implements ISerializer * * @return array */ - private function sxml2arr($sxml, array $arr = null) + private function sxml2arr($sxml, ?array $arr = null) { foreach ((array) $sxml as $key => $value) { if (is_object($value) || (is_array($value))) { @@ -77,7 +77,7 @@ private function sxml2arr($sxml, array $arr = null) * * @return void */ - private function arr2xml(\XMLWriter $xmlw, array $data, $defaultTag = null) + private function arr2xml(\XMLWriter $xmlw, array $data, ?string $defaultTag = null) { foreach ($data as $key => $value) { if ($key === Resources::XTAG_ATTRIBUTES) { @@ -190,7 +190,7 @@ public static function objectSerialize($targetObject, $rootName) * * @return string */ - public function serialize(array $array, array $properties = null) + public function serialize(array $array, ?array $properties = null) { $xmlVersion = '1.0'; $xmlEncoding = 'UTF-8'; diff --git a/src/Common/Internal/ServiceRestProxy.php b/src/Common/Internal/ServiceRestProxy.php index 15ef327..1d94e2b 100644 --- a/src/Common/Internal/ServiceRestProxy.php +++ b/src/Common/Internal/ServiceRestProxy.php @@ -349,7 +349,7 @@ protected function sendAsync( $path, $expected = Resources::STATUS_OK, $body = Resources::EMPTY_STRING, - ServiceOptions $serviceOptions = null + ?ServiceOptions $serviceOptions = null ) { if ($serviceOptions == null) { $serviceOptions = new ServiceOptions(); @@ -560,7 +560,7 @@ public static function groupQueryValues(array $values) * * @return array */ - protected function addMetadataHeaders(array $headers, array $metadata = null) + protected function addMetadataHeaders(array $headers, ?array $metadata = null) { Utilities::validateMetadata($metadata); @@ -577,7 +577,7 @@ protected function addMetadataHeaders(array $headers, array $metadata = null) * * @return array */ - public function generateMetadataHeaders(array $metadata = null) + public function generateMetadataHeaders(?array $metadata = null) { $metadataHeaders = array(); diff --git a/src/Common/Internal/ServiceRestTrait.php b/src/Common/Internal/ServiceRestTrait.php index cc4f507..91fbbd4 100644 --- a/src/Common/Internal/ServiceRestTrait.php +++ b/src/Common/Internal/ServiceRestTrait.php @@ -56,7 +56,7 @@ trait ServiceRestTrait * @see http://msdn.microsoft.com/en-us/library/windowsazure/hh452239.aspx */ public function getServiceProperties( - ServiceOptions $options = null + ?ServiceOptions $options = null ) { return $this->getServicePropertiesAsync($options)->wait(); } @@ -71,7 +71,7 @@ public function getServiceProperties( * @see http://msdn.microsoft.com/en-us/library/windowsazure/hh452239.aspx */ public function getServicePropertiesAsync( - ServiceOptions $options = null + ?ServiceOptions $options = null ) { $method = Resources::HTTP_GET; $headers = array(); @@ -126,7 +126,7 @@ public function getServicePropertiesAsync( */ public function setServiceProperties( ServiceProperties $serviceProperties, - ServiceOptions $options = null + ?ServiceOptions $options = null ) { $this->setServicePropertiesAsync($serviceProperties, $options)->wait(); } @@ -146,7 +146,7 @@ public function setServiceProperties( */ public function setServicePropertiesAsync( ServiceProperties $serviceProperties, - ServiceOptions $options = null + ?ServiceOptions $options = null ) { Validate::isTrue( $serviceProperties instanceof ServiceProperties, @@ -202,7 +202,7 @@ public function setServicePropertiesAsync( * * @return GetServiceStatsResult */ - public function getServiceStats(ServiceOptions $options = null) + public function getServiceStats(?ServiceOptions $options = null) { return $this->getServiceStatsAsync($options)->wait(); } @@ -215,7 +215,7 @@ public function getServiceStats(ServiceOptions $options = null) * * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getServiceStatsAsync(ServiceOptions $options = null) + public function getServiceStatsAsync(?ServiceOptions $options = null) { $method = Resources::HTTP_GET; $headers = array(); diff --git a/src/Common/Internal/Utilities.php b/src/Common/Internal/Utilities.php index 5765e4f..b7b0e40 100644 --- a/src/Common/Internal/Utilities.php +++ b/src/Common/Internal/Utilities.php @@ -49,7 +49,7 @@ class Utilities * * @return mixed */ - public static function tryGetValue($array, $key, $default = null) + public static function tryGetValue($array, $key, mixed $default = null) { return (!is_null($array)) && is_array($array) && array_key_exists($key, $array) ? $array[$key] @@ -260,7 +260,7 @@ public static function unserialize($xml) * * @return array */ - private static function _sxml2arr($sxml, array $arr = null) + private static function _sxml2arr($sxml, ?array $arr = null) { foreach ((array) $sxml as $key => $value) { if (is_object($value) || (is_array($value))) { @@ -287,8 +287,8 @@ private static function _sxml2arr($sxml, array $arr = null) public static function serialize( array $array, $rootName, - $defaultTag = null, - $standalone = null + ?string $defaultTag = null, + ?string $standalone = null ) { $xmlVersion = '1.0'; $xmlEncoding = 'UTF-8'; @@ -323,7 +323,7 @@ public static function serialize( private static function _arr2xml( \XMLWriter $xmlw, array $data, - $defaultTag = null + ?string $defaultTag = null ) { foreach ($data as $key => $value) { if (strcmp($key, '@attributes') == 0) { @@ -528,7 +528,7 @@ public static function arrayKeyExistsInsensitive($key, array $search) * * @return mixed */ - public static function tryGetValueInsensitive($key, $haystack, $default = null) + public static function tryGetValueInsensitive($key, $haystack,mixed $default = null) { $array = array_change_key_case($haystack); return Utilities::tryGetValue($array, strtolower($key), $default); @@ -751,7 +751,7 @@ public static function getMetadataArray(array $headers) * * @return void */ - public static function validateMetadata(array $metadata = null) + public static function validateMetadata(?array $metadata = null) { if (!is_null($metadata)) { Validate::isArray($metadata, 'metadata'); diff --git a/src/Common/Models/ServiceOptions.php b/src/Common/Models/ServiceOptions.php index 5825a42..6e597f0 100644 --- a/src/Common/Models/ServiceOptions.php +++ b/src/Common/Models/ServiceOptions.php @@ -88,7 +88,7 @@ class ServiceOptions /** * Initialize the properties to default value. */ - public function __construct(ServiceOptions $options = null) + public function __construct(?ServiceOptions $options = null) { if ($options == null) { $this->setNumberOfConcurrency(Resources::NUMBER_OF_CONCURRENCY);