Skip to content

Commit

Permalink
Deprecation below 7.2.5 (#2707)
Browse files Browse the repository at this point in the history
Co-authored-by: Sean O'Brien <obrien.sean.dev@gmail.com>
  • Loading branch information
SamRemis and Sean O'Brien committed Aug 14, 2023
1 parent d9c58e9 commit 84d4539
Show file tree
Hide file tree
Showing 27 changed files with 68 additions and 83 deletions.
7 changes: 7 additions & 0 deletions .changes/nextrelease/enhancement-php-version-bump.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[
{
"type": "feature",
"category": "",
"description": "This version ends support for PHP versions below 7.2.5"
}
]
14 changes: 4 additions & 10 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: ['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 }}
Expand All @@ -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
Expand All @@ -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"
Expand All @@ -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)
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/functions_include.php',
'GuzzleHttp/Promise/functions_include.php',
'GuzzleHttp/Psr7/Utils.php',
'GuzzleHttp/Promise/Utils.php',
'JmesPath/JmesPath.php',
];

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

// React autoloader
$checks = [
'GuzzleHttp\\Psr7\\stream_for',
'GuzzleHttp\\Promise\\inspect',
'JmesPath\\search',
'Aws\\dir_iterator',
];
Expand All @@ -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;
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": ">=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",
"ext-openssl": "*",
"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",
Expand Down
4 changes: 0 additions & 4 deletions src/AwsClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
22 changes: 0 additions & 22 deletions src/ClientResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']
],
];

/**
Expand Down Expand Up @@ -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;
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()
public function promise(): PromiseInterface
{
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()
public function getSize(): ?int
{
$plainTextSize = $this->stream->getSize();

Expand All @@ -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(
Expand All @@ -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 = '';
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()
public function getSize(): ?int
{
$plainTextSize = $this->stream->getSize();

Expand All @@ -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(
Expand All @@ -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;
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()
public function isWritable(): bool
{
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()
public function isWritable(): bool
{
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)
public function read($length): string
{
$data = $this->stream->read($length);
$this->hash->update($data);
Expand All @@ -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);
}
}
6 changes: 2 additions & 4 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()
public function promise(): PromiseInterface
{
if ($this->promise) {
return $this->promise;
Expand Down Expand Up @@ -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) {
Expand Down
3 changes: 1 addition & 2 deletions src/Rds/AuthTokenGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
);
}

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()
public function promise(): PromiseInterface
{
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: 2 additions & 1 deletion src/S3/ObjectCopier.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -79,7 +80,7 @@ public function __construct(
*
* @return Coroutine
*/
public function promise()
public function promise(): PromiseInterface
{
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()
public function promise(): PromiseInterface
{
/** @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 false;
return;
}
$key = 'AWS::S3::UseGlobalEndpoint';
$result = $args['s3_us_east_1_regional_endpoint'] instanceof \Closure ?
Expand Down
5 changes: 3 additions & 2 deletions src/S3/StreamWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -569,9 +569,10 @@ 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()
public function promise(): PromiseInterface
{
// If the promise has been created, just return it.
if (!$this->promise) {
Expand Down

0 comments on commit 84d4539

Please sign in to comment.