1 | <?php |
||
17 | class Module extends \yii\base\Module |
||
18 | { |
||
19 | |||
20 | /** @var string module name */ |
||
21 | public static $moduleName = 'comments'; |
||
22 | |||
23 | /** @var string|null */ |
||
24 | public $userIdentityClass = null; |
||
25 | |||
26 | /** @var bool */ |
||
27 | public $useRbac = true; |
||
28 | |||
29 | /** |
||
30 | * Array that will store the models used in the package |
||
31 | * e.g. : |
||
32 | * [ |
||
33 | * 'Comment' => 'frontend/models/comments/CommentModel' |
||
34 | * ] |
||
35 | * |
||
36 | * The classes defined here will be merged with getDefaultModels() |
||
37 | * having he manually defined by the user preference. |
||
38 | * |
||
39 | * @var array |
||
40 | */ |
||
41 | public $modelMap = []; |
||
42 | |||
43 | 1 | public function init() |
|
55 | |||
56 | /** |
||
57 | * @return static |
||
58 | */ |
||
59 | public static function instance() |
||
63 | |||
64 | /** |
||
65 | * Merges the default and user defined model classes |
||
66 | * Also let's the developer to set new ones with the |
||
67 | * parameter being those the ones with most preference. |
||
68 | * |
||
69 | * @param array $modelClasses |
||
70 | */ |
||
71 | 1 | public function defineModelClasses($modelClasses = []) |
|
79 | |||
80 | /** |
||
81 | * Get default model classes |
||
82 | */ |
||
83 | 1 | protected function getDefaultModels() |
|
91 | |||
92 | /** |
||
93 | * Get defined className of model |
||
94 | * |
||
95 | * Returns an string or array compatible |
||
96 | * with the Yii::createObject method. |
||
97 | * |
||
98 | * @param string $name |
||
99 | * @param array $config // You should never send an array with a key defined as "class" since this will |
||
100 | * // overwrite the main className defined by the system. |
||
101 | * @return string|array |
||
102 | */ |
||
103 | public function model($name, $config = []) |
||
120 | } |
||
121 |
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: