Passed
Push — master ( 53c413...1211a5 )
by Taosikai
15:08
created

examples/get_groups.php (1 issue)

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
 */
5
use Slince\SmartQQ\Client;
6
7
include __DIR__.'/bootstrap.php';
8
9
//创建smartQQ客户端
10
$smartQQ = new Client(getCredential());
11
12
//# 群信息
13
14
//1、获取所有群
15
$groups = $smartQQ->getGroups();
16
17
//2、筛选出指定的群
18
$group = $groups->firstByAttribute('name', 'Symfony.cn');
19
20
//3、获取群的详细信息
21
$groupDetail = $smartQQ->getGroupDetail($group);
0 ignored issues
show
$group is of type object|null, but the function expects a object<Slince\SmartQQ\Entity\Group>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
22
// 输出
23
printPrettyScreen($groups->toArray());
24
printR($group);
25
printR($group);
26
printR($groupDetail);
27