public function setService($service, $serviceName = null)
    {
        // @codingStandardsIgnoreStart
        @trigger_error(
            '"' .__METHOD__ . '" is deprecated as the service container will get removed.',
            E_USER_DEPRECATED
        );
        // @codingStandardsIgnoreEnd
        if ($serviceName === null) {
            if (!\is_object($service) || $service instanceof \Closure) {
                throw new \InvalidArgumentException(
                    'Service name must be given to ' . __CLASS__ . '::setService when not passing a class instance.'
                );
            }

            $serviceName = \get_class($service);
        }

        $this->services[$serviceName] = $service;

        return $this;
    }
public function setService($service, $serviceName = null)
    {
        // @codingStandardsIgnoreStart
        @trigger_error(
            '"' .__METHOD__ . '" is deprecated as the service container will get removed.',
            E_USER_DEPRECATED
        );
        // @codingStandardsIgnoreEnd
        if ($serviceName === null) {
            if (!\is_object($service) || $service instanceof \Closure) {
                throw new \InvalidArgumentException(
                    'Service name must be given to ' . __CLASS__ . '::setService when not passing a class instance.'
                );
            }

            $serviceName = \get_class($service);
        }

        $this->services[$serviceName] = $service;

        return $this;
    }
{@inheritdoc}

@throws \InvalidArgumentException When the passed service is not an object and no service name has been passed.

@deprecated The service container will get removed, use the symfony service container instead.