Update Composer, update everything

This commit is contained in:
Oliver Davies 2018-11-23 12:29:20 +00:00
parent ea3e94409f
commit dda5c284b6
19527 changed files with 1135420 additions and 351004 deletions

View file

@ -0,0 +1,23 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\DependencyInjection\Tests\Fixtures;
class Bar implements BarInterface
{
public function __construct($quz = null, \NonExistent $nonExistent = null, BarInterface $decorated = null, array $foo = array())
{
}
public static function create(\NonExistent $nonExistent = null, $factory = null)
{
}
}

View file

@ -0,0 +1,16 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\DependencyInjection\Tests\Fixtures;
interface BarInterface
{
}

View file

@ -0,0 +1,22 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\DependencyInjection\Tests\Fixtures;
class CaseSensitiveClass
{
public $identifier;
public function __construct($identifier = null)
{
$this->identifier = $identifier;
}
}

View file

@ -0,0 +1,10 @@
<?php
namespace Symfony\Component\DependencyInjection\Tests\Fixtures\Container;
class ConstructorWithMandatoryArgumentsContainer
{
public function __construct($mandatoryArgument)
{
}
}

View file

@ -0,0 +1,10 @@
<?php
namespace Symfony\Component\DependencyInjection\Tests\Fixtures\Container;
class ConstructorWithOptionalArgumentsContainer
{
public function __construct($optionalArgument = 'foo')
{
}
}

View file

@ -0,0 +1,10 @@
<?php
namespace Symfony\Component\DependencyInjection\Tests\Fixtures\Container;
class ConstructorWithoutArgumentsContainer
{
public function __construct()
{
}
}

View file

@ -0,0 +1,9 @@
<?php
namespace Symfony\Component\DependencyInjection\Tests\Fixtures\Container;
use Symfony\Component\DependencyInjection\Container;
class NoConstructorContainer extends Container
{
}

View file

@ -0,0 +1,18 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\DependencyInjection\Tests\Fixtures;
use Symfony\Component\DependencyInjection\Definition;
class CustomDefinition extends Definition
{
}

View file

@ -0,0 +1,18 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\DependencyInjection\Tests\Fixtures;
@trigger_error('deprecated', E_USER_DEPRECATED);
class DeprecatedClass
{
}

View file

@ -0,0 +1,44 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\DependencyInjection\Tests\Fixtures;
class FactoryDummy extends FactoryParent
{
public static function createFactory(): FactoryDummy
{
}
public function create(): \stdClass
{
}
// Not supported by hhvm
public function createBuiltin(): int
{
}
public static function createSelf(): self
{
}
public static function createParent(): parent
{
}
}
class FactoryParent
{
}
function factoryFunction(): FactoryDummy
{
}

View file

@ -0,0 +1,21 @@
<?php
namespace Symfony\Component\DependencyInjection\Tests\Fixtures;
/**
* @author Kévin Dunglas <dunglas@gmail.com>
*/
class NamedArgumentsDummy
{
public function __construct(CaseSensitiveClass $c, $apiKey, $hostName)
{
}
public function setApiKey($apiKey)
{
}
public function setSensitiveClass(CaseSensitiveClass $c)
{
}
}

View file

@ -0,0 +1,7 @@
<?php
namespace Symfony\Component\DependencyInjection\Tests\Fixtures;
class ParentNotExists extends \NotExists
{
}

View file

@ -0,0 +1,7 @@
<?php
namespace Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\BadClasses;
class MissingParent extends MissingClass
{
}

View file

@ -0,0 +1,14 @@
<?php
namespace Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype;
class Foo implements FooInterface, Sub\BarInterface
{
public function __construct($bar = null)
{
}
public function setFoo(self $foo)
{
}
}

View file

@ -0,0 +1,7 @@
<?php
namespace Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype;
interface FooInterface
{
}

View file

@ -0,0 +1,7 @@
<?php
namespace Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\OtherDir\AnotherSub;
class DeeperBaz
{
}

View file

@ -0,0 +1,7 @@
<?php
namespace Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\OtherDir;
class Baz
{
}

View file

@ -0,0 +1,7 @@
<?php
namespace Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\OtherDir\Component1\Dir1;
class Service1
{
}

View file

@ -0,0 +1,8 @@
<?php
namespace Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\OtherDir\Component1\Dir2;
class Service2
{
}

View file

@ -0,0 +1,8 @@
<?php
namespace Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\OtherDir\Component1\Dir3;
class Service3
{
}

View file

@ -0,0 +1,7 @@
<?php
namespace Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\OtherDir\Component2\Dir1;
class Service4
{
}

View file

@ -0,0 +1,8 @@
<?php
namespace Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\OtherDir\Component2\Dir2;
class Service5
{
}

View file

@ -0,0 +1,7 @@
<?php
namespace Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Sub;
class Bar implements BarInterface
{
}

View file

@ -0,0 +1,7 @@
<?php
namespace Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Sub;
interface BarInterface
{
}

View file

@ -0,0 +1,7 @@
<?php
namespace Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Sub;
abstract class NoLoadAbstractBar
{
}

View file

@ -0,0 +1,7 @@
<?php
namespace Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Sub;
interface NoLoadBarInterface
{
}

View file

@ -0,0 +1,7 @@
<?php
namespace Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Sub;
trait NoLoadBarTrait
{
}

View file

@ -0,0 +1,24 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\DependencyInjection\Tests\Fixtures;
class SimilarArgumentsDummy
{
public $class1;
public $class2;
public function __construct(CaseSensitiveClass $class1, $token, CaseSensitiveClass $class2)
{
$this->class1 = $class1;
$this->class2 = $class2;
}
}

View file

@ -0,0 +1,29 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\DependencyInjection\Tests\Fixtures;
use Psr\Container\ContainerInterface;
/**
* @author Iltar van der Berg <kjarli@gmail.com>
*/
class StubbedTranslator
{
public function __construct(ContainerInterface $container)
{
}
public function addResource($format, $resource, $locale, $domain = null)
{
}
}

View file

@ -0,0 +1,22 @@
<?php
namespace Symfony\Component\DependencyInjection\Tests\Fixtures;
use Symfony\Component\DependencyInjection\ServiceSubscriberInterface;
class TestServiceSubscriber implements ServiceSubscriberInterface
{
public function __construct($container)
{
}
public static function getSubscribedServices()
{
return array(
__CLASS__,
'?'.CustomDefinition::class,
'bar' => CustomDefinition::class,
'baz' => '?'.CustomDefinition::class,
);
}
}

View file

@ -0,0 +1 @@
[123, "abc"]

View file

@ -0,0 +1,10 @@
services:
service_container:
class: Symfony\Component\DependencyInjection\ContainerInterface
public: true
synthetic: true
App\BarService:
class: App\BarService
public: true
arguments: [!service { class: FooClass }]

View file

@ -0,0 +1,11 @@
<?php
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
use App\BarService;
return function (ContainerConfigurator $c) {
$s = $c->services();
$s->set(BarService::class)
->args(array(inline('FooClass')));
};

View file

@ -0,0 +1,15 @@
services:
service_container:
class: Symfony\Component\DependencyInjection\ContainerInterface
public: true
synthetic: true
foo:
class: Class2
public: true
file: file.php
lazy: true
arguments: [!service { class: Class1, public: false }]
bar:
alias: foo
public: true

View file

