for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the Exchange Rate Bundle, an RunOpenCode project.
*
* (c) 2017 RunOpenCode
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace RunOpenCode\Bundle\ExchangeRate\DependencyInjection\CompilerPass;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
/**
* Class RepositoryCompilerPass
* Repository compiler pass
* @package RunOpenCode\Bundle\ExchangeRate\DependencyInjection\CompilerPass
class RepositoryCompilerPass implements CompilerPassInterface
{
* {@inheritdoc}
public function process(ContainerBuilder $container)
$repository = $container->getParameter('run_open_code.exchange_rate.repository');
if ($container->hasDefinition($repository)) {
$container->setDefinition('run_open_code.exchange_rate.repository', $repository);
return;
}
foreach ($container->findTaggedServiceIds('run_open_code.exchange_rate.repository') as $id => $tags) {
foreach ($tags as $attributes) {
if (isset($attributes['alias']) && $repository === $attributes['alias']) {
$container->setDefinition('run_open_code.exchange_rate.repository', $id);
$id
integer|string
object<Symfony\Component...cyInjection\Definition>
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example:
function acceptsInteger($int) { } $x = '123'; // string "123" // Instead of acceptsInteger($x); // we recommend to use acceptsInteger((integer) $x);
throw new ServiceNotFoundException(sprintf('Repository service "%s" does not exists.', $repository));
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: