Completed
Push — develop ( fcce06...87d9a9 )
by Nate
02:07
created

actions/organizations/UpdateOrganizationType.php (2 issues)

Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
/**
4
 * @copyright  Copyright (c) Flipbox Digital Limited
5
 * @license    https://flipboxfactory.com/software/organization/license
6
 * @link       https://www.flipboxfactory.com/software/organization/
7
 */
8
9
namespace flipbox\organizations\actions\organizations;
10
11
use flipbox\craft\ember\actions\records\UpdateRecord;
12
use flipbox\organizations\records\OrganizationType;
13
use yii\db\ActiveRecord;
14
15
/**
16
 * @author Flipbox Factory <[email protected]>
17
 * @since 1.0.0
18
 */
19
class UpdateOrganizationType extends UpdateRecord
20
{
21
    use PopulateOrganizationTypeTrait;
22
23
    /**
24
     * @inheritdoc
25
     */
26
    public function run($type)
27
    {
28
        return parent::run($type);
29
    }
30
31
    /**
32
     * @inheritdoc
33
     * @param OrganizationType $record
34
     * @return OrganizationType
35
     */
36
    protected function populate(ActiveRecord $record): ActiveRecord
37
    {
38
        parent::populate($record);
39
40
        $this->populateSiteLayout($record);
1 ignored issue
show
$record of type object<yii\db\ActiveRecord> is not a sub-type of object<flipbox\organizat...cords\OrganizationType>. It seems like you assume a child class of the class yii\db\ActiveRecord 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...
41
        $this->populateSiteSettings($record);
1 ignored issue
show
$record of type object<yii\db\ActiveRecord> is not a sub-type of object<flipbox\organizat...cords\OrganizationType>. It seems like you assume a child class of the class yii\db\ActiveRecord 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...
42
43
        return $record;
44
    }
45
46
    /**
47
     * @inheritdoc
48
     * @return OrganizationType|null
49
     */
50
    protected function find($identifier)
51
    {
52
        return OrganizationType::findOne($identifier);
53
    }
54
}
55