@ -0,0 +1,22 @@
<?php
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
use App\BarService;
return function (ContainerConfigurator $c) {
$c->services()
->set('bar', 'Class1')
->set(BarService::class)
->abstract(true)
->lazy()
->set('foo')
->parent(BarService::class)
->decorate('bar', 'b', 1)
->args(array(ref('b')))
->class('Class2')
->file('file.php')
->parent('bar')
->parent(BarService::class)
;
};

View file

@ -0,0 +1,27 @@
services:
service_container:
class: Symfony\Component\DependencyInjection\ContainerInterface
public: true
synthetic: true
App\BarService:
class: App\BarService
public: true
arguments: [!service { class: FooClass }]
Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Foo:
class: Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Foo
public: true
tags:
- { name: t, a: b }
autowire: true
autoconfigure: true
arguments: ['@bar']
bar:
class: Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Foo
public: false
tags:
- { name: t, a: b }
autowire: true
calls:
- [setFoo, ['@bar']]

View file

@ -0,0 +1,21 @@
<?php
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
use Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Foo;
return function (ContainerConfigurator $c) {
$c->import('basic.php');
$s = $c->services()->defaults()
->public()
->private()
->autoconfigure()
->autowire()
->tag('t', array('a' => 'b'))
->bind(Foo::class, ref('bar'))
->private();
$s->set(Foo::class)->args(array(ref('bar')))->public();
$s->set('bar', Foo::class)->call('setFoo')->autoconfigure(false);
};

View file

@ -0,0 +1,9 @@
<?php
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
return function (ContainerConfigurator $c) {
$c->services()
->set('service', \stdClass::class)
->factory('factory:method');
};

View file

@ -0,0 +1,21 @@
services:
service_container:
class: Symfony\Component\DependencyInjection\ContainerInterface
public: true
synthetic: true
Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Foo:
class: Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Foo
public: true
tags:
- { name: tag, k: v }
lazy: true
properties: { p: 1 }
calls:
- [setFoo, ['@foo']]
shared: false
configurator: c
foo:
class: App\FooService
public: true

View file

@ -0,0 +1,22 @@
<?php
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
use App\FooService;
use Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype;
return function (ContainerConfigurator $c) {
$s = $c->services();
$s->instanceof(Prototype\Foo::class)
->property('p', 0)
->call('setFoo', array(ref('foo')))
->tag('tag', array('k' => 'v'))
->share(false)
->lazy()
->configurator('c')
->property('p', 1);
$s->load(Prototype::class.'\\', '../Prototype')->exclude('../Prototype/*/*');
$s->set('foo', FooService::class);
};

View file

@ -0,0 +1,19 @@
parameters:
foo: Foo
bar: Bar
services:
service_container:
class: Symfony\Component\DependencyInjection\ContainerInterface
public: true
synthetic: true
Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Foo:
class: Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Foo
public: true
arguments: ['@bar']
bar:
class: Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Foo
public: true
calls:
- [setFoo, { }]

View file

@ -0,0 +1,19 @@
<?php
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
use Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Foo;
return function (ContainerConfigurator $c) {
$c->parameters()
('foo', 'Foo')
('bar', 'Bar')
;
$c->services()
(Foo::class)
->arg('$bar', ref('bar'))
->public()
('bar', Foo::class)
->call('setFoo')
;
};

View file

@ -0,0 +1,25 @@
services:
service_container:
class: Symfony\Component\DependencyInjection\ContainerInterface
public: true
synthetic: true
Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Foo:
class: Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Foo
public: true
tags:
- { name: foo }
- { name: baz }
deprecated: '%service_id%'
arguments: [1]
factory: f
Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Sub\Bar:
class: Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Sub\Bar
public: true
tags:
- { name: foo }
- { name: baz }
deprecated: '%service_id%'
lazy: true
arguments: [1]
factory: f

View file

@ -0,0 +1,22 @@
<?php
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
use Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype;
return function (ContainerConfigurator $c) {
$di = $c->services()->defaults()
->tag('baz');
$di->load(Prototype::class.'\\', '../Prototype')
->autoconfigure()
->exclude('../Prototype/{OtherDir,BadClasses}')
->factory('f')
->deprecate('%service_id%')
->args(array(0))
->args(array(1))
->autoconfigure(false)
->tag('foo')
->parent('foo');
$di->set('foo')->lazy()->abstract();
$di->get(Prototype\Foo::class)->lazy(false);
};

View file

@ -0,0 +1,128 @@
<?php
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
use Bar\FooClass;
use Symfony\Component\DependencyInjection\Parameter;
require_once __DIR__.'/../includes/classes.php';
require_once __DIR__.'/../includes/foo.php';
return function (ContainerConfigurator $c) {
$p = $c->parameters();
$p->set('baz_class', 'BazClass');
$p->set('foo_class', FooClass::class)
->set('foo', 'bar');
$s = $c->services();
$s->set('foo')
->args(array('foo', ref('foo.baz'), array('%foo%' => 'foo is %foo%', 'foobar' => '%foo%'), true, ref('service_container')))
->class(FooClass::class)
->tag('foo', array('foo' => 'foo'))
->tag('foo', array('bar' => 'bar', 'baz' => 'baz'))
->factory(array(FooClass::class, 'getInstance'))
->property('foo', 'bar')
->property('moo', ref('foo.baz'))
->property('qux', array('%foo%' => 'foo is %foo%', 'foobar' => '%foo%'))
->call('setBar', array(ref('bar')))
->call('initialize')
->configurator('sc_configure');
$s->set('foo.baz', '%baz_class%')
->factory(array('%baz_class%', 'getInstance'))
->configurator(array('%baz_class%', 'configureStatic1'));
$s->set('bar', FooClass::class)
->args(array('foo', ref('foo.baz'), new Parameter('foo_bar')))
->configurator(array(ref('foo.baz'), 'configure'));
$s->set('foo_bar', '%foo_class%')
->args(array(ref('deprecated_service')))
->share(false);
$s->set('method_call1', 'Bar\FooClass')
->file(realpath(__DIR__.'/../includes/foo.php'))
->call('setBar', array(ref('foo')))
->call('setBar', array(ref('foo2')->nullOnInvalid()))
->call('setBar', array(ref('foo3')->ignoreOnInvalid()))
->call('setBar', array(ref('foobaz')->ignoreOnInvalid()))
->call('setBar', array(expr('service("foo").foo() ~ (container.hasParameter("foo") ? parameter("foo") : "default")')));
$s->set('foo_with_inline', 'Foo')
->call('setBar', array(ref('inlined')));
$s->set('inlined', 'Bar')
->property('pub', 'pub')
->call('setBaz', array(ref('baz')))
->private();
$s->set('baz', 'Baz')
->call('setFoo', array(ref('foo_with_inline')));
$s->set('request', 'Request')
->synthetic();
$s->set('configurator_service', 'ConfClass')
->private()
->call('setFoo', array(ref('baz')));
$s->set('configured_service', 'stdClass')
->configurator(array(ref('configurator_service'), 'configureStdClass'));
$s->set('configurator_service_simple', 'ConfClass')
->args(array('bar'))
->private();
$s->set('configured_service_simple', 'stdClass')
->configurator(array(ref('configurator_service_simple'), 'configureStdClass'));
$s->set('decorated', 'stdClass');
$s->set('decorator_service', 'stdClass')
->decorate('decorated');
$s->set('decorator_service_with_name', 'stdClass')
->decorate('decorated', 'decorated.pif-pouf');
$s->set('deprecated_service', 'stdClass')
->deprecate();
$s->set('new_factory', 'FactoryClass')
->property('foo', 'bar')
->private();
$s->set('factory_service', 'Bar')
->factory(array(ref('foo.baz'), 'getInstance'));
$s->set('new_factory_service', 'FooBarBaz')
->property('foo', 'bar')
->factory(array(ref('new_factory'), 'getInstance'));
$s->set('service_from_static_method', 'Bar\FooClass')
->factory(array('Bar\FooClass', 'getInstance'));
$s->set('factory_simple', 'SimpleFactoryClass')
->deprecate()
->args(array('foo'))
->private();
$s->set('factory_service_simple', 'Bar')
->factory(array(ref('factory_simple'), 'getInstance'));
$s->set('lazy_context', 'LazyContext')
->args(array(iterator(array('k1' => ref('foo.baz'), 'k2' => ref('service_container'))), iterator(array())));
$s->set('lazy_context_ignore_invalid_ref', 'LazyContext')
->args(array(iterator(array(ref('foo.baz'), ref('invalid')->ignoreOnInvalid())), iterator(array())));
$s->set('tagged_iterator_foo', 'Bar')
->private()
->tag('foo');
$s->set('tagged_iterator', 'Bar')
->public()
->args(array(tagged('foo')));
$s->alias('alias_for_foo', 'foo')->private()->public();
$s->alias('alias_for_alias', ref('alias_for_foo'));
};

