Skip to content

Commit 1cdf786

Browse files
committed
Compatibility with grumphp 2.x
1 parent 516059d commit 1cdf786

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

config/extension.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
services:
2+
metadrop.grumphp_php_compatibility:
3+
class: Metadrop\PhpCompatibilityTask\PhpCompatibilityTask
4+
arguments:
5+
- '@process_builder'
6+
- '@formatter.raw_process'
7+
tags:
8+
- { name: grumphp.task, task: php_compatibility }

src/ExtensionLoader.php

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,12 @@
1313
*/
1414
class ExtensionLoader implements ExtensionInterface
1515
{
16+
1617
/**
17-
* @param ContainerBuilder $container
18-
*
19-
* @return \Symfony\Component\DependencyInjection\Definition
20-
* @throws \Exception
21-
* @throws \Symfony\Component\DependencyInjection\Exception\BadMethodCallException
22-
* @throws \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
23-
* @throws \Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException
24-
* @throws \Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException
18+
* {@inheritdoc}
2519
*/
26-
public function load(ContainerBuilder $container) : void
27-
{
28-
$container->register('task.php_compatibility', PhpCompatibilityTask::class)
29-
->addArgument(new Reference('process_builder'))
30-
->addArgument(new Reference('formatter.raw_process'))
31-
->addTag('grumphp.task', ['task' => 'php_compatibility']);
20+
public function imports(): iterable {
21+
yield dirname(__DIR__) . '/config/extension.yml';
3222
}
23+
3324
}

src/PhpCompatibilityTask.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use GrumPHP\Collection\ProcessArgumentsCollection;
88
use GrumPHP\Runner\TaskResult;
99
use GrumPHP\Runner\TaskResultInterface;
10+
use GrumPHP\Task\Config\ConfigOptionsResolver;
1011
use GrumPHP\Task\Context\ContextInterface;
1112
use GrumPHP\Task\Context\GitPreCommitContext;
1213
use GrumPHP\Task\Context\RunContext;
@@ -20,7 +21,7 @@ public function getName(): string
2021
return 'php_compatibility';
2122
}
2223

23-
public static function getConfigurableOptions(): OptionsResolver
24+
public static function getConfigurableOptions(): ConfigOptionsResolver
2425
{
2526
$resolver = new OptionsResolver();
2627
$resolver->setDefaults(
@@ -37,7 +38,7 @@ public static function getConfigurableOptions(): OptionsResolver
3738
$resolver->addAllowedTypes('report_width', ['null', 'int']);
3839
$resolver->addAllowedTypes('ignore_patterns', ['array']);
3940
$resolver->addAllowedTypes('codebase_path', 'string');
40-
return $resolver;
41+
return ConfigOptionsResolver::fromOptionsResolver($resolver);
4142
}
4243

4344
public function canRunInContext(ContextInterface $context): bool

0 commit comments

Comments
 (0)