diff vendor/symfony/dependency-injection/Loader/Configurator/DefaultsConfigurator.php @ 14:1fec387a4317

Update Drupal core to 8.5.2 via Composer
author Chris Cannam
date Mon, 23 Apr 2018 09:46:53 +0100
parents
children 129ea1e6d783
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/symfony/dependency-injection/Loader/Configurator/DefaultsConfigurator.php	Mon Apr 23 09:46:53 2018 +0100
@@ -0,0 +1,68 @@
+<?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\Loader\Configurator;
+
+use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
+
+/**
+ * @author Nicolas Grekas <p@tchwork.com>
+ *
+ * @method InstanceofConfigurator instanceof(string $fqcn)
+ */
+class DefaultsConfigurator extends AbstractServiceConfigurator
+{
+    const FACTORY = 'defaults';
+
+    use Traits\AutoconfigureTrait;
+    use Traits\AutowireTrait;
+    use Traits\BindTrait;
+    use Traits\PublicTrait;
+
+    /**
+     * Adds a tag for this definition.
+     *
+     * @param string $name       The tag name
+     * @param array  $attributes An array of attributes
+     *
+     * @return $this
+     *
+     * @throws InvalidArgumentException when an invalid tag name or attribute is provided
+     */
+    final public function tag($name, array $attributes = array())
+    {
+        if (!is_string($name) || '' === $name) {
+            throw new InvalidArgumentException('The tag name in "_defaults" must be a non-empty string.');
+        }
+
+        foreach ($attributes as $attribute => $value) {
+            if (!is_scalar($value) && null !== $value) {
+                throw new InvalidArgumentException(sprintf('Tag "%s", attribute "%s" in "_defaults" must be of a scalar-type.', $name, $attribute));
+            }
+        }
+
+        $this->definition->addTag($name, $attributes);
+
+        return $this;
+    }
+
+    /**
+     * Defines an instanceof-conditional to be applied to following service definitions.
+     *
+     * @param string $fqcn
+     *
+     * @return InstanceofConfigurator
+     */
+    final protected function setInstanceof($fqcn)
+    {
+        return $this->parent->instanceof($fqcn);
+    }
+}