View file

@ -0,0 +1,9 @@
<?php
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
return function (ContainerConfigurator $c) {
$c->services()
->set('parent_service', \stdClass::class)
->set('child_service')->parent('parent_service')->autoconfigure(true);
};

View file

@ -0,0 +1,17 @@
<?php
namespace Symfony\Component\DependencyInjection\Tests\Fixtures\containers;
use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
class CustomContainer extends Container
{
public function getBarService()
{
}
public function getFoobarService()
{
}
}

View file

@ -0,0 +1,15 @@
<?php
require_once __DIR__.'/../includes/classes.php';
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
$container = new ContainerBuilder();
$container->
register('foo', 'FooClass')->
addArgument(new Reference('bar'))
->setPublic(true)
;
return $container;

View file

@ -0,0 +1,13 @@
<?php
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
$container = new ContainerBuilder();
$container->
register('foo', 'FooClass')->
addArgument(new Definition('BarClass', array(new Definition('BazClass'))))
->setPublic(true)
;
return $container;

View file

@ -0,0 +1,13 @@
<?php
use Symfony\Component\DependencyInjection\ContainerBuilder;
$container = new ContainerBuilder();
$container->
register('foo', 'FooClass\\Foo')->
addArgument('foo<>&bar')->
addTag('foo"bar\\bar', array('foo' => 'foo"barřž€'))
->setPublic(true)
;
return $container;

View file

@ -0,0 +1,18 @@
<?php
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
$container = new ContainerBuilder();
$container->
register('foo', 'FooClass')->
addArgument(new Reference('bar'))
->setPublic(true)
;
$container->
register('bar', 'BarClass')
->setPublic(true)
;
$container->compile();
return $container;

View file

@ -0,0 +1,17 @@
<?php
namespace Container14;
use Symfony\Component\DependencyInjection\ContainerBuilder;
/*
* This file is included in Tests\Dumper\GraphvizDumperTest::testDumpWithFrozenCustomClassContainer
* and Tests\Dumper\XmlDumperTest::testCompiledContainerCanBeDumped.
*/
if (!class_exists('Container14\ProjectServiceContainer')) {
class ProjectServiceContainer extends ContainerBuilder
{
}
}
return new ProjectServiceContainer();

View file

@ -0,0 +1,12 @@
<?php
use Symfony\Component\DependencyInjection\ContainerBuilder;
$container = new ContainerBuilder();
$container
->register('foo', 'FooClass\\Foo')
->setDecoratedService('bar', 'bar.woozy')
->setPublic(true)
;
return $container;

View file

@ -0,0 +1,12 @@
<?php
use Symfony\Component\DependencyInjection\ContainerBuilder;
$container = new ContainerBuilder();
$container
->register('foo', 'FooClass\\Foo')
->setDecoratedService('bar')
->setPublic(true)
;
return $container;

View file

@ -0,0 +1,11 @@
<?php
use Symfony\Component\DependencyInjection\ContainerBuilder;
$container = new ContainerBuilder();
$container
->register('foo', '%foo.class%')
->setPublic(true)
;
return $container;

View file

@ -0,0 +1,27 @@
<?php
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
require_once __DIR__.'/../includes/classes.php';
$container = new ContainerBuilder();
$container->setParameter('env(FOO)', 'Bar\FaooClass');
$container->setParameter('foo', '%env(FOO)%');
$container
->register('service_from_anonymous_factory', '%foo%')
->setFactory(array(new Definition('%foo%'), 'getInstance'))
->setPublic(true)
;
$anonymousServiceWithFactory = new Definition('Bar\FooClass');
$anonymousServiceWithFactory->setFactory('Bar\FooClass::getInstance');
$container
->register('service_with_method_call_and_factory', 'Bar\FooClass')
->addMethodCall('setBar', array($anonymousServiceWithFactory))
->setPublic(true)
;
return $container;

View file

@ -0,0 +1,21 @@
<?php
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
$container = new ContainerBuilder();
$bar = new Definition('Bar');
$bar->setConfigurator(array(new Definition('Baz'), 'configureBar'));
$fooFactory = new Definition('FooFactory');
$fooFactory->setFactory(array(new Definition('Foobar'), 'createFooFactory'));
$container
->register('foo', 'Foo')
->setFactory(array($fooFactory, 'createFoo'))
->setConfigurator(array($bar, 'configureFoo'))
->setPublic(true)
;
return $container;

View file

@ -0,0 +1,13 @@
<?php
use Symfony\Component\DependencyInjection\ContainerBuilder;
$container = new ContainerBuilder();
$container
->register('foo', 'Foo')
->setAutowired(true)
->setPublic(true)
;
return $container;

View file

@ -0,0 +1,12 @@
<?php
namespace Symfony\Component\DependencyInjection\Tests\Fixtures\Container33;
use Symfony\Component\DependencyInjection\ContainerBuilder;
$container = new ContainerBuilder();
$container->register(\Foo\Foo::class)->setPublic(true);
$container->register(\Bar\Foo::class)->setPublic(true);
return $container;

View file

@ -0,0 +1,14 @@
<?php
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
$container = new ContainerBuilder(new ParameterBag(array(
'foo' => '%baz%',
'baz' => 'bar',
'bar' => 'foo is %%foo bar',
'escape' => '@escapeme',
'values' => array(true, false, null, 0, 1000.3, 'true', 'false', 'null'),
)));
return $container;

View file

