Skip to content

Commit

Permalink
Merge pull request #241 from openeuropa/EWPP-4991
Browse files Browse the repository at this point in the history
EWPP-4991: Ensure PHP8.3 compatibility.
  • Loading branch information
nagyad authored Jan 23, 2025
2 parents e72f523 + e9c15d4 commit da6deb9
Show file tree
Hide file tree
Showing 12 changed files with 47 additions and 67 deletions.
28 changes: 7 additions & 21 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ services:
- DRUPAL_SPARQL_HOSTNAME=sparql
- DRUPAL_SPARQL_PORT=8890
mysql:
image: git.fpfis.tech.ec.europa.eu/fpfis/dependency_proxy/containers/percona:5.7
command: --innodb-log-file-size=1G --max_allowed_packet=1G --innodb-buffer-pool-size=512M --wait_timeout=3000 --net_write_timeout=3000 --log_error_verbosity=3
image: git.fpfis.tech.ec.europa.eu/fpfis/dependency_proxy/containers/percona:8.0
command: --innodb-log-file-size=1G --max_allowed_packet=1G --innodb-buffer-pool-size=512M --wait_timeout=3000 --net_write_timeout=3000 --log_error_verbosity=3 --skip-log-bin --innodb-flush-log-at-trx-commit=2 --innodb-read-io-threads=16 --innodb-write-io-threads=16
environment:
- MYSQL_ALLOW_EMPTY_PASSWORD=yes
selenium:
Expand All @@ -42,20 +42,6 @@ services:
- DBA_PASSWORD=dba

pipeline:
composer-change-patch:
group: warmup
image: registry.fpfis.eu/fpfis/httpd-php:${PHP_VERSION}-ci
volumes:
- /cache:/cache
commands:
# Ignore the patch for 10.2.x.
- >
composer config --merge --json "extra.patches-ignore.drupal/media_avportal" '{"drupal/remote_stream_wrapper": {"Drupal 10.3.x only - see media_avportal/README.md for 10.2.x - https://www.drupal.org/project/remote_stream_wrapper/issues/3437974": "https://www.drupal.org/files/issues/2024-06-21/drupal_10_3_deliver_signature_change-3437974-2_0_0-18.patch"}}'
when:
matrix:
CORE_VERSION: "10.2.0"


composer-install:
group: prepare
image: registry.fpfis.eu/fpfis/httpd-php:${PHP_VERSION}-ci
Expand Down Expand Up @@ -98,11 +84,11 @@ pipeline:

