1 | <?php |
||
19 | class Module extends \yii\base\Module |
||
20 | { |
||
21 | |||
22 | /** @var string module name */ |
||
23 | public static $moduleName = 'comments'; |
||
24 | |||
25 | /** @var string|null */ |
||
26 | public $userIdentityClass = null; |
||
27 | |||
28 | /** @var bool */ |
||
29 | public $useRbac = true; |
||
30 | |||
31 | /** |
||
32 | * Array that will store the models used in the package |
||
33 | * e.g. : |
||
34 | * [ |
||
35 | * 'Comment' => 'frontend/models/comments/CommentModel' |
||
36 | * ] |
||
37 | * |
||
38 | * The classes defined here will be merged with getDefaultModels() |
||
39 | * having he manually defined by the user preference. |
||
40 | * |
||
41 | * @var array |
||
42 | */ |
||
43 | public $modelMap = []; |
||
44 | |||
45 | public function init() |
||
57 | |||
58 | /** |
||
59 | * @return static |
||
60 | */ |
||
61 | public static function instance() |
||
65 | |||
66 | /** |
||
67 | * Merges the default and user defined model classes |
||
68 | * Also let's the developer to set new ones with the |
||
69 | * parameter being those the ones with most preference. |
||
70 | * |
||
71 | * @param array $modelClasses |
||
72 | */ |
||
73 | public function defineModelClasses($modelClasses = []) |
||
81 | |||
82 | /** |
||
83 | * Get default model classes |
||
84 | */ |
||
85 | protected function getDefaultModels() |
||
93 | |||
94 | /** |
||
95 | * Get defined className of model |
||
96 | * |
||
97 | * Returns an string or array compatible |
||
98 | * with the Yii::createObject method. |
||
99 | * |
||
100 | * @param string $name |
||
101 | * @param array $config // You should never send an array with a key defined as "class" since this will |
||
102 | * // overwrite the main className defined by the system. |
||
103 | * @return string|array |
||
104 | */ |
||
105 | public function model($name, $config = []) |
||
122 | |||
123 | } |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: