for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the Symfony-Util package.
*
* (c) Jean-Bernard Addor
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use PHPUnit\Framework\TestCase;
use Symfony\Bridge\Twig\TwigEngine;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Templating\TemplateNameParser;
use SymfonyUtil\Controller\EngineAsArgumentController;
/**
* @covers \SymfonyUtil\Controller\EngineAsArgumentController
final class EngineAsArgumentControllerTest extends TestCase
{
public function testCanBeCreated()
$this->assertInstanceOf(
EngineAsArgumentController::class, // 5.4 < php
new EngineAsArgumentController()
);
}
public function testReturnsResponse()
Response::class, // 5.4 < php
(new EngineAsArgumentController())->__invoke(new TwigEngine(
new Twig_Environment(new Twig_Loader_Array(['index.html.twig' => 'Hello World!'])),
new \Twig_Environment(ne...g' => 'Hello World!')))
object<Twig_Environment>
object<Twig\Environment>
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);
new TemplateNameParser()
))
// http://api.symfony.com/3.3/Symfony/Bridge/Twig/TwigEngine.html
// http://api.symfony.com/3.3/Symfony/Bundle/TwigBundle/TwigEngine.html
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: