for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace phpDocumentor\Guides\Nodes;
/**
* This file is part of phpDocumentor.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
* @link https://phpdoc.org
*/
use Mockery as m;
use Mockery\Adapter\Phpunit\MockeryTestCase;
use phpDocumentor\Guides\Environment;
final class TitleNodeTest extends MockeryTestCase
{
public function test_it_can_be_created_with_a_title_slug_and_depth() : void
$environment = m::mock(Environment::class);
$environment->shouldReceive('getTitleLetters')->andReturn(['a']);
$environment->shouldReceive('resetAnonymousStack');
$titleNode = new SpanNode($environment, 'Raw String');
$environment
object<Mockery\LegacyMockInterface>
object<phpDocumentor\Guides\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);
$node = new TitleNode($titleNode, 1);
$node->setTarget('target');
self::assertSame('raw-string', $node->getId());
self::assertSame($titleNode, $node->getValue());
self::assertSame(1, $node->getLevel());
self::assertSame('target', $node->getTarget());
}
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: