diff --git a/.changes/nextrelease/enhancement-php-version-bump.json b/.changes/nextrelease/enhancement-php-version-bump.json new file mode 100644 index 0000000000..f287e37ad5 --- /dev/null +++ b/.changes/nextrelease/enhancement-php-version-bump.json @@ -0,0 +1,7 @@ +[ + { + "type": "feature", + "category": "", + "description": "This version ends support for PHP versions below 7.2.5" + } +] \ No newline at end of file diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0e64ca75ca..b2e279b069 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -16,7 +16,7 @@ jobs: strategy: #for each of the following versions of PHP, with and without --prefer-lowest matrix: - php-versions: ['5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2'] + php-versions: ['7.2.5', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2'] composer-options: ['', '--prefer-lowest'] #set the name for each job name: PHP ${{ matrix.php-versions }} ${{ matrix.composer-options }} @@ -43,12 +43,6 @@ jobs: - name: Validate composer.json and composer.lock run: composer validate - #remove incompatible xdebug file if it exists - - if: ${{ matrix.php-versions == '5.5' }} - name: PHP 5.5 - run: | - sudo rm -f /etc/php5/cli/conf.d/20-xdebug.ini - #get dependencies - name: Install dependencies run: composer update ${{ matrix.composer-options }} --no-interaction --prefer-source @@ -68,7 +62,7 @@ jobs: run: make test #static analysis - - if: ${{ matrix.php-versions >= '7.1' && matrix.php-versions < '8.0' && matrix.composer-options == '' }} + - if: ${{ matrix.php-versions < '8.0' && matrix.composer-options == '' }} name: Static analysis run: | composer require --dev nette/neon "^3.0" @@ -79,11 +73,11 @@ jobs: - if: ${{ matrix.composer-options == '' }} name: Package generation run: | - composer require guzzlehttp/psr7 "^1.9.1" + composer require guzzlehttp/psr7 "^1.9.1" -W composer update make package #generate code coverage - - if: ${{ (matrix.php-versions == '7.1' || matrix.php-versions == '8.0') && matrix.composer-options == '' }} + - if: ${{ (matrix.php-versions == '7.2.5' || matrix.php-versions == '8.0') && matrix.composer-options == '' }} name: Code coverage run: bash <(curl -s https://codecov.io/bash) diff --git a/build/packager.php b/build/packager.php index 836a055e01..1050a2e4c7 100644 --- a/build/packager.php +++ b/build/packager.php @@ -32,8 +32,6 @@ $autoloaderContents = [ 'Aws/functions.php', 'GuzzleHttp/functions_include.php', - 'GuzzleHttp/Psr7/functions_include.php', - 'GuzzleHttp/Promise/functions_include.php', 'JmesPath/JmesPath.php', ]; diff --git a/build/test-phar.php b/build/test-phar.php index f06ef6cfd6..48e66efced 100644 --- a/build/test-phar.php +++ b/build/test-phar.php @@ -20,8 +20,6 @@ // React autoloader $checks = [ - 'GuzzleHttp\\Psr7\\stream_for', - 'GuzzleHttp\\Promise\\inspect', 'JmesPath\\search', 'Aws\\dir_iterator', ]; @@ -33,4 +31,17 @@ } } +$classMethodChecks = [ + 'GuzzleHttp\\Promise\\Utils' => 'inspect', + 'GuzzleHttp\\Psr7\\Utils' => 'streamFor', +]; + +foreach ($classMethodChecks as $class => $method) { + if (!method_exists($class, $method) + ) { + echo $class . '::' . $method . ' not found'; + exit(1); + } +} + echo 'Version=' . Aws\Sdk::VERSION; diff --git a/composer.json b/composer.json index e96eaff9fc..cb770080d7 100644 --- a/composer.json +++ b/composer.json @@ -16,16 +16,16 @@ "issues": "https://github.com/aws/aws-sdk-php/issues" }, "require": { - "php": ">=5.5", + "php": ">=7.2.5", "guzzlehttp/guzzle": "^6.5.8 || ^7.4.5", "guzzlehttp/psr7": "^1.9.1 || ^2.4.5", - "guzzlehttp/promises": "^1.4.0", + "guzzlehttp/promises": "^1.4.0 || ^2.0", "mtdowling/jmespath.php": "^2.6", "ext-pcre": "*", "ext-json": "*", "ext-simplexml": "*", "aws/aws-crt-php": "^1.0.4", - "psr/http-message": "^1.0" + "psr/http-message": "^1.0 || ^2.0" }, "require-dev": { "composer/composer" : "^1.10.22", @@ -33,7 +33,7 @@ "ext-dom": "*", "ext-pcntl": "*", "ext-sockets": "*", - "phpunit/phpunit": "^4.8.35 || ^5.6.3 || ^9.5", + "phpunit/phpunit": "^5.6.3 || ^8.5 || ^9.5", "behat/behat": "~3.0", "doctrine/cache": "~1.4", "aws/aws-php-sns-message-validator": "~1.0", diff --git a/src/AwsClient.php b/src/AwsClient.php index c4b5271f8c..3b43b8260b 100644 --- a/src/AwsClient.php +++ b/src/AwsClient.php @@ -242,10 +242,6 @@ public function __construct(array $args) $this->addRecursionDetection(); $this->addRequestBuilder(); - if (!$config['suppress_php_deprecation_warning']) { - $this->emitDeprecationWarning(); - } - if (isset($args['with_resolved'])) { $args['with_resolved']($config); } diff --git a/src/ClientResolver.php b/src/ClientResolver.php index 34b2172379..ae74520b1d 100644 --- a/src/ClientResolver.php +++ b/src/ClientResolver.php @@ -280,13 +280,6 @@ class ClientResolver 'doc' => 'Set to false to disable checking for shared aws config files usually located in \'~/.aws/config\' and \'~/.aws/credentials\'. This will be ignored if you set the \'profile\' setting.', 'default' => true, ], - 'suppress_php_deprecation_warning' => [ - 'type' => 'value', - 'valid' => ['bool'], - 'doc' => 'Set to false to disable the deprecation warning of PHP versions 7.2.4 and below', - 'default' => false, - 'fn' => [__CLASS__, '_apply_suppress_php_deprecation_warning'] - ], ]; /** @@ -1026,21 +1019,6 @@ public static function _apply_idempotency_auto_fill( } } - public static function _apply_suppress_php_deprecation_warning($suppressWarning, array &$args) { - if ($suppressWarning) { - $args['suppress_php_deprecation_warning'] = true; - } elseif (!empty($_ENV["AWS_SUPPRESS_PHP_DEPRECATION_WARNING"])) { - $args['suppress_php_deprecation_warning'] = - $_ENV["AWS_SUPPRESS_PHP_DEPRECATION_WARNING"]; - } elseif (!empty($_SERVER["AWS_SUPPRESS_PHP_DEPRECATION_WARNING"])) { - $args['suppress_php_deprecation_warning'] = - $_SERVER["AWS_SUPPRESS_PHP_DEPRECATION_WARNING"]; - } elseif (!empty(getenv("AWS_SUPPRESS_PHP_DEPRECATION_WARNING"))) { - $args['suppress_php_deprecation_warning'] - = getenv("AWS_SUPPRESS_PHP_DEPRECATION_WARNING"); - } - } - public static function _default_endpoint_provider(array $args) { $service = isset($args['api']) ? $args['api'] : null; diff --git a/src/CommandPool.php b/src/CommandPool.php index 7cb1f94a12..d043422e21 100644 --- a/src/CommandPool.php +++ b/src/CommandPool.php @@ -75,7 +75,7 @@ public function __construct( /** * @return PromiseInterface */ - public function promise() + public function promise(): PromiseInterface { return $this->each->promise(); } diff --git a/src/Crypto/AesDecryptingStream.php b/src/Crypto/AesDecryptingStream.php index c1524cc18a..feafc469f2 100644 --- a/src/Crypto/AesDecryptingStream.php +++ b/src/Crypto/AesDecryptingStream.php @@ -65,7 +65,7 @@ public function getCurrentIv() return $this->cipherMethod->getCurrentIv(); } - public function getSize() + public function getSize(): ?int { $plainTextSize = $this->stream->getSize(); @@ -80,12 +80,12 @@ public function getSize() return $plainTextSize; } - public function isWritable() + public function isWritable(): bool { return false; } - public function read($length) + public function read($length): string { if ($length > strlen($this->buffer)) { $this->buffer .= $this->decryptBlock( @@ -101,7 +101,7 @@ public function read($length) return $data ? $data : ''; } - public function seek($offset, $whence = SEEK_SET) + public function seek($offset, $whence = SEEK_SET): void { if ($offset === 0 && $whence === SEEK_SET) { $this->buffer = ''; diff --git a/src/Crypto/AesEncryptingStream.php b/src/Crypto/AesEncryptingStream.php index 3b7c446754..2cb5ab696b 100644 --- a/src/Crypto/AesEncryptingStream.php +++ b/src/Crypto/AesEncryptingStream.php @@ -65,7 +65,7 @@ public function getCurrentIv() return $this->cipherMethod->getCurrentIv(); } - public function getSize() + public function getSize(): ?int { $plainTextSize = $this->stream->getSize(); @@ -79,12 +79,12 @@ public function getSize() return $plainTextSize; } - public function isWritable() + public function isWritable(): bool { return false; } - public function read($length) + public function read($length): string { if ($length > strlen($this->buffer)) { $this->buffer .= $this->encryptBlock( @@ -99,7 +99,7 @@ public function read($length) return $data ? $data : ''; } - public function seek($offset, $whence = SEEK_SET) + public function seek($offset, $whence = SEEK_SET): void { if ($whence === SEEK_CUR) { $offset = $this->tell() + $offset; diff --git a/src/Crypto/AesGcmDecryptingStream.php b/src/Crypto/AesGcmDecryptingStream.php index 76feaa158b..6ca750008b 100644 --- a/src/Crypto/AesGcmDecryptingStream.php +++ b/src/Crypto/AesGcmDecryptingStream.php @@ -100,7 +100,7 @@ public function createStream() } } - public function isWritable() + public function isWritable(): bool { return false; } diff --git a/src/Crypto/AesGcmEncryptingStream.php b/src/Crypto/AesGcmEncryptingStream.php index 13357f52fb..0d706e421e 100644 --- a/src/Crypto/AesGcmEncryptingStream.php +++ b/src/Crypto/AesGcmEncryptingStream.php @@ -118,7 +118,7 @@ public function getTag() return $this->tag; } - public function isWritable() + public function isWritable(): bool { return false; } diff --git a/src/HashingStream.php b/src/HashingStream.php index 9b11e137bd..6622178e91 100644 --- a/src/HashingStream.php +++ b/src/HashingStream.php @@ -36,7 +36,7 @@ public function __construct( $this->callback = $onComplete; } - public function read($length) + public function read($length): string { $data = $this->stream->read($length); $this->hash->update($data); @@ -50,14 +50,14 @@ public function read($length) return $data; } - public function seek($offset, $whence = SEEK_SET) + public function seek($offset, $whence = SEEK_SET): void { - if ($offset === 0) { - $this->hash->reset(); - return $this->stream->seek($offset); + // Seeking arbitrarily is not supported. + if ($offset !== 0) { + return; } - // Seeking arbitrarily is not supported. - return false; + $this->hash->reset(); + $this->stream->seek($offset); } } diff --git a/src/Multipart/AbstractUploadManager.php b/src/Multipart/AbstractUploadManager.php index 8e382c0e02..e663245e0d 100644 --- a/src/Multipart/AbstractUploadManager.php +++ b/src/Multipart/AbstractUploadManager.php @@ -88,7 +88,7 @@ public function upload() * * @return PromiseInterface */ - public function promise() + public function promise(): PromiseInterface { if ($this->promise) { return $this->promise; @@ -218,10 +218,8 @@ abstract protected function getCompleteParams(); /** * Based on the config and service-specific workflow info, creates a * `Promise` for an `UploadState` object. - * - * @return PromiseInterface A `Promise` that resolves to an `UploadState`. */ - private function determineState() + private function determineState(): UploadState { // If the state was provided via config, then just use it. if ($this->config['state'] instanceof UploadState) { diff --git a/src/Rds/AuthTokenGenerator.php b/src/Rds/AuthTokenGenerator.php index e58b7359d0..824d2b060e 100644 --- a/src/Rds/AuthTokenGenerator.php +++ b/src/Rds/AuthTokenGenerator.php @@ -47,8 +47,7 @@ public function createToken($endpoint, $region, $username, $lifetime = 15) { if (!is_numeric($lifetime) || $lifetime > 15 || $lifetime <= 0) { throw new \InvalidArgumentException( - "Lifetime must be a positive number less than or equal to 15, was {$lifetime}", - null + "Lifetime must be a positive number less than or equal to 15, was {$lifetime}" ); } diff --git a/src/S3/BatchDelete.php b/src/S3/BatchDelete.php index 92439115cd..db81bebc5c 100644 --- a/src/S3/BatchDelete.php +++ b/src/S3/BatchDelete.php @@ -115,7 +115,7 @@ public static function fromIterator( /** * @return PromiseInterface */ - public function promise() + public function promise(): PromiseInterface { if (!$this->cachedPromise) { $this->cachedPromise = $this->createPromise(); diff --git a/src/S3/ObjectCopier.php b/src/S3/ObjectCopier.php index ca5922a92b..66e4446d90 100644 --- a/src/S3/ObjectCopier.php +++ b/src/S3/ObjectCopier.php @@ -7,6 +7,7 @@ use Aws\Result; use Aws\S3\Exception\S3Exception; use GuzzleHttp\Promise\Coroutine; +use GuzzleHttp\Promise\PromiseInterface; use GuzzleHttp\Promise\PromisorInterface; use InvalidArgumentException; @@ -79,7 +80,7 @@ public function __construct( * * @return Coroutine */ - public function promise() + public function promise(): PromiseInterface { return Coroutine::of(function () { $headObjectCommand = $this->client->getCommand( diff --git a/src/S3/ObjectUploader.php b/src/S3/ObjectUploader.php index 4bbc583a71..b73b7b1235 100644 --- a/src/S3/ObjectUploader.php +++ b/src/S3/ObjectUploader.php @@ -68,7 +68,7 @@ public function __construct( /** * @return PromiseInterface */ - public function promise() + public function promise(): PromiseInterface { /** @var int $mup_threshold */ $mup_threshold = $this->options['mup_threshold']; diff --git a/src/S3/Transfer.php b/src/S3/Transfer.php index 9228c807fc..600f441008 100644 --- a/src/S3/Transfer.php +++ b/src/S3/Transfer.php @@ -146,7 +146,7 @@ public function __construct( * * @return PromiseInterface */ - public function promise() + public function promise(): PromiseInterface { // If the promise has been created, just return it. if (!$this->promise) { diff --git a/src/Waiter.php b/src/Waiter.php index ac1e001a84..74b2480131 100644 --- a/src/Waiter.php +++ b/src/Waiter.php @@ -3,6 +3,7 @@ use Aws\Exception\AwsException; use GuzzleHttp\Promise\Coroutine; +use GuzzleHttp\Promise\PromiseInterface; use GuzzleHttp\Promise\PromisorInterface; use GuzzleHttp\Promise\RejectedPromise; @@ -89,7 +90,7 @@ public function __construct( /** * @return Coroutine */ - public function promise() + public function promise(): PromiseInterface { return Coroutine::of(function () { $name = $this->config['operation']; diff --git a/tests/Crypto/RandomByteStream.php b/tests/Crypto/RandomByteStream.php index b14b7911e2..c0847b76d3 100644 --- a/tests/Crypto/RandomByteStream.php +++ b/tests/Crypto/RandomByteStream.php @@ -37,7 +37,7 @@ public function __construct($maxLength) /** * @return int|null */ - public function getSize() + public function getSize(): ?int { return $this->maxLength; }