Skip to content

Commit

Permalink
Merge pull request #4 from mybuilder/allow-symfony-4
Browse files Browse the repository at this point in the history
Allow Symfony 4
  • Loading branch information
rainerkraftmb authored Nov 13, 2019
2 parents 315261e + 6ea82ad commit 5326593
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 16 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ composer.lock
composer.phar
bin/
vendor/
var/
/Tests/Fixtures/app/cache/
13 changes: 6 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
language: php

php:
- 5.6
- 7.0
- 7.1
- 7.3

env:
- SYMFONY_VERSION=2.7.*
- SYMFONY_VERSION=2.8.*
- SYMFONY_VERSION=3.0.*
- SYMFONY_VERSION=3.1.*
- SYMFONY_VERSION=3.2.*
- SYMFONY_VERSION=3.4.*
- SYMFONY_VERSION=4.0.*
- SYMFONY_VERSION=4.2.*

before_script:
- composer require symfony/framework-bundle:${SYMFONY_VERSION}
- composer require symfony/console:${SYMFONY_VERSION}
- composer update symfony/console:${SYMFONY_VERSION}
- composer update symfony/framework-bundle:${SYMFONY_VERSION}

script: bin/phpunit
30 changes: 28 additions & 2 deletions Command/DumpCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,18 @@

namespace MyBuilder\Bundle\SupervisorBundle\Command;

use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
use Symfony\Component\DependencyInjection\ContainerInterface;

class DumpCommand extends ContainerAwareCommand
class DumpCommand extends Command implements ContainerAwareInterface
{
use ContainerAwareTrait;

protected function configure()
{
$this
Expand Down Expand Up @@ -45,4 +50,25 @@ private function parseOptions(InputInterface $input)

return $options;
}

/**
* @throws \LogicException
*/
protected function getContainer(): ContainerInterface
{
if (null === $this->container) {
$application = $this->getApplication();
if (null === $application) {
throw new \LogicException('The container cannot be retrieved as the application instance is not yet set.');
}

$this->container = $application->getKernel()->getContainer();

if (null === $this->container) {
throw new \LogicException('The container cannot be retrieved as the kernel has shut down.');
}
}

return $this->container;
}
}
2 changes: 1 addition & 1 deletion DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public function getConfigTreeBuilder()
->children()
->variableNode('program')->end()
->scalarNode('executor')->example('php')->end()
->scalarNode('console')->example('app/console')->end()
->scalarNode('console')->example('app/console (bin/console)')->end()
->end()
->end();

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![Build Status](https://travis-ci.org/mybuilder/supervisor-bundle.svg?branch=master)](https://travis-ci.org/mybuilder/supervisor-bundle)

A bundle for Symfony 2/3 which allows you to use `@Supervisor` annotations to configure how [Supervisor](http://supervisord.org/) runs your console commands.
A bundle for Symfony 2/3/4 which allows you to use `@Supervisor` annotations to configure how [Supervisor](http://supervisord.org/) runs your console commands.

## Installation

Expand Down
1 change: 1 addition & 0 deletions Resources/config/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ services:

mybuilder.supervisor_bundle.annotation_supervisor_exporter:
class: MyBuilder\Bundle\SupervisorBundle\Exporter\AnnotationSupervisorExporter
public: true
arguments:
- "@annotation_reader"
- "%mybuilder.supervisor_bundle.exporter_config%"
1 change: 0 additions & 1 deletion Tests/Command/DumpCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use MyBuilder\Bundle\SupervisorBundle\Tests\Fixtures\Command\TestCommand;
use MyBuilder\Bundle\SupervisorBundle\Tests\SupervisorTestCase;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Tester\CommandTester;

class DumpCommandTest extends SupervisorTestCase
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mybuilder/supervisor-bundle",
"description": "Symfony 2/3 bundle which allows you to use @Supervisor annotations to configure how Supervisor runs your console commands.",
"description": "Symfony 2/3/4 bundle which allows you to use @Supervisor annotations to configure how Supervisor runs your console commands.",
"keywords": ["supervisor", "supervisord"],
"minimum-stability": "stable",
"license": "MIT",
Expand All @@ -14,9 +14,9 @@
"require": {
"francodacosta/supervisord": "~1.0",
"doctrine/annotations": "~1.0",
"symfony/console": "~2.7|~3.0",
"symfony/framework-bundle": "~2.7|~3.0",
"php": ">=5.6.0"
"symfony/console": "~2.7 || ~3.0 || ~4.0",
"symfony/framework-bundle": "~2.7 || ~3.0 || ~4.0",
"php": "~7.0"
},
"require-dev": {
"phpunit/phpunit": "~5.0"
Expand Down

0 comments on commit 5326593

Please sign in to comment.