Skip to content

Commit dee78dc

Browse files
authored
Merge pull request #97 from wunderio/feature/WD-257-Upgrade-GrumPHP-to-v2
Feature/wd 257 upgrade grumphp to v2
2 parents ada3510 + cbe9a4e commit dee78dc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+205
-101
lines changed

composer.json

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,15 @@
3636
"bin": ["bin/check_perms"],
3737
"require": {
3838
"symfony/polyfill-iconv": "^1",
39-
"phpro/grumphp": "^1",
39+
"phpro/grumphp": "^2.5",
4040
"drupal/coder": "^8",
4141
"phpcompatibility/php-compatibility": "^9.3",
4242
"pheromone/phpcs-security-audit": "^2.0",
4343
"squizlabs/php_codesniffer": "^3.4",
4444
"dealerdirect/phpcodesniffer-composer-installer": "*",
4545
"mglaman/phpstan-drupal": "^1.1",
4646
"phpstan/extension-installer": "^1.1",
47-
"phpstan/phpstan-deprecation-rules": "^1.0",
48-
"vimeo/psalm": "^4",
49-
"nette/finder": "^2.5",
50-
"symfony/finder": "^4.4 || ^5.3 || ^6"
47+
"phpstan/phpstan-deprecation-rules": "^1.0"
5148
},
5249
"autoload": {
5350
"psr-4": {

grumphp.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ grumphp:
1515
json_lint: ~
1616
phpunit: ~
1717
php_check_syntax: ~
18-
psalm: ~
18+
#psalm: ~
1919
extensions:
2020
- Wunderio\GrumPHP\Task\PhpCompatibility\PhpCompatibilityExtensionLoader
2121
- Wunderio\GrumPHP\Task\PhpCheckSyntax\PhpCheckSyntaxExtensionLoader
@@ -25,4 +25,4 @@ grumphp:
2525
- Wunderio\GrumPHP\Task\PhpStan\PhpStanExtensionLoader
2626
- Wunderio\GrumPHP\Task\YamlLint\YamlLintExtensionLoader
2727
- Wunderio\GrumPHP\Task\JsonLint\JsonLintExtensionLoader
28-
- Wunderio\GrumPHP\Task\Psalm\PsalmExtensionLoader
28+
#- Wunderio\GrumPHP\Task\Psalm\PsalmExtensionLoader

src/Drupal/DrupalAutoloader.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44

55
namespace Wunderio\GrumPHP\Drupal;
66

7-
use DrupalFinder\DrupalFinder;
87
use Drupal\Core\DependencyInjection\ContainerNotInitializedException;
8+
use DrupalFinder\DrupalFinder;
99
use Drush\Drush;
10+
use mglaman\PHPStanDrupal\Drupal\Extension;
11+
use mglaman\PHPStanDrupal\Drupal\ExtensionDiscovery;
1012
use Nette\Utils\Finder;
1113
use PHPUnit\Framework\Test;
1214
use Symfony\Component\Yaml\Yaml;
13-
use mglaman\PHPStanDrupal\Drupal\Extension;
14-
use mglaman\PHPStanDrupal\Drupal\ExtensionDiscovery;
1515

1616
/**
1717
* Drupal autoloader for allowing Psalm to scan code.
Lines changed: 5 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
<?php
22

3-
declare(strict_types = 1);
3+
declare(strict_types=1);
44

55
namespace Wunderio\GrumPHP\Task;
66

77
use GrumPHP\Extension\ExtensionInterface;
8-
use Symfony\Component\DependencyInjection\ContainerBuilder;
9-
use Symfony\Component\DependencyInjection\Reference;
10-
use Symfony\Component\Yaml\Yaml;
118

129
/**
1310
* Class AbstractExternalExtensionLoader.
@@ -18,54 +15,13 @@
1815
*/
1916
abstract class AbstractExternalExtensionLoader implements ExtensionInterface {
2017

21-
/**
22-
* Name.
23-
*
24-
* @var string
25-
*/
26-
public $name;
27-
28-
/**
29-
* Construction arguments.
30-
*
31-
* @var array
32-
*/
33-
public $arguments;
34-
35-
/**
36-
* Task class.
37-
*
38-
* @var string
39-
*/
40-
public $class;
41-
42-
/**
43-
* AbstractExternalExtensionLoader constructor.
44-
*/
45-
public function __construct() {
46-
$tasks = Yaml::parseFile(__DIR__ . '/tasks.yml');
47-
$class_name = str_replace('ExtensionLoader', '', static::class);
48-
$this->class = $class_name . 'Task';
49-
$default_configuration = $tasks['default'];
50-
unset($default_configuration['name']);
51-
$configurations = $tasks[$this->class] ?? $default_configuration;
52-
$class_name = explode('\\', $class_name);
53-
$default_name = strtolower(preg_replace('/\B([A-Z])/', '_$1', end($class_name)));
54-
$this->name = $configurations['name'] ?? $default_name;
55-
$this->arguments = $configurations['arguments'] ?? $default_configuration['arguments'];
56-
}
57-
5818
/**
5919
* {@inheritdoc}
6020
*/
61-
public function load(ContainerBuilder $container): void {
62-
$task = $container->register('task.' . $this->name, $this->class);
63-
if (!empty($this->arguments)) {
64-
foreach ($this->arguments as $argument) {
65-
$task->addArgument(new Reference($argument));
66-
}
67-
}
68-
$task->addTag('grumphp.task', ['task' => $this->name]);
21+
public function imports(): iterable {
22+
$class_name = str_replace('ExtensionLoader', '', static::class);
23+
$class_exploded = explode('\\', $class_name);
24+
yield dirname(__DIR__) . '/Task/' . end($class_exploded) . '/services.yaml';
6925
}
7026

7127
}

src/Task/AbstractLintTask.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
declare(strict_types = 1);
3+
declare(strict_types=1);
44

55
namespace Wunderio\GrumPHP\Task;
66

src/Task/AbstractMultiPathProcessingTask.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
declare(strict_types = 1);
3+
declare(strict_types=1);
44

55
namespace Wunderio\GrumPHP\Task;
66

src/Task/AbstractProcessingTask.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
declare(strict_types = 1);
3+
declare(strict_types=1);
44

55
namespace Wunderio\GrumPHP\Task;
66

src/Task/AbstractSinglePathProcessingTask.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
declare(strict_types = 1);
3+
declare(strict_types=1);
44

55
namespace Wunderio\GrumPHP\Task;
66

src/Task/CheckFilePermissions/CheckFilePermissionsTask.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
declare(strict_types = 1);
3+
declare(strict_types=1);
44

55
namespace Wunderio\GrumPHP\Task\CheckFilePermissions;
66

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
services:
2+
Wunderio\GrumPHP\Task\CheckFilePermissions\CheckFilePermissionsTask:
3+
class: Wunderio\GrumPHP\Task\CheckFilePermissions\CheckFilePermissionsTask
4+
arguments:
5+
- '@process_builder'
6+
- '@formatter.raw_process'
7+
tags:
8+
- {name: grumphp.task, task: check_file_permissions}

0 commit comments

Comments
 (0)