Completed
Push — master ( 61044a...94728c )
by Rafał
24:26 queued 10:49
created

ArticleService::publish()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SWP\Behat\Service;
6
7
use SWP\Bundle\ContentBundle\Model\ArticleInterface;
8
use SWP\Component\Common\Model\DateTime;
9
use SWP\Bundle\ContentBundle\Service\ArticleService as BaseArticleService;
10
11
class ArticleService extends BaseArticleService
12
{
13
    public function publish(ArticleInterface $article): ArticleInterface
14
    {
15
        if (null === $article->getPublishedAt()) {
16
            $article->setPublishedAt(DateTime::getCurrentDateTime());
0 ignored issues
show
Compatibility introduced by
\SWP\Component\Common\Mo...e::getCurrentDateTime() of type object<DateTimeInterface> is not a sub-type of object<DateTime>. It seems like you assume a concrete implementation of the interface DateTimeInterface to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
17
        }
18
19
        return parent::publish($article);
20
    }
21
}
22