HealthCheck::getBody()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
dl 0
loc 6
rs 9.4285
c 1
b 0
f 1
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
namespace Sugarcrm\UpgradeSpec\Element\Section;
4
5
use Sugarcrm\UpgradeSpec\Data\DataAwareInterface;
6
use Sugarcrm\UpgradeSpec\Data\DataAwareTrait;
7
use Sugarcrm\UpgradeSpec\Element\ElementInterface;
8
use Sugarcrm\UpgradeSpec\Context\Upgrade;
9
use Sugarcrm\UpgradeSpec\Template\RendererAwareInterface;
10
use Sugarcrm\UpgradeSpec\Template\RendererAwareTrait;
11
12
class HealthCheck implements ElementInterface, RendererAwareInterface, DataAwareInterface
13
{
14
    use RendererAwareTrait, DataAwareTrait;
15
16
    /**
17
     * @return string
18
     */
19
    public function getTitle()
20
    {
21
        return 'Run Health Check and fix all errors';
22
    }
23
24
    /**
25
     * @return int
26
     */
27
    public function getOrder()
28
    {
29
        return 4;
30
    }
31
32
    /**
33
     * @param Upgrade $context
34
     *
35
     * @return bool
36
     */
37
    public function isRelevantTo(Upgrade $context)
38
    {
39
        return version_compare($context->getTargetVersion(), '7.0', '>=');
40
    }
41
42
    /**
43
     * @param Upgrade $context
44
     *
45
     * @return string
46
     */
47
    public function getBody(Upgrade $context)
48
    {
49
        return $this->renderer->render('health_check', [
50
            'health_check_howto' => $this->dataManager->getHealthCheckInfo($context->getTargetVersion()),
0 ignored issues
show
Documentation introduced by
$context->getTargetVersion() is of type string, but the function expects a object<Sugarcrm\UpgradeSpec\Version\Version>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
51
        ]);
52
    }
53
}
54