These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /** |
||
3 | * Created by PhpStorm. |
||
4 | * User: davis |
||
5 | * Date: 7/23/17 |
||
6 | * Time: 3:06 AM |
||
7 | */ |
||
8 | |||
9 | namespace DavisPeixoto\BlogCore\Service; |
||
10 | |||
11 | |||
12 | use DavisPeixoto\BlogCore\Interfaces\ServiceInterface; |
||
13 | use DavisPeixoto\BlogCore\Repository\AbstractTrailRepository; |
||
14 | use DavisPeixoto\BlogCore\Entity\Trail; |
||
15 | use Exception; |
||
16 | use Psr\Log\LoggerInterface; |
||
17 | use Ramsey\Uuid\UuidInterface; |
||
18 | |||
19 | /** |
||
20 | * Class EditTrail |
||
21 | * @package DavisPeixoto\BlogCore\Service |
||
22 | */ |
||
23 | View Code Duplication | class EditTrail implements ServiceInterface |
|
24 | { |
||
25 | /** |
||
26 | * @var AbstractTrailRepository |
||
27 | */ |
||
28 | private $trailRepository; |
||
29 | |||
30 | /** |
||
31 | * @var Trail |
||
32 | */ |
||
33 | private $trail; |
||
34 | |||
35 | /** |
||
36 | * @var LoggerInterface |
||
37 | */ |
||
38 | private $logger; |
||
39 | |||
40 | /** |
||
41 | * EditTrail constructor. |
||
42 | * @param AbstractTrailRepository $trailRepository |
||
43 | * @param Trail $trail |
||
44 | * @param LoggerInterface $logger |
||
45 | */ |
||
46 | 2 | public function __construct(AbstractTrailRepository $trailRepository, Trail $trail, LoggerInterface $logger) |
|
47 | { |
||
48 | 2 | $this->trailRepository = $trailRepository; |
|
49 | 2 | $this->trail = $trail; |
|
50 | 2 | $this->logger = $logger; |
|
51 | 2 | } |
|
52 | |||
53 | /** |
||
54 | * @return UuidInterface|null |
||
0 ignored issues
–
show
|
|||
55 | */ |
||
56 | 2 | public function run() |
|
57 | { |
||
58 | try { |
||
59 | 2 | return $this->trailRepository->save($this->trail); |
|
60 | 1 | } catch (Exception $e) { |
|
61 | 1 | $this->logger->error($e->getMessage()); |
|
62 | } |
||
63 | |||
64 | 1 | return null; |
|
65 | } |
||
66 | } |
||
67 |
This check compares the return type specified in the
@return
annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.