Skip to content

Commit d30266f

Browse files
Douglas Greenshieldsshieldo
authored andcommitted
drop symfony <2.8 support, and add symfony 3
1 parent ff09e68 commit d30266f

File tree

5 files changed

+38
-27
lines changed

5 files changed

+38
-27
lines changed

.travis.yml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
language: php
22

33
php:
4-
- 5.3
5-
- 5.4
6-
- 5.5
74
- 5.6
5+
- 7.0
6+
- 7.1
7+
- nightly
88

99
env:
10-
- SYMFONY_VERSION=2.6.*
11-
- SYMFONY_VERSION="dev-master symfony/debug:~2.7@dev symfony/http-kernel:~2.7@dev"
10+
- SYMFONY_VERSION=2.8.*
11+
- SYMFONY_VERSION=3.0.*
12+
- SYMFONY_VERSION=3.3.*
13+
- SYMFONY_VERSION=dev-master
1214

1315
before_script:
1416
- composer self-update
@@ -19,7 +21,3 @@ before_script:
1921

2022
script:
2123
- phpunit --coverage-text
22-
23-
matrix:
24-
allow_failures:
25-
- env: SYMFONY_VERSION="dev-master symfony/debug:~2.7@dev symfony/http-kernel:~2.7@dev"

composer.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
"ext-soap": "*",
2525
"ext-curl": "*",
2626
"ass/xmlsecurity": "~1.0",
27-
"symfony/framework-bundle": "~2.6",
28-
"symfony/twig-bundle": "~2.6",
27+
"symfony/framework-bundle": "^2.8|^3",
28+
"symfony/twig-bundle": "^2.8|^3",
2929
"zendframework/zend-mime": "2.2.*"
3030
},
3131
"replace": {
@@ -37,9 +37,9 @@
3737
},
3838
"require-dev": {
3939
"ext-mcrypt": "*",
40-
"mikey179/vfsStream": "~1.0",
41-
"symfony/filesystem": "~2.3",
42-
"symfony/process": "~2.3"
40+
"mikey179/vfsStream": "^1.6.5",
41+
"symfony/filesystem": "^2.8|^3",
42+
"symfony/process": "^2.8|^3"
4343
},
4444
"autoload": {
4545
"psr-0": { "BeSimple\\": "src/" }

src/BeSimple/SoapBundle/Controller/SoapWebServiceController.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use BeSimple\SoapBundle\Soap\SoapResponse;
1818
use BeSimple\SoapServer\SoapServerBuilder;
1919
use Symfony\Component\DependencyInjection\ContainerAware;
20+
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
2021
use Symfony\Component\HttpFoundation\Request;
2122
use Symfony\Component\HttpFoundation\Response;
2223
use Symfony\Component\HttpKernel\Exception\FlattenException;
@@ -28,8 +29,10 @@
2829
* @author Christian Kerl <[email protected]>
2930
* @author Francis Besset <[email protected]>
3031
*/
31-
class SoapWebServiceController extends ContainerAware
32+
class SoapWebServiceController
3233
{
34+
use ContainerAwareTrait;
35+
3336
/**
3437
* @var \SoapServer
3538
*/

src/BeSimple/SoapBundle/DependencyInjection/BeSimpleSoapExtension.php

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616

1717
use Symfony\Component\Config\Definition\Processor;
1818
use Symfony\Component\Config\FileLocator;
19+
use Symfony\Component\DependencyInjection\ChildDefinition;
1920
use Symfony\Component\DependencyInjection\ContainerBuilder;
21+
use Symfony\Component\DependencyInjection\Definition;
2022
use Symfony\Component\DependencyInjection\DefinitionDecorator;
2123
use Symfony\Component\DependencyInjection\Reference;
2224
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
@@ -83,7 +85,9 @@ private function registerClientConfiguration(array $config, ContainerBuilder $co
8385
$loader->load('client.xml');
8486

8587
foreach ($config as $client => $options) {
86-
$definition = new DefinitionDecorator('besimple.soap.client.builder');
88+
$childDefinitionClass = $this->getChildDefinitionClass();
89+
/** @var ChildDefinition $definition */
90+
$definition = new $childDefinitionClass('besimple.soap.client.builder');
8791
$container->setDefinition(sprintf('besimple.soap.client.builder.%s', $client), $definition);
8892

8993
$definition->replaceArgument(0, $options['wsdl']);
@@ -130,7 +134,9 @@ private function registerClientConfiguration(array $config, ContainerBuilder $co
130134

131135
private function createClientClassmap($client, array $classmap, ContainerBuilder $container)
132136
{
133-
$definition = new DefinitionDecorator('besimple.soap.classmap');
137+
$childDefinitionClass = $this->getChildDefinitionClass();
138+
/** @var Definition $definition */
139+
$definition = new $childDefinitionClass('besimple.soap.classmap');
134140
$container->setDefinition(sprintf('besimple.soap.classmap.%s', $client), $definition);
135141

136142
if (!empty($classmap)) {
@@ -144,13 +150,12 @@ private function createClientClassmap($client, array $classmap, ContainerBuilder
144150

145151
private function createClient($client, ContainerBuilder $container)
146152
{
147-
$definition = new DefinitionDecorator('besimple.soap.client');
153+
$childDefinitionClass = $this->getChildDefinitionClass();
154+
/** @var Definition $definition */
155+
$definition = new $childDefinitionClass('besimple.soap.client');
148156
$container->setDefinition(sprintf('besimple.soap.client.%s', $client), $definition);
149157

150-
$definition->setFactory(array(
151-
new Reference(sprintf('besimple.soap.client.builder.%s', $client)),
152-
'build'
153-
));
158+
$definition->setFactory([new Reference(sprintf('besimple.soap.client.builder.%s', $client)), 'build']);
154159
}
155160

156161
private function createWebServiceContext(array $config, ContainerBuilder $container)
@@ -159,7 +164,9 @@ private function createWebServiceContext(array $config, ContainerBuilder $contai
159164
unset($config['binding']);
160165

161166
$contextId = 'besimple.soap.context.'.$config['name'];
162-
$definition = new DefinitionDecorator('besimple.soap.context.'.$bindingSuffix);
167+
$childDefinitionClass = $this->getChildDefinitionClass();
168+
/** @var Definition $definition */
169+
$definition = new $childDefinitionClass('besimple.soap.context.'.$bindingSuffix);
163170
$container->setDefinition($contextId, $definition);
164171

165172
if (isset($config['cache_type'])) {
@@ -189,4 +196,9 @@ private function getCacheType($type)
189196
return Cache::TYPE_DISK_MEMORY;
190197
}
191198
}
199+
200+
private function getChildDefinitionClass()
201+
{
202+
return (class_exists(ChildDefinition::class)) ? ChildDefinition::class : DefinitionDecorator::class;
203+
}
192204
}

src/BeSimple/SoapBundle/Resources/config/routing/webservicecontroller.xml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,13 @@
44
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
55
xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">
66

7-
<route id="_webservice_call" pattern="/{webservice}">
7+
<route id="_webservice_call" path="/{webservice}" methods="POST">
88
<default key="_controller">BeSimpleSoapBundle:SoapWebService:Call</default>
99
<default key="_format">xml</default>
10-
<requirement key="_method">POST</requirement>
1110
</route>
1211

13-
<route id="_webservice_definition" pattern="/{webservice}">
12+
<route id="_webservice_definition" path="/{webservice}" methods="GET">
1413
<default key="_controller">BeSimpleSoapBundle:SoapWebService:Definition</default>
1514
<default key="_format">xml</default>
16-
<requirement key="_method">GET</requirement>
1715
</route>
1816
</routes>

0 commit comments

Comments
 (0)