Skip to content

Commit d6e301a

Browse files
authored
Add PHP8 testing to the matrix (#165)
1 parent c041720 commit d6e301a

File tree

4 files changed

+24
-17
lines changed

4 files changed

+24
-17
lines changed

.circleci/config.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ jobs:
5353
steps:
5454
- start-project
5555
- install-dependencies
56+
- run:
57+
name: phpspec/prophecy-phpunit fix
58+
command: composer require --dev phpspec/prophecy-phpunit:^2
5659
- run:
5760
name: CodeSniffer
5861
command: ./vendor/bin/phpcs src

.github/workflows/php.yml

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
tests:
1212
continue-on-error: ${{ matrix.experimental }}
1313
runs-on: "ubuntu-latest"
14-
name: "PHP ${{ matrix.php-version }} | Drupal ${{ matrix.drupal }}"
14+
name: "Tests | PHP ${{ matrix.php-version }} | Drupal ${{ matrix.drupal }}"
1515
strategy:
1616
matrix:
1717
experimental: [false]
@@ -25,11 +25,9 @@ jobs:
2525
- php-version: "7.2"
2626
drupal: "~8.9"
2727
experimental: false
28-
# @todo D9 is compat, but drupal/core-dev-pinned is not?
29-
# core-dev-pinned sets phar-io/manifest to 1.0.3, where ^2.0 is
30-
# - php-version: "8.0"
31-
# drupal: "^9.0"
32-
# experimental: true
28+
- php-version: "8.0"
29+
drupal: "^9.0"
30+
experimental: true
3331
steps:
3432
- name: "Checkout"
3533
uses: "actions/checkout@v2"
@@ -43,8 +41,11 @@ jobs:
4341
- name: "Install dependencies"
4442
run: "composer update --no-progress --prefer-dist"
4543
- name: "Downgrade dev dependencies"
46-
run: "composer require phpunit/phpunit:6.5.14 drush/drush:~9 drupal/core-recommended:${{ matrix.drupal }} drupal/core-dev-pinned:${{ matrix.drupal }} --with-all-dependencies"
44+
run: "composer require phpunit/phpunit:6.5.14 drush/drush:~9 drupal/core-recommended:${{ matrix.drupal }} drupal/core-dev:${{ matrix.drupal }} --with-all-dependencies"
4745
if: ${{ matrix.drupal == '^8.9' }}
46+
- name: "Add phpspec/prophecy-phpunit"
47+
run: "composer require --dev phpspec/prophecy-phpunit:^2"
48+
if: ${{ matrix.drupal == '^9.0' }}
4849
- name: "PHPCS"
4950
run: "php vendor/bin/phpcs src"
5051
- name: "PHPStan"
@@ -55,7 +56,7 @@ jobs:
5556
build_integration:
5657
continue-on-error: ${{ matrix.experimental }}
5758
runs-on: "ubuntu-latest"
58-
name: "PHP ${{ matrix.php-version }} | Drupal ${{ matrix.drupal }}"
59+
name: "Build Integration | PHP ${{ matrix.php-version }} | Drupal ${{ matrix.drupal }}"
5960
strategy:
6061
matrix:
6162
experimental: [false]
@@ -69,11 +70,9 @@ jobs:
6970
- php-version: "7.2"
7071
drupal: "~8.9"
7172
experimental: false
72-
# @todo D9 is compat, but drupal/core-dev-pinned is not?
73-
# core-dev-pinned sets phar-io/manifest to 1.0.3, where ^2.0 is
74-
# - php-version: "8.0"
75-
# drupal: "^9.0"
76-
# experimental: true
73+
- php-version: "8.0"
74+
drupal: "^9.0"
75+
experimental: true
7776
steps:
7877
- name: "Checkout"
7978
uses: "actions/checkout@v2"
@@ -93,7 +92,12 @@ jobs:
9392
composer config preferred-install dist
9493
composer config repositories.0 path $GITHUB_WORKSPACE
9594
composer config repositories.1 composer https://packages.drupal.org/8
96-
COMPOSER_MEMORY_LIMIT=-1 composer require drupal/core-dev-pinned:${{ matrix.drupal }} --with-all-dependencies
95+
COMPOSER_MEMORY_LIMIT=-1 composer require drupal/core-dev:${{ matrix.drupal }} --with-all-dependencies
96+
- name: "Add phpspec/prophecy-phpunit"
97+
run: |
98+
cd ~/drupal
99+
COMPOSER_MEMORY_LIMIT=-1 composer require --dev phpspec/prophecy-phpunit:^2
100+
if: ${{ matrix.drupal == '^9.0' }}
97101
- name: "require phpstan-drupal"
98102
run: |
99103
cd ~/drupal

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"phpstan/phpstan-deprecation-rules": "~0.12.0",
2424
"composer/installers": "^1.9",
2525
"drupal/core-recommended": "^8.8@alpha || ^9.0",
26-
"drupal/core-dev-pinned": "^8.8@alpha || ^9.0",
26+
"drupal/core-dev": "^8.8@alpha || ^9.0",
2727
"drush/drush": "^9.6 | ^10.0"
2828
},
2929
"minimum-stability": "dev",

src/Drupal/ServiceMap.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
class ServiceMap
88
{
99
/** @var \PHPStan\Drupal\DrupalServiceDefinition[] */
10-
private $services;
10+
private $services = [];
1111

1212
public function getService(string $id): ?DrupalServiceDefinition
1313
{
1414
// @see notes in DrupalAutoloader.
1515
// This is all a work around due to inability to set container parameters.
1616
if (count($this->services) === 0) {
17-
$this->services = $GLOBALS['drupalServiceMap'];
17+
$this->services = $GLOBALS['drupalServiceMap'] ?? [];
1818
if (count($this->services) === 0) {
1919
throw new ShouldNotHappenException('No Drupal service map was registered.');
2020
}

0 commit comments

Comments
 (0)