Passed
Push — latest ( ba39d8...ca9086 )
by Colin
08:23
created

CommonMark/Parser/Block/BlockQuoteParser.php (1 issue)

Labels
Severity
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the league/commonmark package.
7
 *
8
 * (c) Colin O'Dell <[email protected]>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace League\CommonMark\Extension\CommonMark\Parser\Block;
15
16
use League\CommonMark\Extension\CommonMark\Node\Block\BlockQuote;
17
use League\CommonMark\Node\Block\AbstractBlock;
18
use League\CommonMark\Parser\Block\AbstractBlockContinueParser;
19
use League\CommonMark\Parser\Block\BlockContinue;
20
use League\CommonMark\Parser\Block\BlockContinueParserInterface;
21
use League\CommonMark\Parser\Cursor;
22
23
final class BlockQuoteParser extends AbstractBlockContinueParser
24
{
25
    /**
26
     * @var BlockQuote
27
     *
28
     * @psalm-readonly
29
     */
30
    private $block;
31
32 150
    public function __construct()
33
    {
34 150
        $this->block = new BlockQuote();
35 150
    }
36
37
    /**
38
     * @return BlockQuote
39
     */
40 150
    public function getBlock(): AbstractBlock
41
    {
42 150
        return $this->block;
43
    }
44
45 150
    public function isContainer(): bool
46
    {
47 150
        return true;
48
    }
49
50 144
    public function canContain(AbstractBlock $childBlock): bool
51
    {
52 144
        return true;
53
    }
54
55 102
    public function tryContinue(Cursor $cursor, BlockContinueParserInterface $activeBlockParser): ?BlockContinue
56
    {
57 102
        if (! $cursor->isIndented() && $cursor->getNextNonSpaceCharacter() === '>') {
58 54
            $cursor->advanceToNextNonSpaceOrTab();
59 54
            $cursor->advanceBy(1);
60 54
            $cursor->advanceBySpaceOrTab();
61
62 54
            return BlockContinue::at($cursor);
63
        }
64
65 69
        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...
66
    }
67
}
68