@ -0,0 +1,176 @@
<?php
require_once __DIR__.'/../includes/classes.php';
require_once __DIR__.'/../includes/foo.php';
use Symfony\Component\DependencyInjection\Argument\IteratorArgument;
use Symfony\Component\DependencyInjection\Argument\TaggedIteratorArgument;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\DependencyInjection\Parameter;
use Symfony\Component\ExpressionLanguage\Expression;
$container = new ContainerBuilder();
$container
->register('foo', '\Bar\FooClass')
->addTag('foo', array('foo' => 'foo'))
->addTag('foo', array('bar' => 'bar', 'baz' => 'baz'))
->setFactory(array('Bar\\FooClass', 'getInstance'))
->setArguments(array('foo', new Reference('foo.baz'), array('%foo%' => 'foo is %foo%', 'foobar' => '%foo%'), true, new Reference('service_container')))
->setProperties(array('foo' => 'bar', 'moo' => new Reference('foo.baz'), 'qux' => array('%foo%' => 'foo is %foo%', 'foobar' => '%foo%')))
->addMethodCall('setBar', array(new Reference('bar')))
->addMethodCall('initialize')
->setConfigurator('sc_configure')
->setPublic(true)
;
$container
->register('foo.baz', '%baz_class%')
->setFactory(array('%baz_class%', 'getInstance'))
->setConfigurator(array('%baz_class%', 'configureStatic1'))
->setPublic(true)
;
$container
->register('bar', 'Bar\FooClass')
->setArguments(array('foo', new Reference('foo.baz'), new Parameter('foo_bar')))
->setConfigurator(array(new Reference('foo.baz'), 'configure'))
->setPublic(true)
;
$container
->register('foo_bar', '%foo_class%')
->addArgument(new Reference('deprecated_service'))
->setShared(false)
->setPublic(true)
;
$container->getParameterBag()->clear();
$container->getParameterBag()->add(array(
'baz_class' => 'BazClass',
'foo_class' => 'Bar\FooClass',
'foo' => 'bar',
));
$container
->register('method_call1', 'Bar\FooClass')
->setFile(realpath(__DIR__.'/../includes/foo.php'))
->addMethodCall('setBar', array(new Reference('foo')))
->addMethodCall('setBar', array(new Reference('foo2', ContainerInterface::NULL_ON_INVALID_REFERENCE)))
->addMethodCall('setBar', array(new Reference('foo3', ContainerInterface::IGNORE_ON_INVALID_REFERENCE)))
->addMethodCall('setBar', array(new Reference('foobaz', ContainerInterface::IGNORE_ON_INVALID_REFERENCE)))
->addMethodCall('setBar', array(new Expression('service("foo").foo() ~ (container.hasParameter("foo") ? parameter("foo") : "default")')))
->setPublic(true)
;
$container
->register('foo_with_inline', 'Foo')
->addMethodCall('setBar', array(new Reference('inlined')))
->setPublic(true)
;
$container
->register('inlined', 'Bar')
->setProperty('pub', 'pub')
->addMethodCall('setBaz', array(new Reference('baz')))
->setPublic(false)
;
$container
->register('baz', 'Baz')
->addMethodCall('setFoo', array(new Reference('foo_with_inline')))
->setPublic(true)
;
$container
->register('request', 'Request')
->setSynthetic(true)
->setPublic(true)
;
$container
->register('configurator_service', 'ConfClass')
->setPublic(false)
->addMethodCall('setFoo', array(new Reference('baz')))
;
$container
->register('configured_service', 'stdClass')
->setConfigurator(array(new Reference('configurator_service'), 'configureStdClass'))
->setPublic(true)
;
$container
->register('configurator_service_simple', 'ConfClass')
->addArgument('bar')
->setPublic(false)
;
$container
->register('configured_service_simple', 'stdClass')
->setConfigurator(array(new Reference('configurator_service_simple'), 'configureStdClass'))
->setPublic(true)
;
$container
->register('decorated', 'stdClass')
->setPublic(true)
;
$container
->register('decorator_service', 'stdClass')
->setDecoratedService('decorated')
->setPublic(true)
;
$container
->register('decorator_service_with_name', 'stdClass')
->setDecoratedService('decorated', 'decorated.pif-pouf')
->setPublic(true)
;
$container
->register('deprecated_service', 'stdClass')
->setDeprecated(true)
->setPublic(true)
;
$container
->register('new_factory', 'FactoryClass')
->setProperty('foo', 'bar')
->setPublic(false)
;
$container
->register('factory_service', 'Bar')
->setFactory(array(new Reference('foo.baz'), 'getInstance'))
->setPublic(true)
;
$container
->register('new_factory_service', 'FooBarBaz')
->setProperty('foo', 'bar')
->setFactory(array(new Reference('new_factory'), 'getInstance'))
->setPublic(true)
;
$container
->register('service_from_static_method', 'Bar\FooClass')
->setFactory(array('Bar\FooClass', 'getInstance'))
->setPublic(true)
;
$container
->register('factory_simple', 'SimpleFactoryClass')
->addArgument('foo')
->setDeprecated(true)
->setPublic(false)
;
$container
->register('factory_service_simple', 'Bar')
->setFactory(array(new Reference('factory_simple'), 'getInstance'))
->setPublic(true)
;
$container
->register('lazy_context', 'LazyContext')
->setArguments(array(new IteratorArgument(array('k1' => new Reference('foo.baz'), 'k2' => new Reference('service_container'))), new IteratorArgument(array())))
->setPublic(true)
;
$container
->register('lazy_context_ignore_invalid_ref', 'LazyContext')
->setArguments(array(new IteratorArgument(array(new Reference('foo.baz'), new Reference('invalid', ContainerInterface::IGNORE_ON_INVALID_REFERENCE))), new IteratorArgument(array())))
->setPublic(true)
;
$container
->register('tagged_iterator_foo', 'Bar')
->addTag('foo')
->setPublic(false)
;
$container
->register('tagged_iterator', 'Bar')
->addArgument(new TaggedIteratorArgument('foo'))
->setPublic(true)
;
$container->setAlias('alias_for_foo', 'foo')->setPublic(true);
$container->setAlias('alias_for_alias', 'alias_for_foo')->setPublic(true);
return $container;

View file

@ -0,0 +1,13 @@
<?php
use Symfony\Component\DependencyInjection\ContainerBuilder;
$container = new ContainerBuilder();
$container
->register('foo', 'Foo')
->setAbstract(true)
->setPublic(true)
;
return $container;

View file

