Skip to content

Commit

Permalink
Add Symfony 4.0 support (nelmio#834)
Browse files Browse the repository at this point in the history
  • Loading branch information
theofidry authored Nov 4, 2017
1 parent 77f4466 commit 358543e
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,12 @@ matrix:
env: SYMFONY_VERSION='~3.3.0'
- php: '7.1'
env: SYMFONY_VERSION='~3.4.0@dev'
- php: '7.1'
env: SYMFONY_VERSION='~4.0.0@dev'
allow_failures:
- php: nightly
- env: SYMFONY_VERSION='~3.4.0@dev'
- env: SYMFONY_VERSION='~4.0.0@dev'

before_install:
- set -eo pipefail
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"phpspec/prophecy": "^1.6",
"phpunit/phpunit": "^6.0",
"symfony/phpunit-bridge": "^3.3 || ^4.0",
"symfony/var-dumper": "^3.2"
"symfony/var-dumper": "^3.2 || ^4.0"
},

"autoload": {
Expand Down
25 changes: 24 additions & 1 deletion fixtures/Bridge/Symfony/Application/AppKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
use Nelmio\Alice\Bridge\Symfony\NelmioAliceBundle;
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\HttpKernel\Kernel;

class AppKernel extends Kernel
Expand Down Expand Up @@ -45,7 +49,7 @@ public function registerBundles()
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function registerContainerConfiguration(LoaderInterface $loader)
{
Expand All @@ -54,6 +58,25 @@ public function registerContainerConfiguration(LoaderInterface $loader)
$loader->load($config);
}

/**
* @inheritdoc
*/
public function build(ContainerBuilder $container)
{
$container->addCompilerPass(new class implements CompilerPassInterface {
public function process(ContainerBuilder $container)
{
foreach ($container->getDefinitions() as $id => $definition) {
$definition->setPublic(true);
}

foreach ($container->getAliases() as $id => $definition) {
$definition->setPublic(true);
}
}
}, PassConfig::TYPE_OPTIMIZE);
}

public function setConfigurationResource(string $resource)
{
$this->config = $resource;
Expand Down
1 change: 0 additions & 1 deletion fixtures/Bridge/Symfony/Application/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ framework:
router:
resource: ~
strict_requirements: '%kernel.debug%'
trusted_proxies: ~
test: ~
session:
storage_id: session.storage.mock_file
Expand Down
1 change: 0 additions & 1 deletion fixtures/Bridge/Symfony/Application/config_custom.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ framework:
router:
resource: ~
strict_requirements: '%kernel.debug%'
trusted_proxies: ~
test: ~
session:
storage_id: session.storage.mock_file
Expand Down
2 changes: 1 addition & 1 deletion vendor-bin/symfony/composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"require-dev": {
"symfony/symfony": "^3.1",
"symfony/symfony": "^3.3 || ^4.0",
"theofidry/composer-inheritance-plugin": "^1.0"
},
"config": {
Expand Down

0 comments on commit 358543e

Please sign in to comment.