Skip to content

Commit

Permalink
fix: compatibility with PHP 8.2 (#5292)
Browse files Browse the repository at this point in the history
  • Loading branch information
dannyvw committed Dec 30, 2022
1 parent bdc1962 commit af98b64
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 4 deletions.
20 changes: 18 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ jobs:
matrix:
php:
- '8.1'
- '8.2'
fail-fast: false
env:
APP_DEBUG: '1' # https://github.com/phpstan/phpstan-symfony/issues/37
Expand Down Expand Up @@ -116,9 +117,12 @@ jobs:
matrix:
php:
- '8.1'
- '8.2'
include:
- php: '8.1'
coverage: true
- php: '8.2'
coverage: true
fail-fast: false
steps:
- name: Checkout
Expand Down Expand Up @@ -190,9 +194,12 @@ jobs:
matrix:
php:
- '8.1'
- '8.2'
include:
- php: '8.1'
coverage: true
- php: '8.2'
coverage: true
fail-fast: false
steps:
- name: Checkout
Expand Down Expand Up @@ -292,6 +299,7 @@ jobs:
matrix:
php:
- '8.1'
- '8.2'
fail-fast: false
env:
APP_ENV: postgres
Expand Down Expand Up @@ -341,6 +349,7 @@ jobs:
matrix:
php:
- '8.1'
- '8.2'
fail-fast: false
services:
mysql:
Expand Down Expand Up @@ -390,6 +399,7 @@ jobs:
matrix:
php:
- '8.1'
- '8.2'
fail-fast: false
env:
APP_ENV: mongodb
Expand Down Expand Up @@ -480,6 +490,7 @@ jobs:
matrix:
php:
- '8.1'
- '8.2'
fail-fast: false
env:
APP_ENV: elasticsearch
Expand Down Expand Up @@ -530,6 +541,7 @@ jobs:
matrix:
php:
- '8.1'
- '8.2'
fail-fast: false
env:
SYMFONY_DEPRECATIONS_HELPER: max[total]=0
Expand Down Expand Up @@ -570,6 +582,7 @@ jobs:
matrix:
php:
- '8.1'
- '8.2'
fail-fast: false
# env:
# See https://github.com/doctrine/DoctrineMongoDBBundle/pull/673
Expand All @@ -580,7 +593,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
php-version: ${{ matrix.php }}
tools: pecl, composer
extensions: intl, bcmath, curl, openssl, mbstring
coverage: none
Expand Down Expand Up @@ -615,14 +628,15 @@ jobs:
matrix:
php:
- '8.1'
- '8.2'
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
php-version: ${{ matrix.php }}
tools: pecl, composer
extensions: intl, bcmath, curl, openssl, mbstring
coverage: none
Expand Down Expand Up @@ -659,6 +673,7 @@ jobs:
matrix:
php:
- '8.1'
- '8.2'
fail-fast: false
env:
APP_ENV: sqlite
Expand Down Expand Up @@ -701,6 +716,7 @@ jobs:
matrix:
php:
- '8.1'
- '8.2'
fail-fast: false
env:
APP_ENV: sqlite
Expand Down
2 changes: 1 addition & 1 deletion src/Elasticsearch/Paginator.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public function getIterator(): \Traversable
$denormalizationContext = array_merge([AbstractNormalizer::ALLOW_EXTRA_ATTRIBUTES => true], $this->denormalizationContext);

foreach ($this->documents['hits']['hits'] ?? [] as $document) {
$cacheKey = isset($document['_index'], $document['_type'], $document['_id']) ? md5("${document['_index']}_${document['_type']}_${document['_id']}") : null;
$cacheKey = isset($document['_index'], $document['_type'], $document['_id']) ? md5("{$document['_index']}_{$document['_type']}_{$document['_id']}") : null;

if ($cacheKey && \array_key_exists($cacheKey, $this->cachedDenormalizedDocuments)) {
$object = $this->cachedDenormalizedDocuments[$cacheKey];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ private function configureUriVariables(ApiResource|HttpOperation $operation): Ap
return $this->normalizeUriVariables($operation);
}

$hasUserConfiguredUriVariables = !($operation->getExtraProperties['is_legacy_resource_metadata'] ?? false);
$hasUserConfiguredUriVariables = !($operation->getExtraProperties()['is_legacy_resource_metadata'] ?? false);
if (!$operation->getUriVariables()) {
$hasUserConfiguredUriVariables = false;
$operation = $operation->withUriVariables($this->transformLinksToUriVariables($this->linkFactory->createLinksFromIdentifiers($operation)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ class PropertySchemaLengthRestriction implements PropertySchemaRestrictionMetada
{
/**
* {@inheritdoc}
*
* @param Length $constraint
*/
public function create(Constraint $constraint, ApiProperty $propertyMetadata): array
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ final class PropertySchemaRangeRestriction implements PropertySchemaRestrictionM
{
/**
* {@inheritdoc}
*
* @param Range $constraint
*/
public function create(Constraint $constraint, ApiProperty $propertyMetadata): array
{
Expand Down

0 comments on commit af98b64

Please sign in to comment.