@ -0,0 +1,118 @@
<?php
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Dumper\PhpDumper;
use Symfony\Component\DependencyInjection\Reference;
$public = 'public' === $visibility;
$container = new ContainerBuilder();
// same visibility for deps
$container->register('foo', FooCircular::class)->setPublic(true)
->addArgument(new Reference('bar'));
$container->register('bar', BarCircular::class)->setPublic($public)
->addMethodCall('addFoobar', array(new Reference('foobar')));
$container->register('foobar', FoobarCircular::class)->setPublic($public)
->addArgument(new Reference('foo'));
// mixed visibility for deps
$container->register('foo2', FooCircular::class)->setPublic(true)
->addArgument(new Reference('bar2'));
$container->register('bar2', BarCircular::class)->setPublic(!$public)
->addMethodCall('addFoobar', array(new Reference('foobar2')));
$container->register('foobar2', FoobarCircular::class)->setPublic($public)
->addArgument(new Reference('foo2'));
// simple inline setter with internal reference
$container->register('bar3', BarCircular::class)->setPublic(true)
->addMethodCall('addFoobar', array(new Reference('foobar3'), new Reference('foobar3')));
$container->register('foobar3', FoobarCircular::class)->setPublic($public);
// loop with non-shared dep
$container->register('foo4', 'stdClass')->setPublic($public)
->setShared(false)
->setProperty('foobar', new Reference('foobar4'));
$container->register('foobar4', 'stdClass')->setPublic(true)
->addArgument(new Reference('foo4'));
// loop on the constructor of a setter-injected dep with property
$container->register('foo5', 'stdClass')->setPublic(true)
->setProperty('bar', new Reference('bar5'));
$container->register('bar5', 'stdClass')->setPublic($public)
->addArgument(new Reference('foo5'))
->setProperty('foo', new Reference('foo5'));
// doctrine-like event system + some extra
$container->register('manager', 'stdClass')->setPublic(true)
->addArgument(new Reference('connection'));
$container->register('logger', 'stdClass')->setPublic(true)
->addArgument(new Reference('connection'))
->setProperty('handler', (new Definition('stdClass'))->addArgument(new Reference('manager')))
;
$container->register('connection', 'stdClass')->setPublic(true)
->addArgument(new Reference('dispatcher'))
->addArgument(new Reference('config'));
$container->register('config', 'stdClass')->setPublic(false)
->setProperty('logger', new Reference('logger'));
$container->register('dispatcher', 'stdClass')->setPublic($public)
->setLazy($public)
->setProperty('subscriber', new Reference('subscriber'));
$container->register('subscriber', 'stdClass')->setPublic(true)
->addArgument(new Reference('manager'));
// doctrine-like event system + some extra (bis)
$container->register('manager2', 'stdClass')->setPublic(true)
->addArgument(new Reference('connection2'));
$container->register('logger2', 'stdClass')->setPublic(false)
->addArgument(new Reference('connection2'))
->setProperty('handler2', (new Definition('stdClass'))->addArgument(new Reference('manager2')))
;
$container->register('connection2', 'stdClass')->setPublic(true)
->addArgument(new Reference('dispatcher2'))
->addArgument(new Reference('config2'));
$container->register('config2', 'stdClass')->setPublic(false)
->setProperty('logger2', new Reference('logger2'));
$container->register('dispatcher2', 'stdClass')->setPublic($public)
->setLazy($public)
->setProperty('subscriber2', new Reference('subscriber2'));
$container->register('subscriber2', 'stdClass')->setPublic(false)
->addArgument(new Reference('manager2'));
// private service involved in a loop
$container->register('foo6', 'stdClass')
->setPublic(true)
->setProperty('bar6', new Reference('bar6'));
$container->register('bar6', 'stdClass')
->setPublic(false)
->addArgument(new Reference('foo6'));
$container->register('baz6', 'stdClass')
->setPublic(true)
->setProperty('bar6', new Reference('bar6'));
return $container;

View file

@ -0,0 +1,22 @@
<?php
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Dumper\PhpDumper;
use Symfony\Component\DependencyInjection\Reference;
$container = new ContainerBuilder();
$container->setParameter('env(BAR)', 'bar');
$container->register('foo', 'stdClass')->setPublic(true)
->addArgument(new Reference('bar_%env(BAR)%'))
->addArgument(array('baz_%env(BAR)%' => new Reference('baz_%env(BAR)%')));
$container->register('bar', 'stdClass')->setPublic(true)
->addArgument(new Reference('bar_%env(BAR)%'));
$container->register('bar_%env(BAR)%', 'stdClass')->setPublic(false);
$container->register('baz_%env(BAR)%', 'stdClass')->setPublic(false);
return $container;

View file

@ -0,0 +1,19 @@
<?php
namespace Symfony\Tests\InlineRequires;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Dumper\PhpDumper;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath;
use Symfony\Component\DependencyInjection\Tests\Fixtures\ParentNotExists;
$container = new ContainerBuilder();
$container->register(HotPath\C1::class)->addTag('container.hot_path')->setPublic(true);
$container->register(HotPath\C2::class)->addArgument(new Reference(HotPath\C3::class))->setPublic(true);
$container->register(HotPath\C3::class);
$container->register(ParentNotExists::class)->setPublic(true);
return $container;

View file

@ -0,0 +1,49 @@
<?php
use Symfony\Component\DependencyInjection\Argument\IteratorArgument;
use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
$container = new ContainerBuilder();
$container
->register('foo1', 'stdClass')
->setPublic(true)
;
$container
->register('foo2', 'stdClass')
->setPublic(false)
;
$container
->register('foo3', 'stdClass')
->setPublic(false)
;
$container
->register('baz', 'stdClass')
->setProperty('foo3', new Reference('foo3'))
->setPublic(true)
;
$container
->register('bar', 'stdClass')
->setProperty('foo1', new Reference('foo1', $container::IGNORE_ON_UNINITIALIZED_REFERENCE))
->setProperty('foo2', new Reference('foo2', $container::IGNORE_ON_UNINITIALIZED_REFERENCE))
->setProperty('foo3', new Reference('foo3', $container::IGNORE_ON_UNINITIALIZED_REFERENCE))
->setProperty('closures', array(
new ServiceClosureArgument(new Reference('foo1', $container::IGNORE_ON_UNINITIALIZED_REFERENCE)),
new ServiceClosureArgument(new Reference('foo2', $container::IGNORE_ON_UNINITIALIZED_REFERENCE)),
new ServiceClosureArgument(new Reference('foo3', $container::IGNORE_ON_UNINITIALIZED_REFERENCE)),
))
->setProperty('iter', new IteratorArgument(array(
'foo1' => new Reference('foo1', $container::IGNORE_ON_UNINITIALIZED_REFERENCE),
'foo2' => new Reference('foo2', $container::IGNORE_ON_UNINITIALIZED_REFERENCE),
'foo3' => new Reference('foo3', $container::IGNORE_ON_UNINITIALIZED_REFERENCE),
)))
->setPublic(true)
;
return $container;

View file

@ -0,0 +1,2 @@
imports:
- { resource: ../recurse/ }

View file

@ -0,0 +1,2 @@
[parameters]
ini = ini

View file

@ -0,0 +1,2 @@
parameters:
yaml: yaml

View file

@ -0,0 +1,3 @@
<?php
$container->setParameter('php', 'php');

View file

@ -0,0 +1,7 @@
digraph sc {
ratio="compress"
node [fontsize="11" fontname="Arial" shape="record"];
edge [fontsize="9" fontname="Arial" color="grey" arrowhead="open" arrowsize="0.5"];
node_service_container [label="service_container (Psr\Container\ContainerInterface, Symfony\Component\DependencyInjection\ContainerInterface)\nSymfony\\Component\\DependencyInjection\\ContainerInterface\n", shape=record, fillcolor="#eeeeee", style="filled"];
}

View file

@ -0,0 +1,10 @@
digraph sc {
ratio="normal"
node [fontsize="13" fontname="Verdana" shape="square"];
edge [fontsize="12" fontname="Verdana" color="white" arrowhead="closed" arrowsize="1"];
node_service_container [label="service_container (Psr\Container\ContainerInterface, Symfony\Component\DependencyInjection\ContainerInterface)\nSymfony\\Component\\DependencyInjection\\ContainerInterface\n", shape=square, fillcolor="grey", style="filled"];
node_foo [label="foo\nFooClass\n", shape=square, fillcolor="grey", style="filled"];
node_bar [label="bar\n\n", shape=square, fillcolor="red", style="empty"];
node_foo -> node_bar [label="" style="filled"];
}

View file

