Skip to content
This repository has been archived by the owner on Oct 17, 2024. It is now read-only.

Commit

Permalink
TTWEBTAKEN-99: Add support for php 8.1 (#38)
Browse files Browse the repository at this point in the history
* TTWEBTAKEN-99: Add support for php 8.1

* Update composer.json

* Fix composer normalize

* Fix grumphp issues

* Fix Travis

* Fix phpstan
  • Loading branch information
MPParsley authored Aug 29, 2022
1 parent 156ac6e commit d34fe41
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 26 deletions.
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ language: php
sudo: false

php:
- 7.3
- 7.4
- 8.1

cache:
directories:
- $HOME/.composer/cache

env:
- DRUPAL=9.1 PHPUNIT=9
- DRUPAL=9.2 PHPUNIT=9
- DRUPAL=9.3
- DRUPAL=9.4

jobs:
fast_finish: true
Expand All @@ -23,7 +23,7 @@ before_install:
- composer config -ga http-basic.digipolis.repo.repman.io token $REPMAN_TOKEN

# Require Drupal core.
- composer require -n --no-update --sort-packages -w --dev drupal/core:~$DRUPAL.0 phpunit/phpunit:^$PHPUNIT
- composer require -n --no-update --sort-packages -w --dev drupal/core:~$DRUPAL.0

# Get and run the Code Climate test reporter.
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
Expand Down
36 changes: 21 additions & 15 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"name": "gent-drupal/og_sm",
"type": "drupal-module",
"description": "Support to setup a platform supporting multiple (sub)sites using Organic Groups.",
"license": "GPL-2.0+",
"type": "drupal-module",
"keywords": [
"Drupal",
"Organic Groups",
Expand All @@ -11,35 +12,44 @@
"Digipolis"
],
"homepage": "https://www.drupal.org/project/og_sm",
"license": "GPL-2.0+",
"support": {
"issues": "https://github.com/digipolisgent/drupal_module_og-sm/issues",
"source": "https://github.com/digipolisgent/drupal_module_og-sm"
},
"require": {
"php": "^7.4 || ^8.0",
"drupal/og": "^1.0"
},
"require-dev": {
"digipolisgent/qa-drupal": "^1.0",
"digipolisgent/qa-drupal": "^1.7",
"drupal/admin_toolbar": "2.x-dev",
"drupal/core": "^9.1",
"drupal/core": "^9.3",
"drupal/og_menu": "1.x-dev",
"drupal/pathauto": "1.x-dev",
"drupal/token": "1.x-dev",
"phpspec/prophecy-phpunit": "^2",
"psr/event-dispatcher": "1.0.x-dev"
},
"repositories": {
"drupal": {
"type": "composer",
"url": "https://packages.drupal.org/8"
}
},
"minimum-stability": "dev",
"config": {
"allow-plugins": {
"phpro/grumphp-shim": true,
"ergebnis/composer-normalize": true,
"dealerdirect/phpcodesniffer-composer-installer": true
},
"sort-packages": true
},
"extra": {
"grumphp": {
"config-default-path": "vendor/digipolisgent/qa-drupal/configs/grumphp-extension.yml"
}
},
"repositories": {
"drupal": {
"type": "composer",
"url": "https://packages.drupal.org/8"
}
},
"minimum-stability": "dev",
"scripts": {
"post-install-cmd": "vendor/bin/grumphp git:init",
"coverage": "vendor/bin/phpunit --configuration=phpunit.qa-drupal.xml --coverage-html build/coverage",
Expand All @@ -49,9 +59,5 @@
"phpmd": "vendor/bin/grumphp run --tasks=phpmd",
"phpstan": "vendor/bin/grumphp run --tasks=phpstan",
"phpunit": "vendor/bin/phpunit --configuration=phpunit.qa-drupal.xml"
},
"support": {
"issues": "https://github.com/digipolisgent/drupal_module_og-sm/issues",
"source": "https://github.com/digipolisgent/drupal_module_og-sm"
}
}
1 change: 1 addition & 0 deletions og_sm_content/src/OgSmContentServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class OgSmContentServiceProvider extends ServiceProviderBase {
* {@inheritdoc}
*/
public function alter(ContainerBuilder $container) {
/** @var array $modules */
$modules = $container->getParameter('container.modules');
if (isset($modules['og_sm_path'])) {
$service_definition = new Definition('Drupal\og_sm_content\PathProcessor\SiteContentPathProcessor', [
Expand Down
2 changes: 1 addition & 1 deletion og_sm_path/og_sm_path.batch.inc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use Drupal\field\Entity\FieldStorageConfig;
* The Site to create the batch for.
*/
function og_sm_path_site_alias_update_batch(NodeInterface $site) {
$file = drupal_get_path('module', 'og_sm_path') . '/og_sm_path.batch.inc';
$file = \Drupal::service('extension.list.module')->getPath('og_sm_path') . '/og_sm_path.batch.inc';

$batch = [
'title' => t('Update Site content aliases'),
Expand Down
1 change: 1 addition & 0 deletions og_sm_path/og_sm_path.services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ services:
- { name: event_subscriber }
arguments:
- '@og_sm.path.site_path_manager'
- '@module_handler'
og_sm.path.site_type_subscriber:
class: Drupal\og_sm_path\EventSubscriber\SiteTypeSubscriber
tags:
Expand Down
15 changes: 13 additions & 2 deletions og_sm_path/src/EventSubscriber/SiteSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Drupal\og_sm_path\EventSubscriber;

use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\og_sm\Event\SiteEvent;
use Drupal\og_sm\Event\SiteEvents;
use Drupal\og_sm_path\Event\SitePathEvent;
Expand All @@ -21,14 +22,24 @@ class SiteSubscriber implements EventSubscriberInterface {
*/
protected $sitePathManager;

/**
* The module handler.
*
* @var \Drupal\Core\Extension\ModuleHandlerInterface
*/
protected $moduleHandler;

/**
* Constructs a SiteSubscriber object.
*
* @param \Drupal\og_sm_path\SitePathManagerInterface $site_path_manager
* The site path manager.
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
* The module handler.
*/
public function __construct(SitePathManagerInterface $site_path_manager) {
public function __construct(SitePathManagerInterface $site_path_manager, ModuleHandlerInterface $module_handler) {
$this->sitePathManager = $site_path_manager;
$this->moduleHandler = $module_handler;
}

/**
Expand Down Expand Up @@ -89,7 +100,7 @@ public function onSiteDelete(SiteEvent $event) {
*/
public function onSitePathChange(SitePathEvent $event) {
// Update all aliases for the Site when its alias changes.
module_load_include('inc', 'og_sm_path', 'og_sm_path.batch');
$this->moduleHandler->loadInclude('og_sm_path', 'inc', 'og_sm_path.batch');
og_sm_path_site_alias_update_batch($event->getSite());
}

Expand Down
7 changes: 4 additions & 3 deletions src/Plugin/views/filter/SitesFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ public function buildOptionsForm(&$form, FormStateInterface $formState) {
* {@inheritdoc}
*/
public function getValueOptions() {
if (isset($this->valueOptions)) {
/** @var array|null $valueOptions */
$valueOptions = $this->valueOptions;
if (isset($valueOptions)) {
return NULL;
}

Expand All @@ -96,9 +98,8 @@ public function getValueOptions() {
$options[$site->id()] = $site->label();
}
asort($options);
$this->valueOptions = $options;

return $this->valueOptions;
return $options;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/ProxyClass/ParamConverter/SiteConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class SiteConverter implements \Drupal\Core\ParamConverter\ParamConverterInterfa
/**
* The real proxied service, after it was lazy loaded.
*
* @var \Drupal\og_sm\ParamConverter\SiteConverter
* @var \Drupal\og_sm\ParamConverter\SiteConverter|null
*/
protected $service;

Expand Down

0 comments on commit d34fe41

Please sign in to comment.