Skip to content

Commit b42ed1f

Browse files
authored
Merge pull request #369 from FriendsOfSymfony/build-cleanup
build for symfony 3.3 and only spellcheck in one build
2 parents a8a5cfa + 35d4b80 commit b42ed1f

File tree

3 files changed

+22
-8
lines changed

3 files changed

+22
-8
lines changed

.travis.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ php:
1919
- 7.1
2020

2121
env:
22-
- SYMFONY_VERSION='3.1.*'
22+
- SYMFONY_VERSION='3.3.*'
2323

2424
branches:
2525
only:
@@ -37,6 +37,7 @@ matrix:
3737
- SYMFONY_VERSION='3.1.*'
3838
- PHPUNIT_FLAGS="--coverage-clover=coverage.clover"
3939
- COVERAGE=true
40+
- DOCCHECK=true
4041
- php: 7.1
4142
env:
4243
- SYMFONY_VERSION='2.8.*'
@@ -60,8 +61,8 @@ before_script:
6061

6162
script:
6263
- SYMFONY_DEPRECATIONS_HELPER=weak vendor/bin/phpunit ${PHPUNIT_FLAGS}
63-
- make -C Resources/doc SPHINXOPTS='-nW' html
64-
- make -C Resources/doc spelling
64+
- if [[ "$DOCCHECK" = true ]]; then make -C Resources/doc SPHINXOPTS='-nW' html; fi
65+
- if [[ "$DOCCHECK" = true ]]; then make -C Resources/doc spelling; fi
6566

6667
after_script:
6768
- if [[ "$COVERAGE" = true ]]; then wget https://scrutinizer-ci.com/ocular.phar; fi

src/DependencyInjection/FOSHttpCacheExtension.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use FOS\HttpCacheBundle\Http\ResponseMatcher\ExpressionResponseMatcher;
1717
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
1818
use Symfony\Component\Config\FileLocator;
19+
use Symfony\Component\DependencyInjection\ChildDefinition;
1920
use Symfony\Component\DependencyInjection\ContainerBuilder;
2021
use Symfony\Component\DependencyInjection\Definition;
2122
use Symfony\Component\DependencyInjection\DefinitionDecorator;
@@ -227,10 +228,17 @@ private function createRequestMatcher(ContainerBuilder $container, $path = null,
227228
$id = $this->getAlias().'.request_matcher.'.md5($serialized).sha1($serialized);
228229

229230
if (!$container->hasDefinition($id)) {
230-
$container
231-
->setDefinition($id, new DefinitionDecorator($this->getAlias().'.request_matcher'))
232-
->setArguments($arguments)
233-
;
231+
if (class_exists(ChildDefinition::class)) {
232+
$container
233+
->setDefinition($id, new ChildDefinition($this->getAlias().'.request_matcher'))
234+
->setArguments($arguments)
235+
;
236+
} else {
237+
$container
238+
->setDefinition($id, new DefinitionDecorator($this->getAlias().'.request_matcher'))
239+
->setArguments($arguments)
240+
;
241+
}
234242
}
235243

236244
return new Reference($id);

tests/Unit/DependencyInjection/Compiler/HashGeneratorPassTest.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,12 @@ public function testConfigNoContext()
4444
$config = $this->getBaseConfig();
4545
$this->extension->load([$config], $container);
4646
$this->userContextListenerPass->process($container);
47-
$this->assertCount(21, $container->getDefinitions());
47+
if ($container->hasDefinition('service_container')) {
48+
// symfony 3.3+
49+
$this->assertCount(22, $container->getDefinitions());
50+
} else {
51+
$this->assertCount(21, $container->getDefinitions());
52+
}
4853
}
4954

5055
/**

0 commit comments

Comments
 (0)