@ -0,0 +1,10 @@
digraph sc {
ratio="compress"
node [fontsize="11" fontname="Arial" shape="record"];
edge [fontsize="9" fontname="Arial" color="grey" arrowhead="open" arrowsize="0.5"];
node_service_container [label="service_container (Psr\Container\ContainerInterface, Symfony\Component\DependencyInjection\ContainerInterface)\nSymfony\\Component\\DependencyInjection\\ContainerInterface\n", shape=record, fillcolor="#eeeeee", style="filled"];
node_foo [label="foo\nFooClass\n", shape=record, fillcolor="#eeeeee", style="filled"];
node_bar [label="bar\n\n", shape=record, fillcolor="#ff9999", style="filled"];
node_foo -> node_bar [label="" style="filled"];
}

View file

@ -0,0 +1,10 @@
digraph sc {
ratio="compress"
node [fontsize="11" fontname="Arial" shape="record"];
edge [fontsize="9" fontname="Arial" color="grey" arrowhead="open" arrowsize="0.5"];
node_service_container [label="service_container\nSymfony\\Component\\DependencyInjection\\ContainerInterface\n", shape=record, fillcolor="#eeeeee", style="filled"];
node_foo [label="foo\nFooClass\n", shape=record, fillcolor="#eeeeee", style="filled"];
node_bar [label="bar\nBarClass\n", shape=record, fillcolor="#eeeeee", style="filled"];
node_foo -> node_bar [label="" style="filled"];
}

View file

@ -0,0 +1,7 @@
digraph sc {
ratio="compress"
node [fontsize="11" fontname="Arial" shape="record"];
edge [fontsize="9" fontname="Arial" color="grey" arrowhead="open" arrowsize="0.5"];
node_service_container [label="service_container (Psr\Container\ContainerInterface, Symfony\Component\DependencyInjection\ContainerInterface)\nSymfony\\Component\\DependencyInjection\\ContainerInterface\n", shape=record, fillcolor="#eeeeee", style="filled"];
}

View file

@ -0,0 +1,8 @@
digraph sc {
ratio="compress"
node [fontsize="11" fontname="Arial" shape="record"];
edge [fontsize="9" fontname="Arial" color="grey" arrowhead="open" arrowsize="0.5"];
node_service_container [label="service_container (Psr\Container\ContainerInterface, Symfony\Component\DependencyInjection\ContainerInterface)\nSymfony\\Component\\DependencyInjection\\ContainerInterface\n", shape=record, fillcolor="#eeeeee", style="filled"];
node_foo [label="foo\n%foo.class%\n", shape=record, fillcolor="#eeeeee", style="filled"];
}

View file

@ -0,0 +1,8 @@
digraph sc {
ratio="compress"
node [fontsize="11" fontname="Arial" shape="record"];
edge [fontsize="9" fontname="Arial" color="grey" arrowhead="open" arrowsize="0.5"];
node_foo [label="foo\nFooClass\n", shape=record, fillcolor="#eeeeee", style="filled"];
node_service_container [label="service_container\nSymfony\\Component\\DependencyInjection\\ContainerBuilder\n", shape=record, fillcolor="#9999ff", style="filled"];
}

View file

@ -0,0 +1,56 @@
digraph sc {
ratio="compress"
node [fontsize="11" fontname="Arial" shape="record"];
edge [fontsize="9" fontname="Arial" color="grey" arrowhead="open" arrowsize="0.5"];
node_service_container [label="service_container (Psr\Container\ContainerInterface, Symfony\Component\DependencyInjection\ContainerInterface)\nSymfony\\Component\\DependencyInjection\\ContainerInterface\n", shape=record, fillcolor="#eeeeee", style="filled"];
node_foo [label="foo (alias_for_foo)\nBar\\FooClass\n", shape=record, fillcolor="#eeeeee", style="filled"];
node_foo_baz [label="foo.baz\nBazClass\n", shape=record, fillcolor="#eeeeee", style="filled"];
node_bar [label="bar\nBar\\FooClass\n", shape=record, fillcolor="#eeeeee", style="filled"];
node_foo_bar [label="foo_bar\nBar\\FooClass\n", shape=record, fillcolor="#eeeeee", style="dotted"];
node_method_call1 [label="method_call1\nBar\\FooClass\n", shape=record, fillcolor="#eeeeee", style="filled"];
node_foo_with_inline [label="foo_with_inline\nFoo\n", shape=record, fillcolor="#eeeeee", style="filled"];
node_inlined [label="inlined\nBar\n", shape=record, fillcolor="#eeeeee", style="filled"];
node_baz [label="baz\nBaz\n", shape=record, fillcolor="#eeeeee", style="filled"];
node_request [label="request\nRequest\n", shape=record, fillcolor="#eeeeee", style="filled"];
node_configurator_service [label="configurator_service\nConfClass\n", shape=record, fillcolor="#eeeeee", style="filled"];
node_configured_service [label="configured_service\nstdClass\n", shape=record, fillcolor="#eeeeee", style="filled"];
node_configurator_service_simple [label="configurator_service_simple\nConfClass\n", shape=record, fillcolor="#eeeeee", style="filled"];
node_configured_service_simple [label="configured_service_simple\nstdClass\n", shape=record, fillcolor="#eeeeee", style="filled"];
node_decorated [label="decorated\nstdClass\n", shape=record, fillcolor="#eeeeee", style="filled"];
node_decorator_service [label="decorator_service\nstdClass\n", shape=record, fillcolor="#eeeeee", style="filled"];
node_decorator_service_with_name [label="decorator_service_with_name\nstdClass\n", shape=record, fillcolor="#eeeeee", style="filled"];
node_deprecated_service [label="deprecated_service\nstdClass\n", shape=record, fillcolor="#eeeeee", style="filled"];
node_new_factory [label="new_factory\nFactoryClass\n", shape=record, fillcolor="#eeeeee", style="filled"];
node_factory_service [label="factory_service\nBar\n", shape=record, fillcolor="#eeeeee", style="filled"];
node_new_factory_service [label="new_factory_service\nFooBarBaz\n", shape=record, fillcolor="#eeeeee", style="filled"];
node_service_from_static_method [label="service_from_static_method\nBar\\FooClass\n", shape=record, fillcolor="#eeeeee", style="filled"];
node_factory_simple [label="factory_simple\nSimpleFactoryClass\n", shape=record, fillcolor="#eeeeee", style="filled"];
node_factory_service_simple [label="factory_service_simple\nBar\n", shape=record, fillcolor="#eeeeee", style="filled"];
node_lazy_context [label="lazy_context\nLazyContext\n", shape=record, fillcolor="#eeeeee", style="filled"];
node_lazy_context_ignore_invalid_ref [label="lazy_context_ignore_invalid_ref\nLazyContext\n", shape=record, fillcolor="#eeeeee", style="filled"];
node_tagged_iterator_foo [label="tagged_iterator_foo\nBar\n", shape=record, fillcolor="#eeeeee", style="filled"];
node_tagged_iterator [label="tagged_iterator\nBar\n", shape=record, fillcolor="#eeeeee", style="filled"];
node_foo2 [label="foo2\n\n", shape=record, fillcolor="#ff9999", style="filled"];
node_foo3 [label="foo3\n\n", shape=record, fillcolor="#ff9999", style="filled"];
node_foobaz [label="foobaz\n\n", shape=record, fillcolor="#ff9999", style="filled"];
node_invalid [label="invalid\n\n", shape=record, fillcolor="#ff9999", style="filled"];
node_foo -> node_foo_baz [label="" style="filled"];
node_foo -> node_service_container [label="" style="filled"];
node_foo -> node_foo_baz [label="" style="dashed"];
node_foo -> node_bar [label="setBar()" style="dashed"];
node_bar -> node_foo_baz [label="" style="filled"];
node_foo_bar -> node_deprecated_service [label="" style="filled"];
node_method_call1 -> node_foo [label="setBar()" style="dashed"];
node_method_call1 -> node_foo2 [label="setBar()" style="dashed"];
node_method_call1 -> node_foo3 [label="setBar()" style="dashed"];
node_method_call1 -> node_foobaz [label="setBar()" style="dashed"];
node_foo_with_inline -> node_inlined [label="setBar()" style="dashed"];
node_inlined -> node_baz [label="setBaz()" style="dashed"];
node_baz -> node_foo_with_inline [label="setFoo()" style="dashed"];
node_configurator_service -> node_baz [label="setFoo()" style="dashed"];
node_lazy_context -> node_foo_baz [label="" style="filled" color="#9999ff"];
node_lazy_context -> node_service_container [label="" style="filled" color="#9999ff"];
node_lazy_context_ignore_invalid_ref -> node_foo_baz [label="" style="filled" color="#9999ff"];
node_lazy_context_ignore_invalid_ref -> node_invalid [label="" style="filled" color="#9999ff"];
}

View file

@ -0,0 +1,16 @@
<?php
namespace Symfony\Component\DependencyInjection\Tests\Fixtures\includes;
use Symfony\Component\DependencyInjection\Tests\Compiler\Foo;
class FooVariadic
{
public function __construct(Foo $foo)
{
}
public function bar(...$arguments)
{
}
}

View file

@ -0,0 +1,8 @@
<?php
namespace Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath;
class C1 extends P1
{
use T1;
}

View file

@ -0,0 +1,7 @@
<?php
namespace Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath;
class C2
{
}

View file

@ -0,0 +1,7 @@
<?php
namespace Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath;
class C3
{
}

View file

@ -0,0 +1,7 @@
<?php
namespace Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath;
interface I1
{
}

View file

@ -0,0 +1,7 @@
<?php
namespace Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath;
class P1 implements I1
{
}

View file

@ -0,0 +1,7 @@
<?php
namespace Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath;
trait T1
{
}

View file

@ -0,0 +1,47 @@
<?php
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
class ProjectExtension implements ExtensionInterface
{
public function load(array $configs, ContainerBuilder $configuration)
{
$configuration->setParameter('project.configs', $configs);
$configs = array_filter($configs);
if ($configs) {
$config = call_user_func_array('array_merge', $configs);
} else {
$config = array();
}
$configuration->setDefinition('project.service.bar', new Definition('FooClass'));
$configuration->setParameter('project.parameter.bar', isset($config['foo']) ? $config['foo'] : 'foobar');
$configuration->setDefinition('project.service.foo', new Definition('FooClass'));
$configuration->setParameter('project.parameter.foo', isset($config['foo']) ? $config['foo'] : 'foobar');
return $configuration;
}
public function getXsdValidationBasePath()
{
return false;
}
public function getNamespace()
{
return 'http://www.example.com/schema/project';
}
public function getAlias()
{
return 'project';
}
public function getConfiguration(array $config, ContainerBuilder $container)
{
}
}

View file

@ -0,0 +1,19 @@
<?php
class ProjectWithXsdExtension extends ProjectExtension
{
public function getXsdValidationBasePath()
{
return __DIR__.'/schema';
}
public function getNamespace()
{
return 'http://www.example.com/schema/projectwithxsd';
}
public function getAlias()
{
return 'projectwithxsd';
}
}

View file

@ -0,0 +1,350 @@
<?php
namespace Symfony\Component\DependencyInjection\Tests\Compiler;
class Foo
{
}
class Bar
{
public function __construct(Foo $foo)
{
}
}
interface AInterface
{
}
class A implements AInterface
{
public static function create(Foo $foo)
{
}
}
class B extends A
{
}
class C
{
public function __construct(A $a)
{
}
}
interface DInterface
{
}
interface EInterface extends DInterface
{
}
interface IInterface
{
}
class I implements IInterface
{
}
class F extends I implements EInterface
{
}
class G
{
public function __construct(DInterface $d, EInterface $e, IInterface $i)
{
}
}
class H
{
public function __construct(B $b, DInterface $d)
{
}
}
class D
{
public function __construct(A $a, DInterface $d)
{
}
}
class E
{
public function __construct(D $d = null)
{
}
}
class J
{
public function __construct(I $i)
{
}
}
class K
{
public function __construct(IInterface $i)
{
}
}
interface CollisionInterface
{
}
class CollisionA implements CollisionInterface
{
}
class CollisionB implements CollisionInterface
{
}
class CannotBeAutowired
{
public function __construct(CollisionInterface $collision)
{
}
}
class CannotBeAutowiredForwardOrder
{
public function __construct(CollisionA $a, CollisionInterface $b, CollisionB $c)
{
}
}
class CannotBeAutowiredReverseOrder
{
public function __construct(CollisionA $a, CollisionB $c, CollisionInterface $b)
{
}
}
class Lille
{
}
class Dunglas
{
public function __construct(Lille $l)
{
}
}
class LesTilleuls
{
public function __construct(Dunglas $j, Dunglas $k)
{
}
}
class OptionalParameter
{
public function __construct(CollisionInterface $c = null, A $a, Foo $f = null)
{
}
}
class BadTypeHintedArgument
{
public function __construct(Dunglas $k, NotARealClass $r)
{
}
}
class BadParentTypeHintedArgument
{
public function __construct(Dunglas $k, OptionalServiceClass $r)
{
}
}
class NotGuessableArgument
{
public function __construct(Foo $k)
{
}
}
class NotGuessableArgumentForSubclass
{
public function __construct(A $k)
{
}
}
class MultipleArguments
{
public function __construct(A $k, $foo, Dunglas $dunglas, array $bar)
{
}
}
class MultipleArgumentsOptionalScalar
{
public function __construct(A $a, $foo = 'default_val', Lille $lille = null)
{
}
}
class MultipleArgumentsOptionalScalarLast
{
public function __construct(A $a, Lille $lille, $foo = 'some_val')
{
}
}
class MultipleArgumentsOptionalScalarNotReallyOptional
{
public function __construct(A $a, $foo = 'default_val', Lille $lille)
{
}
}
/*
* Classes used for testing createResourceForClass
*/
class ClassForResource
{
public function __construct($foo, Bar $bar = null)
{
}
public function setBar(Bar $bar)
{
}
}
class IdenticalClassResource extends ClassForResource
{
}
class ClassChangedConstructorArgs extends ClassForResource
{
public function __construct($foo, Bar $bar, $baz)
{
}
}
class SetterInjectionCollision
{
/**
* @required
*/
public function setMultipleInstancesForOneArg(CollisionInterface $collision)
{
// The CollisionInterface cannot be autowired - there are multiple
// should throw an exception
}
}
class SetterInjection extends SetterInjectionParent
{
/**
* @required
*/
public function setFoo(Foo $foo)
{
// should be called
}
/** @inheritdoc*/ // <- brackets are missing on purpose
public function setDependencies(Foo $foo, A $a)
{
// should be called
}
/** {@inheritdoc} */
public function setWithCallsConfigured(A $a)
{
// this method has a calls configured on it
}
public function notASetter(A $a)
{
// should be called only when explicitly specified
}
/**
* @required*/
public function setChildMethodWithoutDocBlock(A $a)
{
}
}
class SetterInjectionParent
{
/** @required*/
public function setDependencies(Foo $foo, A $a)
{
// should be called
}
public function notASetter(A $a)
{
// @required should be ignored when the child does not add @inheritdoc
}
/** @required <tab> prefix is on purpose */
public function setWithCallsConfigured(A $a)
{
}
/** @required */
public function setChildMethodWithoutDocBlock(A $a)
{
}
}
class NotWireable
{
public function setNotAutowireable(NotARealClass $n)
{
}
public function setBar()
{
}
public function setOptionalNotAutowireable(NotARealClass $n = null)
{
}
public function setDifferentNamespace(\stdClass $n)
{
}
public function setOptionalNoTypeHint($foo = null)
{
}
public function setOptionalArgNoAutowireable($other = 'default_val')
{
}
/** @required */
protected function setProtectedMethod(A $a)
{
}
}
class PrivateConstructor
{
private function __construct()
{
}
}
class ScalarSetter
{
/**
* @required
*/
public function setDefaultLocale($defaultLocale)
{
}
}

View file

@ -0,0 +1,136 @@
<?php
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\LazyProxy\PhpDumper\DumperInterface as ProxyDumper;
use Symfony\Component\DependencyInjection\ServiceSubscriberInterface;
function sc_configure($instance)
{
$instance->configure();
}
class BarClass extends BazClass
{
protected $baz;
public $foo = 'foo';
public function setBaz(BazClass $baz)
{
$this->baz = $baz;
}
public function getBaz()
{
return $this->baz;
}
}
class BazClass
{
protected $foo;
public function setFoo(Foo $foo)
{
$this->foo = $foo;
}
public function configure($instance)
{
$instance->configure();
}
public static function getInstance()
{
return new self();
}
public static function configureStatic($instance)
{
$instance->configure();
}
public static function configureStatic1()
{
}
}
class BarUserClass
{
public $bar;
public function __construct(BarClass $bar)
{
$this->bar = $bar;
}
}
class MethodCallClass
{
public $simple;
public $complex;
private $callPassed = false;
public function callMe()
{
$this->callPassed = is_scalar($this->simple) && is_object($this->complex);
}
public function callPassed()
{
return $this->callPassed;
}
}
class DummyProxyDumper implements ProxyDumper
{
public function isProxyCandidate(Definition $definition)
{
return $definition->isLazy();
}
public function getProxyFactoryCode(Definition $definition, $id, $factoryCall = null)
{
return " // lazy factory for {$definition->getClass()}\n\n";
}
public function getProxyCode(Definition $definition)
{
return "// proxy code for {$definition->getClass()}\n";
}
}
class LazyContext
{
public $lazyValues;
public $lazyEmptyValues;
public function __construct($lazyValues, $lazyEmptyValues)
{
$this->lazyValues = $lazyValues;
$this->lazyEmptyValues = $lazyEmptyValues;
}
}
class FoobarCircular
{
public function __construct(FooCircular $foo)
{
$this->foo = $foo;
}
}
class FooCircular
{
public function __construct(BarCircular $bar)
{
$this->bar = $bar;
}
}
class BarCircular
{
public function addFoobar(FoobarCircular $foobar)
{
$this->foobar = $foobar;
}
}

View file

@ -0,0 +1,47 @@
<?php
$file = __DIR__.'/ProjectWithXsdExtensionInPhar.phar';
if (is_file($file)) {
@unlink($file);
}
$phar = new Phar($file, 0, 'ProjectWithXsdExtensionInPhar.phar');
$phar->addFromString('ProjectWithXsdExtensionInPhar.php', <<<'EOT'
<?php
class ProjectWithXsdExtensionInPhar extends ProjectExtension
{
public function getXsdValidationBasePath()
{
return __DIR__.'/schema';
}
public function getNamespace()
{
return 'http://www.example.com/schema/projectwithxsdinphar';
}
public function getAlias()
{
return 'projectwithxsdinphar';
}
}
EOT
);
$phar->addFromString('schema/project-1.0.xsd', <<<'EOT'
<?xml version="1.0" encoding="UTF-8" ?>
<xsd:schema xmlns="http://www.example.com/schema/projectwithxsdinphar"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.example.com/schema/projectwithxsdinphar"
elementFormDefault="qualified">
<xsd:element name="bar" type="bar" />
<xsd:complexType name="bar">
<xsd:attribute name="foo" type="xsd:string" />
</xsd:complexType>
</xsd:schema>
EOT
);
$phar->setStub('<?php Phar::mapPhar("ProjectWithXsdExtensionInPhar.phar"); require_once "phar://ProjectWithXsdExtensionInPhar.phar/ProjectWithXsdExtensionInPhar.php"; __HALT_COMPILER(); ?>');

View file

@ -0,0 +1,43 @@
<?php
namespace Bar;
class FooClass
{
public $foo;
public $moo;
public $bar = null;
public $initialized = false;
public $configured = false;
public $called = false;
public $arguments = array();
public function __construct($arguments = array())
{
$this->arguments = $arguments;
}
public static function getInstance($arguments = array())
{
$obj = new self($arguments);
$obj->called = true;
return $obj;
}
public function initialize()
{
$this->initialized = true;
}
public function configure()
{
$this->configured = true;
}
public function setBar($value = null)
{
$this->bar = $value;
}
}

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" ?>
<xsd:schema xmlns="http://www.example.com/schema/projectwithxsd"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.example.com/schema/projectwithxsd"
elementFormDefault="qualified">
<xsd:element name="bar" type="bar" />
<xsd:complexType name="bar">
<xsd:attribute name="foo" type="xsd:string" />
</xsd:complexType>
</xsd:schema>

View file

@ -0,0 +1,2 @@
foo = '
bar = bar

View file

@ -0,0 +1,2 @@
[parameters]
with_wrong_ext = 'from ini'

View file

@ -0,0 +1,2 @@
{NOT AN INI FILE}
{JUST A PLAIN TEXT FILE}

View file

@ -0,0 +1,3 @@
[parameters]
foo = bar
bar = %foo%

View file

@ -0,0 +1,3 @@
[parameters]
FOO = foo
baz = baz

View file

@ -0,0 +1,2 @@
[parameters]
imported_from_ini = true

View file

@ -0,0 +1,27 @@
[parameters]
true = true
true_comment = true ; comment
false = false
null = null
on = on
off = off
yes = yes
no = no
none = none
constant = PHP_VERSION
12 = 12
12_string = '12'
12_comment = 12 ; comment
12_string_comment = '12' ; comment
12_string_comment_again = "12" ; comment
-12 = -12
0 = 0
1 = 1
0b0110 = 0b0110
11112222333344445555 = 1111,2222,3333,4444,5555
0777 = 0777
255 = 0xFF
100.0 = 1e2
-120.0 = -1.2E2
-10100.1 = -10100.1
-10,100.1 = -10,100.1

Some files were not shown because too many files have changed in this diff Show more