Completed
Push — develop ( 0122be...15a92d )
by
unknown
18:25 queued 09:50
created

DatePicker::getViewHelper()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
/**
3
 * YAWIK
4
 *
5
 * @filesource
6
 * @copyright (c) 2013 - 2016 Cross Solution (http://cross-solution.de)
7
 * @license   MIT
8
 */
9
10
/** Rating.php */
11
namespace Core\Form\Element;
12
13
use Zend\Form\Element;
14
use Zend\Form\Element\Date;
15
use Core\Entity\RatingInterface;
16
17
/**
18
 * Star rating element.
19
 *
20
 * @author Mathias Gelhausen <[email protected]>
21
 */
22
class DatePicker extends Date implements ViewHelperProviderInterface
23
{
24
25
    /**
26
     * @var string
27
     */
28
    protected $helper = 'formDatepicker';
29
30
    /**
31
     * @param string|\Zend\View\Helper\HelperInterface $helper
32
     * @return $this|ViewHelperProviderInterface
33
     */
34
    public function setViewHelper($helper)
35
    {
36
        $this->helper = $helper;
0 ignored issues
show
Documentation Bug introduced by
It seems like $helper can also be of type object<Zend\View\Helper\HelperInterface>. However, the property $helper is declared as type string. Maybe add an additional type check?

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.

For example, imagine you have a variable $accountId that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to the id property of an instance of the Account class. This class holds a proper account, so the id value must no longer be false.

Either this assignment is in error or a type check should be added for that assignment.

class Id
{
    public $id;

    public function __construct($id)
    {
        $this->id = $id;
    }

}

class Account
{
    /** @var  Id $id */
    public $id;
}

$account_id = false;

if (starsAreRight()) {
    $account_id = new Id(42);
}

$account = new Account();
if ($account instanceof Id)
{
    $account->id = $account_id;
}
Loading history...
37
        return $this;
38
    }
39
40
    /**
41
     * @return string|\Zend\View\Helper\HelperInterface
42
     */
43
    public function getViewHelper()
44
    {
45
        return $this->helper;
46
    }
47
}
48