Skip to content

Commit

Permalink
Revert "Deprecation below 7.2.5 (#2707)" (#2757)
Browse files Browse the repository at this point in the history
  • Loading branch information
stobrien89 authored Aug 15, 2023
1 parent 84d4539 commit 629c8bf
Show file tree
Hide file tree
Showing 27 changed files with 83 additions and 68 deletions.
7 changes: 0 additions & 7 deletions .changes/nextrelease/enhancement-php-version-bump.json

This file was deleted.

14 changes: 10 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
strategy:
#for each of the following versions of PHP, with and without --prefer-lowest
matrix:
php-versions: ['7.2.5', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2']
php-versions: ['5.5', '5.6', '7.0', '7.1', '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 }}
Expand All @@ -43,6 +43,12 @@ 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
Expand All @@ -62,7 +68,7 @@ jobs:
run: make test

#static analysis
- if: ${{ matrix.php-versions < '8.0' && matrix.composer-options == '' }}
- if: ${{ matrix.php-versions >= '7.1' && matrix.php-versions < '8.0' && matrix.composer-options == '' }}
name: Static analysis
run: |
composer require --dev nette/neon "^3.0"
Expand All @@ -73,11 +79,11 @@ jobs:
- if: ${{ matrix.composer-options == '' }}
name: Package generation
run: |
composer require guzzlehttp/psr7 "^1.9.1" -W
composer require guzzlehttp/psr7 "^1.9.1"
composer update
make package
#generate code coverage
- if: ${{ (matrix.php-versions == '7.2.5' || matrix.php-versions == '8.0') && matrix.composer-options == '' }}
- if: ${{ (matrix.php-versions == '7.1' || matrix.php-versions == '8.0') && matrix.composer-options == '' }}
name: Code coverage
run: bash <(curl -s https://codecov.io/bash)
4 changes: 2 additions & 2 deletions build/packager.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
$autoloaderContents = [
'Aws/functions.php',
'GuzzleHttp/functions_include.php',
'GuzzleHttp/Psr7/Utils.php',
'GuzzleHttp/Promise/Utils.php',
'GuzzleHttp/Psr7/functions_include.php',
'GuzzleHttp/Promise/functions_include.php',
'JmesPath/JmesPath.php',
];

Expand Down
15 changes: 2 additions & 13 deletions build/test-phar.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

// React autoloader
$checks = [
'GuzzleHttp\\Psr7\\stream_for',
'GuzzleHttp\\Promise\\inspect',
'JmesPath\\search',
'Aws\\dir_iterator',
];
Expand All @@ -31,17 +33,4 @@
}
}

$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;
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,24 @@
"issues": "https://github.com/aws/aws-sdk-php/issues"
},
"require": {
"php": ">=7.2.5",
"php": ">=5.5",
"guzzlehttp/guzzle": "^6.5.8 || ^7.4.5",
"guzzlehttp/psr7": "^1.9.1 || ^2.4.5",
"guzzlehttp/promises": "^1.4.0 || ^2.0",
"guzzlehttp/promises": "^1.4.0",
"mtdowling/jmespath.php": "^2.6",
"ext-pcre": "*",
"ext-json": "*",
"ext-simplexml": "*",
"aws/aws-crt-php": "^1.0.4",
"psr/http-message": "^1.0 || ^2.0"
"psr/http-message": "^1.0"
},
"require-dev": {
"composer/composer" : "^1.10.22",
"ext-openssl": "*",
"ext-dom": "*",
"ext-pcntl": "*",
"ext-sockets": "*",
"phpunit/phpunit": "^5.6.3 || ^8.5 || ^9.5",
"phpunit/phpunit": "^4.8.35 || ^5.6.3 || ^9.5",
"behat/behat": "~3.0",
"doctrine/cache": "~1.4",
"aws/aws-php-sns-message-validator": "~1.0",
Expand Down
4 changes: 4 additions & 0 deletions src/AwsClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,10 @@ 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);
}
Expand Down
22 changes: 22 additions & 0 deletions src/ClientResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,13 @@ 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']
],
];

/**
Expand Down Expand Up @@ -1019,6 +1026,21 @@ 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;
Expand Down
2 changes: 1 addition & 1 deletion src/CommandPool.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function __construct(
/**
* @return PromiseInterface
*/
public function promise(): PromiseInterface
public function promise()
{
return $this->each->promise();
}
Expand Down
8 changes: 4 additions & 4 deletions src/Crypto/AesDecryptingStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function getCurrentIv()
return $this->cipherMethod->getCurrentIv();
}

public function getSize(): ?int
public function getSize()
{
$plainTextSize = $this->stream->getSize();

Expand All @@ -80,12 +80,12 @@ public function getSize(): ?int
return $plainTextSize;
}

public function isWritable(): bool
public function isWritable()
{
return false;
}

