src/Container.php
protected function addService(int $containerId, string $serviceId, Argument $argument): void
    {
        if (substr($serviceId, -8) === 'Original') {
            throw new \InvalidArgumentException(sprintf(
                'Service id cannot ends with "Original" keyword in "%s".',
                $serviceId
            ));
        }

        if (array_key_exists($serviceId, $this->ids)) {
            // overriding

            $returnType = $argument->getReturnType();

            $otherReturnType = $this->list[$serviceId]->getReturnType();
            $isSubclass = is_a($otherReturnType, $returnType, true);

            if ($otherReturnType !== $returnType && !$isSubclass) {
                throw new \InvalidArgumentException(sprintf(
                    'Invalid override: Service "%s" with type "%s" override service with type "%s"',
                    $serviceId,
                    $returnType,
                    $otherReturnType
                ));
            }

            if ($argument->isDecorator() && $serviceId === $argument->getDecoratedService()) {
            } elseif ($this->list[$serviceId]->isDecorator()) {
            } elseif ($this->priorities[$this->ids[$serviceId]] === $this->priorities[$containerId]) {
                throw new \InvalidArgumentException('Equals priority in two services, please, fix it!');

            } elseif ($this->priorities[$this->ids[$serviceId]] > $this->priorities[$containerId]) {
                return;
            }
        }

        $this->append($argument, $serviceId, $containerId);
    }
protected function addService(int $containerId, string $serviceId, Argument $argument): void
    {
        if (substr($serviceId, -8) === 'Original') {
            throw new \InvalidArgumentException(sprintf(
                'Service id cannot ends with "Original" keyword in "%s".',
                $serviceId
            ));
        }

        if (array_key_exists($serviceId, $this->ids)) {
            // overriding

            $returnType = $argument->getReturnType();

            $otherReturnType = $this->list[$serviceId]->getReturnType();
            $isSubclass = is_a($otherReturnType, $returnType, true);

            if ($otherReturnType !== $returnType && !$isSubclass) {
                throw new \InvalidArgumentException(sprintf(
                    'Invalid override: Service "%s" with type "%s" override service with type "%s"',
                    $serviceId,
                    $returnType,
                    $otherReturnType
                ));
            }

            if ($argument->isDecorator() && $serviceId === $argument->getDecoratedService()) {
            } elseif ($this->list[$serviceId]->isDecorator()) {
            } elseif ($this->priorities[$this->ids[$serviceId]] === $this->priorities[$containerId]) {
                throw new \InvalidArgumentException('Equals priority in two services, please, fix it!');

            } elseif ($this->priorities[$this->ids[$serviceId]] > $this->priorities[$containerId]) {
                return;
            }
        }

        $this->append($argument, $serviceId, $containerId);
    }
@param int $containerId
@param string $serviceId
@param Argument $argument

@return void