1 | <?php |
||
27 | class MemberQuery extends BaseBlameableQuery |
||
28 | { |
||
29 | public $modelClass = Member::class; |
||
30 | |||
31 | /** |
||
32 | * Specify user. |
||
33 | * @param User|string|integer $user |
||
34 | * @return static |
||
35 | */ |
||
36 | 22 | public function user($user) |
|
37 | { |
||
38 | 22 | $model = $this->noInitModel; |
|
39 | /* @var $model Member */ |
||
40 | 22 | if (!is_string($model->memberAttribute) || empty($model->memberAttribute)) { |
|
41 | return $this; |
||
42 | } |
||
43 | 22 | $class = $model->memberUserClass; |
|
44 | 22 | if (is_int($user)) { |
|
45 | $user = $class::find()->id($user)->one(); |
||
46 | } |
||
47 | 22 | if ($user instanceof $class) { |
|
48 | 20 | $user = $user->getGUID(); |
|
49 | } |
||
50 | 22 | return $this->andWhere([$model->memberAttribute => $user]); |
|
51 | } |
||
52 | |||
53 | /** |
||
54 | * Specify organization. |
||
55 | * Alias of `createdBy` method. |
||
56 | * @param Organization $organization |
||
57 | * @return static |
||
58 | */ |
||
59 | public function organization($organization) |
||
63 | |||
64 | /** |
||
65 | * Specify role. |
||
66 | * @param Role|string $role |
||
67 | * @param boolean|string $like |
||
68 | * @return static |
||
69 | */ |
||
70 | 15 | public function role($role = '', $like = false) |
|
79 | } |
||
80 |
This check looks at variables that have been passed in as parameters and are passed out again to other methods.
If the outgoing method call has stricter type requirements than the method itself, an issue is raised.
An additional type check may prevent trouble.