Skip to content

Commit 6c2f6f3

Browse files
authored
Resolve conflicts on root with drupal/core-dev:10.0.x (#324)
* Remove drupal/core-dev to avoid conflicts on root * symfony/phpunit-bridge as dev dependency for drupal/core * behat/mink as dev dependency for drupal/core * Do not include drupal/core-dev in 10.0.x update step * Allows drush/drush ^11.0 * Revert "Allows drush/drush ^11.0" This reverts commit 77d643a. * Fix alias in build integration test * drush ^11.0 on 10.0.x * Remove alias * require self with --with-all-dependencies * try another little trick * fix conflict on extensions included * check compat with extracted major version * ContentEntityConfirmFormBase had @internal removed in 10.0.x * Drush drush_is* functions removed in 11.x
1 parent bff32a1 commit 6c2f6f3

File tree

8 files changed

+19
-20
lines changed

8 files changed

+19
-20
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ commands:
4343
cd /tmp/drupal
4444
composer require --dev drupal/core-dev:^8.8
4545
composer config repositories.1 '{"type": "path", "url": "'${CIRCLE_WORKING_DIRECTORY}'", "options": { "symlink": false }}'
46-
composer require --dev mglaman/phpstan-drupal "*"
46+
composer require --dev mglaman/phpstan-drupal "*" phpstan/extension-installer
4747
cat composer.json
4848
cp ~/repo/tests/fixtures/config/drupal-phpstan.neon /tmp/drupal/phpstan.neon
4949
./vendor/bin/phpstan --version

.github/workflows/php.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ jobs:
4040
- name: "Downgrade dev dependencies"
4141
run: "composer require phpunit/phpunit:6.5.14 drush/drush:~9 drupal/core-recommended:${{ matrix.drupal }} drupal/core-dev:${{ matrix.drupal }} --with-all-dependencies --dev --no-update"
4242
if: ${{ matrix.drupal == '^8.9' }}
43-
- name: "Upgrade to drupal/core:10.0.x"
44-
run: "composer require drupal/core-recommended:${{ matrix.drupal }} drupal/core-dev:${{ matrix.drupal }} --with-all-dependencies --dev --no-update"
43+
- name: "Upgrade to drupal/core:10.0.x and drush/drush:^11.0"
44+
run: "composer require drupal/core-recommended:${{ matrix.drupal }} drush/drush:^11.0 --with-all-dependencies --dev --no-update"
4545
if: ${{ matrix.drupal == '10.0.x-dev' }}
4646
- name: "Add phpspec/prophecy-phpunit"
4747
run: "composer require phpspec/prophecy-phpunit:^2 --dev --no-update"
@@ -92,7 +92,7 @@ jobs:
9292
- name: "require phpstan-drupal"
9393
run: |
9494
cd ~/drupal
95-
COMPOSER_MEMORY_LIMIT=-1 composer require mglaman/phpstan-drupal *@dev
95+
COMPOSER_MEMORY_LIMIT=-1 composer require mglaman/phpstan-drupal "dev-${{ github.sha }} as 1.1.99" phpstan/extension-installer --with-all-dependencies
9696
cp $GITHUB_WORKSPACE/tests/fixtures/config/drupal-phpstan.neon phpstan.neon
9797
- name: "Test core/install.php"
9898
run: |

composer.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,16 @@
1717
"webflo/drupal-finder": "^1.2"
1818
},
1919
"require-dev": {
20+
"behat/mink": "^1.8",
2021
"composer/installers": "^1.9",
21-
"drupal/core-dev": "^8.8@alpha || ^9.0",
2222
"drupal/core-recommended": "^8.8@alpha || ^9.0",
2323
"drush/drush": "^9.6 || ^10.0",
2424
"phpstan/extension-installer": "^1.1",
2525
"phpstan/phpstan-deprecation-rules": "^1.0",
2626
"phpstan/phpstan-strict-rules": "^1.0",
2727
"phpunit/phpunit": "^6.5 || ^7.5 || ^8.0 || ^9",
28-
"squizlabs/php_codesniffer": "^3.3"
28+
"squizlabs/php_codesniffer": "^3.3",
29+
"symfony/phpunit-bridge": "^3.4.3 || ^4.4 || ^5.4 || ^6.0"
2930
},
3031
"minimum-stability": "dev",
3132
"prefer-stable": true,
@@ -67,7 +68,8 @@
6768
"config": {
6869
"allow-plugins": {
6970
"composer/installers": true,
70-
"phpstan/extension-installer": true
71+
"phpstan/extension-installer": true,
72+
"dealerdirect/phpcodesniffer-composer-installer": true
7173
}
7274
}
7375
}

tests/fixtures/config/drupal-phpstan.neon

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,3 @@ parameters:
33
level: 0
44
ignoreErrors:
55
- '#\Drupal calls should be avoided in classes, use dependency injection instead#'
6-
includes:
7-
- vendor/mglaman/phpstan-drupal/extension.neon

tests/fixtures/drupal/modules/drush_command/src/Commands/TestDrushCommands.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,6 @@ class TestDrushCommands extends DrushCommands {
1111
*
1212
* @command phpstan:example
1313
*/
14-
public function example() {
15-
if (drush_is_osx()) {
16-
$this->io()->writeln('macOS');
17-
} elseif (drush_is_windows()) {
18-
$this->io()->writeln('Windows');
19-
} else {
20-
$this->io()->writeln('Linux ¯\_(ツ)_/¯');
21-
}
22-
}
23-
2414
public function batchProcess() {
2515
drush_backend_batch_process();
2616
}

tests/src/DrushIntegrationTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ protected function getRule(): \PHPStan\Rules\Rule
1818

1919
public function testPaths(): void
2020
{
21+
if (\Drush\Drush::getMajorVersion() === '11') {
22+
self::markTestSkipped('No');
23+
}
2124
$this->analyse([
2225
__DIR__ . '/../fixtures/drupal/modules/drush_command/src/Commands/TestDrushCommands.php'
2326
], []);

tests/src/Rules/ClassExtendsInternalClassRuleTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ public static function tearDownAfterClass(): void
4141
*/
4242
public function testRule(string $path, array $errorMessages): void
4343
{
44+
[$version] = explode('.', \Drupal::VERSION, 2);
45+
if ($version === '10'
46+
&& $path === __DIR__ . '/../../fixtures/drupal/modules/phpstan_fixtures/src/Form/ExtendsContentEntityDeleteForm.php') {
47+
self::markTestSkipped('@internal was removed in 10.0.x');
48+
}
4449
$this->analyse([$path], $errorMessages);
4550
}
4651

tests/src/Rules/GetDeprecatedServiceRuleTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,9 @@ public function testRuleDrupal8(string $path, array $errorMessages): void
3333
*/
3434
public function testRuleDrupal9(string $path, array $errorMessages): void
3535
{
36+
[$version] = explode('.', \Drupal::VERSION, 2);
3637
// @phpstan-ignore-next-line
37-
if (version_compare('9.0.0', \Drupal::VERSION) === 1) {
38+
if ($version !== '9') {
3839
self::markTestSkipped('Only tested on Drupal 9.x.x');
3940
}
4041
// @phpstan-ignore-next-line

0 commit comments

Comments
 (0)