Passed
Push — footnotes ( 7c9f8b )
by Colin
31:23
created

src/Extension/Footnote/Parser/FootnoteParser.php (1 issue)

Labels
Severity
1
<?php
2
3
/*
4
 * This file is part of the league/commonmark package.
5
 *
6
 * (c) Colin O'Dell <[email protected]>
7
 * (c) Rezo Zero / Ambroise Maupate
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
13
declare(strict_types=1);
14
15
namespace League\CommonMark\Extension\Footnote\Parser;
16
17
use League\CommonMark\Extension\Footnote\Node\Footnote;
18
use League\CommonMark\Node\Block\AbstractBlock;
19
use League\CommonMark\Parser\Block\AbstractBlockContinueParser;
20
use League\CommonMark\Parser\Block\BlockContinue;
21
use League\CommonMark\Parser\Block\BlockContinueParserInterface;
22
use League\CommonMark\Parser\Cursor;
23
use League\CommonMark\Reference\ReferenceInterface;
24
25
final class FootnoteParser extends AbstractBlockContinueParser
26
{
27
    /**
28
     * @var Footnote
29
     *
30
     * @psalm-readonly
31
     */
32
    private $block;
33
34 18
    public function __construct(ReferenceInterface $reference)
35
    {
36 18
        $this->block = new Footnote($reference);
37 18
    }
38
39 18
    public function getBlock(): AbstractBlock
40
    {
41 18
        return $this->block;
42
    }
43
44 12
    public function tryContinue(Cursor $cursor, BlockContinueParserInterface $activeBlockParser): ?BlockContinue
45
    {
46 12
        return BlockContinue::none();
1 ignored issue
show
Are you sure the usage of League\CommonMark\Parser...k\BlockContinue::none() targeting League\CommonMark\Parser...k\BlockContinue::none() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
47
    }
48
49 18
    public function isContainer(): bool
50
    {
51 18
        return true;
52
    }
53
54 18
    public function canContain(AbstractBlock $childBlock): bool
55
    {
56 18
        return true;
57
    }
58
}
59