Skip to content

Commit

Permalink
EWPP-1914: PHP 8 support.
Browse files Browse the repository at this point in the history
  • Loading branch information
yenyasinn committed Feb 3, 2022
1 parent 8c2a5e1 commit 1041b59
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 14 deletions.
3 changes: 2 additions & 1 deletion .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,5 @@ matrix:
- lowest
- highest
PHP_VERSION:
- 7.3
- 7.4
- 8.0
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"php": ">=7.3",
"drupal/core": "^8.9 || ^9.1",
"php": ">=7.4",
"drupal/core": "^9.2",
"drupal/emr": "^1.0-beta11",
"drupal/facets": "^1.6",
"drupal/multivalue_form_element": "^1.0@beta",
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: '2'
services:
web:
image: fpfis/httpd-php-dev:7.3
image: fpfis/httpd-php-dev:8.0
working_dir: /var/www/html
ports:
- 8080:8080
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ public function testCacheabilityMetadata(): void {

$this->assertEquals([
'config:search_api.index.database_search_index',
'entity_test_with_bundle_list',
'search_api_list:database_search_index',
'entity_test_with_bundle_list',
], $links->getCacheTags());
$this->assertEquals(['route'], $links->getCacheContexts());
$this->assertEquals(Cache::PERMANENT, $links->getCacheMaxAge());
Expand Down Expand Up @@ -217,9 +217,9 @@ public function testCacheabilityMetadata(): void {
$this->assertCount(1, $links);
$this->assertEquals([
'config:search_api.index.database_search_index',
'entity_test_with_bundle:' . $entity->id(),
'entity_test_with_bundle_list',
'search_api_list:database_search_index',
'entity_test_with_bundle_list',
'entity_test_with_bundle:' . $entity->id(),
], $links->getCacheTags());
$this->assertEquals(['route'], $links->getCacheContexts());
$this->assertEquals(Cache::PERMANENT, $links->getCacheMaxAge());
Expand Down
2 changes: 1 addition & 1 deletion src/Form/ListPageConfigurationSubForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ public function submitForm(array &$form, FormStateInterface $form_state): void {
}

if ($sort) {
list($name, $direction) = explode('__', $sort);
[$name, $direction] = explode('__', $sort);
$this->configuration->setSort([
'name' => $name,
'direction' => strtoupper($direction),
Expand Down
4 changes: 2 additions & 2 deletions src/ListPageWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function getSourceEntityType(): ?string {
return NULL;
}

list($entity_type, $bundle) = explode(':', $source);
[$entity_type, $bundle] = explode(':', $source);
return $entity_type;
}

Expand All @@ -64,7 +64,7 @@ public function getSourceEntityBundle(): ?string {
return NULL;
}

list($entity_type, $bundle) = explode(':', $source);
[$entity_type, $bundle] = explode(':', $source);
return $bundle;
}

Expand Down
2 changes: 1 addition & 1 deletion src/ListSourceFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ protected function create(string $entity_type, string $bundle, IndexInterface $i
$id = self::generateFacetSourcePluginId($entity_type, $bundle);
$facets = $this->facetsManager->getFacetsByFacetSourceId($id);
usort($facets, function ($facet1, $facet2) {
return ($facet1->getWeight() > $facet2->getWeight());
return ($facet1->getWeight() <=> $facet2->getWeight());
});

foreach ($facets as $facet) {
Expand Down
2 changes: 1 addition & 1 deletion src/Plugin/facets/query_type/Date.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public function build() {

$operator = $active_filters['operator'];
$first_date = $active_filters['first'];
$second_date = isset($active_filters['second']) ? $active_filters['second'] : NULL;
$second_date = $active_filters['second'] ?? $active_filters['second'];

$operators = [
'gt' => $this->t('After'),
Expand Down
4 changes: 2 additions & 2 deletions tests/src/Kernel/MultiSelectFilterFieldPluginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ public function testBooleanFieldPlugin(): void {
/** @var \Drupal\oe_list_pages\MultiselectFilterFieldPluginInterface $plugin */
$plugin = $this->pluginManager->createInstance($plugin_id, [
'facet' => $facet,
'preset_filter' => new ListPresetFilter($facet->id(), [0]),
'preset_filter' => new ListPresetFilter($facet->id(), ['0']),
'list_source' => $item_list,
]);

Expand All @@ -318,7 +318,7 @@ public function testBooleanFieldPlugin(): void {
$this->assertEquals('0', $plugin->getDefaultValuesLabel());
$plugin->setConfiguration([
'facet' => $facet,
'preset_filter' => new ListPresetFilter($facet->id(), [1]),
'preset_filter' => new ListPresetFilter($facet->id(), ['1']),
'list_source' => $item_list,
]);
$this->assertEquals('1', $plugin->getDefaultValuesLabel());
Expand Down

0 comments on commit 1041b59

Please sign in to comment.