matrix:
include:
- CORE_VERSION: 10.2.0
PHP_VERSION: 8.1
- CORE_VERSION: 10.2.0
PHP_VERSION: 8.2
- CORE_VERSION: 10.3.0
PHP_VERSION: 8.1
- CORE_VERSION: 10.3.0
PHP_VERSION: 8.2
PHP_VERSION: 8.3
- CORE_VERSION: 10.4.0
PHP_VERSION: 8.1
- CORE_VERSION: 10.4.0
PHP_VERSION: 8.3
19 changes: 12 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@
"drush/drush": "^12",
"nikic/php-parser": "^4",
"openeuropa/behat-transformation-context": "^0.1",
"openeuropa/code-review": "^2.0",
"openeuropa/code-review-drupal": "^1.0.0-alpha",
"openeuropa/oe_content": "^3.0.0",
"openeuropa/oe_media": "^1.23.1",
"openeuropa/oe_webtools": "^1.22",
"openeuropa/rdf_skos": "^1.0.0-alpha10",
"openeuropa/task-runner-drupal-project-symlink": "^1.0-beta6",
"openeuropa/task-runner-drupal-project-symlink": "^1.0",
"phpspec/prophecy-phpunit": "^2",
"symfony/phpunit-bridge": "^6.0"
},
Expand Down Expand Up @@ -80,24 +80,29 @@
]
},
"repositories": [
{
"type": "vcs",
"url": "https://git.drupalcode.org/project/description_list_field.git"
},
{
"type": "composer",
"url": "https://packages.drupal.org/8"
},
{
"type": "git",
"url": "https://github.com/openeuropa/DrupalDriver.git"
},
{
"type": "git",
"url": "https://github.com/openeuropa/code-review-drupal.git"
}
],
"config": {
"sort-packages": true,
"discard-changes": true,
"allow-plugins": {
"composer/installers": true,
"drupal/core-composer-scaffold": true,
"cweagans/composer-patches": true,
"dealerdirect/phpcodesniffer-composer-installer": true,
"drupal/core-composer-scaffold": true,
"phpro/grumphp": true,
"phpro/grumphp-shim": true,
"phpstan/extension-installer": true
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ cardinality: 1
translatable: true
indexes: { }
persist_with_no_fields: false
custom_storage: false
custom_storage: false
7 changes: 3 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
version: '2'
services:
web:
image: fpfis/httpd-php-dev:8.1
image: fpfis/httpd-php-dev:8.3
working_dir: /var/www/html
ports:
- 8080:8080
Expand All @@ -17,8 +16,8 @@ services:
# Enable step debugging for all PHP request. See ./README.md#step-debugging for more information.
# XDEBUG_SESSION: 1
mysql:
image: percona/percona-server:5.7
command: --innodb-log-file-size=1G --max_allowed_packet=1G --innodb-buffer-pool-size=512M --wait_timeout=3000 --net_write_timeout=3000 --log_error_verbosity=3
image: percona/percona-server:8.0
command: --innodb-log-file-size=1G --max_allowed_packet=1G --innodb-buffer-pool-size=512M --wait_timeout=3000 --net_write_timeout=3000 --log_error_verbosity=3 --skip-log-bin --innodb-flush-log-at-trx-commit=2 --innodb-read-io-threads=16 --innodb-write-io-threads=16
environment:
MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
# ports:
Expand Down
33 changes: 7 additions & 26 deletions grumphp.yml.dist
Original file line number Diff line number Diff line change
@@ -1,31 +1,12 @@
imports:
- { resource: vendor/openeuropa/code-review/dist/drupal-conventions.yml }
parameters:
tasks.phpcs.ignore_patterns:
- vendor/
- build/
tasks.phpcs.triggered_by:
- php
- module
- inc
- theme
- install

extra_tasks:
- { resource: ./vendor/openeuropa/code-review-drupal/dist/oe-component-conventions.yml }
grumphp:
tasks:
phpparser:
ignore_patterns:
- vendor/
- build/
visitors:
declare_strict_types: ~
triggered_by:
- php
- module
- inc
- theme
- install
grumphp:
extensions:
- OpenEuropa\CodeReview\ExtraTasksExtension
git_hook_variables:
EXEC_GRUMPHP_COMMAND: 'docker-compose exec -T web'
EXEC_GRUMPHP_COMMAND: 'docker-compose exec -T web'

parameters:
tasks.phpstan.configuration: phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,13 @@ public static function create(ContainerInterface $container): BannerCommands {

/**
* Triggers the update of the Banner paragraph data.
*
* phpcs:disable
*/
#[CLI\Command(name: 'oe-paragraphs-update-banner-data:run', aliases: [])]
#[CLI\Usage(name: 'oe-paragraphs-update-banner-data:run', description: 'Updates Banner paragraph data.')]
public function updateBannerData(): void {
// phpcs:enable
$ids = $this->entityTypeManager->getStorage('paragraph')->getQuery()
->condition('type', 'oe_banner')
->exists('field_oe_banner_type')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,13 @@ public static function create(ContainerInterface $container): CarouselCommands {

/**
* Triggers the update of the Carousel paragraph data.
*
* phpcs:disable
*/
#[CLI\Command(name: 'oe-paragraphs-update-carousel-data:run', aliases: [])]
#[CLI\Usage(name: 'oe-paragraphs-update-carousel-data:run', description: 'Updates Carousel paragraph data.')]
public function updateCarouselData(): void {
// phpcs:enable
$ids = $this->entityTypeManager->getStorage('paragraph')->getQuery()
->condition('type', 'oe_carousel')
->allRevisions()
Expand Down
2 changes: 1 addition & 1 deletion oe_paragraphs.behat.inc
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class OeParagraphsSubContext extends DrupalSubContextBase {
// Only check fields that reference paragraph types.
if ($this->getEntityReferenceTargetEntityId($entity, $field_name) !== 'paragraph') {
continue;
};
}

$actual_par_type_ids = $this->getEntityReferenceTargetBundles($entity, $field_name);

Expand Down
8 changes: 4 additions & 4 deletions oe_paragraphs.install
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function oe_paragraphs_update_8001(array &$sandbox): void {
'oe_list_item_block' => 'field_oe_list_item_block_variant',
'oe_list_item' => 'field_oe_list_item_variant',
];
$paragraph_ids = [];
$sandbox['paragraph_ids'] = [];

foreach ($sandbox['variant_fields'] as $bundle => $field) {
// Make sure we have the old fields in the database.
Expand All @@ -40,11 +40,11 @@ function oe_paragraphs_update_8001(array &$sandbox): void {
$query->exists($field);
$result = $query->execute();
if (!empty($result)) {
$paragraph_ids += $result;
$sandbox['paragraph_ids'] += $result;
}
}

$sandbox['total'] = count($paragraph_ids);
$sandbox['total'] = count($sandbox['paragraph_ids']);
$sandbox['current'] = 0;
$sandbox['paragraphs_per_batch'] = 25;

Expand Down Expand Up @@ -139,7 +139,7 @@ function oe_paragraphs_update_8001(array &$sandbox): void {
}

// Get the current slice of paragraph ids.
$pids = array_slice($paragraph_ids, $sandbox['current'], $sandbox['paragraphs_per_batch']);
$pids = array_slice($sandbox['paragraph_ids'], $sandbox['current'], $sandbox['paragraphs_per_batch']);
$entity_storage = \Drupal::entityTypeManager()->getStorage('paragraph');

foreach ($pids as $pid) {
Expand Down
2 changes: 2 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
includes:
- ./vendor/openeuropa/code-review-drupal/dist/phpstan.drupal.neon
4 changes: 3 additions & 1 deletion src/Plugin/Field/FieldWidget/ParagraphVariantsWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ public function formElement(FieldItemListInterface $items, $delta, array $elemen

$context = [
'form' => $form,
'widget' => self::getWidgetState($parents, $field_name, $form_state, $widget_state),
'widget' => self::getWidgetState($parents, $field_name, $form_state),
'items' => $items,
'delta' => $delta,
'element' => $element,
Expand Down Expand Up @@ -470,8 +470,10 @@ public function formElement(FieldItemListInterface $items, $delta, array $elemen
'mode' => $display->getMode(),
];

// @phpstan-ignore-next-line
field_group_attach_groups($element['subform'], $context);
$element['subform']['#process'][] = [
// @phpstan-ignore-next-line
FormatterHelper::class,
'formProcess',
];
Expand Down
3 changes: 1 addition & 2 deletions tests/Traits/TraversingTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ trait TraversingTrait {
* @throws \Exception
* Thrown when no select field is found.
*/
protected function findSelect($select): NodeElement {
/** @var \Behat\Mink\Element\NodeElement $element */
protected function findSelect(string $select): NodeElement {
$element = $this->getSession()->getPage()->find('named', ['select', $select]);

if (empty($element)) {
Expand Down

0 comments on commit da6deb9

Please sign in to comment.