8000 minor #45156 [DependencyInjection] Fix tests on PHP 7.1 (chalasr) · symfony/symfony@7eea1cb · GitHub
[go: up one dir, main page]

Skip to content

Commit 7eea1cb

Browse files
minor #45156 [DependencyInjection] Fix tests on PHP 7.1 (chalasr)
This PR was merged into the 4.4 branch. Discussion ---------- [DependencyInjection] Fix tests on PHP 7.1 | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Should make Appveyor green. The `object` typehint is 7.2+. Commits ------- 7bc9eb6 [DI] Fix tests on PHP 7.1
2 parents 6028b10 + 7bc9eb6 commit 7eea1cb

File tree

5 files changed

+58
-3
lines changed

5 files changed

+58
-3
lines changed

src/Symfony/Component/DependencyInjection/Tests/Fixtures/config/defaults.expected.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ services:
1515
- { name: t, a: b }
1616
autowire: true
1717
autoconfigure: true
18-
arguments: ['@bar', !tagged_iterator foo, !service { class: Baz }]
18+
arguments: ['@bar', !tagged_iterator foo]
1919
bar:
2020
class: Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Foo
2121
public: true
2222
tags:
2323
- { name: t, a: b }
2424
autowire: true
25-
arguments: [null, !tagged_iterator foo, !service { class: Baz }]
25+
arguments: [null, !tagged_iterator foo]
2626
calls:
2727
- [setFoo, ['@bar']]
2828

src/Symfony/Component/DependencyInjection/Tests/Fixtures/config/defaults.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
->tag('t', ['a' => 'b'])
1616
->bind(Foo::class, ref('bar'))
1717
->bind('iterable $foo', tagged_iterator('foo'))
18-
->bind('object $baz', inline('Baz'))
1918
->public();
2019

2120
$s->set(Foo::class)->args([ref('bar')])->public();
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
2+
services:
3+
service_container:
4+
class: Symfony\Component\DependencyInjection\ContainerInterface
5+
public: true
6+
synthetic: true
7+
App\BarService:
8+
class: App\BarService
9+
public: true
10+
arguments: [!service { class: FooClass }]
11+
Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Foo:
12+
class: Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Foo
13+
public: true
14+
tags:
15+
- { name: t, a: b }
16+
autowire: true
17+
autoconfigure: true
18+
arguments: ['@bar', !tagged_iterator foo, !service { class: Baz }]
19+
bar:
20+
class: Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Foo
21+
public: true
22+
tags:
23+
- { name: t, a: b }
24+
autowire: true
25+
arguments: [null, !tagged_iterator foo, !service { class: Baz }]
26+
calls:
27+
- [setFoo, ['@bar']]
28+
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
4+
5+
use Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Foo;
6+
7+
return function (ContainerConfigurator $c) {
8+
$c->import('basic.php');
9+
10+
$s = $c->services()->defaults()
11+
->public()
12+
->private()
13+
->autoconfigure()
14+
->autowire()
15+
->tag('t', ['a' => 'b'])
16+
->bind(Foo::class, ref('bar'))
17+
->bind('iterable $foo', tagged_iterator('foo'))
18+
->bind('object $baz', inline('Baz'))
19+
->public();
20+
21+
$s->set(Foo::class)->args([ref('bar')])->public();
22+
$s->set('bar', Foo::class)->call('setFoo')->autoconfigure(false);
23+
};

src/Symfony/Component/DependencyInjection/Tests/Loader/PhpFileLoaderTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ public function provideConfig()
7878
yield ['php7'];
7979
yield ['anonymous'];
8080
yield ['lazy_fqcn'];
81+
82+
// fixture uses PHP 7.2+ object typehint
83+
if (70200 <= \PHP_VERSION_ID) {
84+
yield ['inline_binding'];
85+
}
8186
}
8287

8388
public function testAutoConfigureAndChildDefinitionNotAllowed()

0 commit comments

Comments
 (0)
0