public function read($length): string
public function read($length)
{
if ($length > strlen($this->buffer)) {
$this->buffer .= $this->decryptBlock(
Expand All @@ -101,7 +101,7 @@ public function read($length): string
return $data ? $data : '';
}

public function seek($offset, $whence = SEEK_SET): void
public function seek($offset, $whence = SEEK_SET)
{
if ($offset === 0 && $whence === SEEK_SET) {
$this->buffer = '';
Expand Down
8 changes: 4 additions & 4 deletions src/Crypto/AesEncryptingStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function getCurrentIv()
return $this->cipherMethod->getCurrentIv();
}

public function getSize(): ?int
public function getSize()
{
$plainTextSize = $this->stream->getSize();

Expand All @@ -79,12 +79,12 @@ public function getSize(): ?int
return $plainTextSize;
}

public function isWritable(): bool
public function isWritable()
{
return false;
}

public function read($length): string
public function read($length)
{
if ($length > strlen($this->buffer)) {
$this->buffer .= $this->encryptBlock(
Expand All @@ -99,7 +99,7 @@ public function read($length): string
return $data ? $data : '';
}

public function seek($offset, $whence = SEEK_SET): void
public function seek($offset, $whence = SEEK_SET)
{
if ($whence === SEEK_CUR) {
$offset = $this->tell() + $offset;
Expand Down
2 changes: 1 addition & 1 deletion src/Crypto/AesGcmDecryptingStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public function createStream()
}
}

public function isWritable(): bool
public function isWritable()
{
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Crypto/AesGcmEncryptingStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public function getTag()
return $this->tag;
}

public function isWritable(): bool
public function isWritable()
{
return false;
}
Expand Down
14 changes: 7 additions & 7 deletions src/HashingStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function __construct(
$this->callback = $onComplete;
}

public function read($length): string
public function read($length)
{
$data = $this->stream->read($length);
$this->hash->update($data);
Expand All @@ -50,14 +50,14 @@ public function read($length): string
return $data;
}

public function seek($offset, $whence = SEEK_SET): void
public function seek($offset, $whence = SEEK_SET)
{
// Seeking arbitrarily is not supported.
if ($offset !== 0) {
return;
if ($offset === 0) {
$this->hash->reset();
return $this->stream->seek($offset);
}

$this->hash->reset();
$this->stream->seek($offset);
// Seeking arbitrarily is not supported.
return false;
}
}
6 changes: 4 additions & 2 deletions src/Multipart/AbstractUploadManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public function upload()
*
* @return PromiseInterface
*/
public function promise(): PromiseInterface
public function promise()
{
if ($this->promise) {
return $this->promise;
Expand Down Expand Up @@ -218,8 +218,10 @@ 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(): UploadState
private function determineState()
{
// If the state was provided via config, then just use it.
if ($this->config['state'] instanceof UploadState) {
Expand Down
3 changes: 2 additions & 1 deletion src/Rds/AuthTokenGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ 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}"
"Lifetime must be a positive number less than or equal to 15, was {$lifetime}",
null
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/S3/BatchDelete.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public static function fromIterator(
/**
* @return PromiseInterface
*/
public function promise(): PromiseInterface
public function promise()
{
if (!$this->cachedPromise) {
$this->cachedPromise = $this->createPromise();
Expand Down
2 changes: 1 addition & 1 deletion src/S3/BucketEndpointArnMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ private function generateAccessPointHost(
}

$host = "{$accesspointName}-" . $arn->getAccountId();

$useFips = $this->config['use_fips_endpoint']->isUseFipsEndpoint();
$fipsString = $useFips ? "-fips" : "";

Expand Down
3 changes: 1 addition & 2 deletions src/S3/ObjectCopier.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use Aws\Result;
use Aws\S3\Exception\S3Exception;
use GuzzleHttp\Promise\Coroutine;
use GuzzleHttp\Promise\PromiseInterface;
use GuzzleHttp\Promise\PromisorInterface;
use InvalidArgumentException;

Expand Down Expand Up @@ -80,7 +79,7 @@ public function __construct(
*
* @return Coroutine
*/
public function promise(): PromiseInterface
public function promise()
{
return Coroutine::of(function () {
$headObjectCommand = $this->client->getCommand(
Expand Down
2 changes: 1 addition & 1 deletion src/S3/ObjectUploader.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function __construct(
/**
* @return PromiseInterface
*/
public function promise(): PromiseInterface
public function promise()
{
/** @var int $mup_threshold */
$mup_threshold = $this->options['mup_threshold'];
Expand Down
2 changes: 1 addition & 1 deletion src/S3/S3Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,7 @@ private function processEndpointV2Model()
private function addBuiltIns($args)
{
if ($args['region'] !== 'us-east-1') {
return;
return false;
}
$key = 'AWS::S3::UseGlobalEndpoint';
$result = $args['s3_us_east_1_regional_endpoint'] instanceof \Closure ?
Expand Down
5 changes: 2 additions & 3 deletions src/S3/StreamWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -569,10 +569,9 @@ public function rename($path_from, $path_to)
);
// Delete the original object
$this->getClient()->deleteObject([
'Bucket' => $partsFrom['Bucket'],
'Key' => $partsFrom['Key'],
'Bucket' => $partsFrom['Bucket'],
'Key' => $partsFrom['Key']
] + $options);

return true;
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/S3/Transfer.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public function __construct(
*
* @return PromiseInterface
*/
public function promise(): PromiseInterface
public function promise()
{
// If the promise has been created, just return it.
if (!$this->promise) {
Expand Down
Loading

0 comments on commit 629c8bf

Please sign in to comment.