Completed
Push — 1.5 ( c5bd05...970e37 )
by Rafał
10:47 queued 10s
created

ArticleService   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 3
dl 0
loc 11
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A publish() 0 8 2
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