1 | <?php |
||
34 | class Guard extends ServerGuard |
||
35 | { |
||
36 | use VerifyTicket; |
||
37 | |||
38 | /** |
||
39 | * Wechat push event types. |
||
40 | * |
||
41 | * @var array |
||
42 | */ |
||
43 | protected $eventTypeMappings = [ |
||
44 | 'authorized' => EventHandlers\Authorized::class, |
||
45 | 'unauthorized' => EventHandlers\Unauthorized::class, |
||
46 | 'updateauthorized' => EventHandlers\UpdateAuthorized::class, |
||
47 | 'component_verify_ticket' => EventHandlers\ComponentVerifyTicket::class, |
||
48 | ]; |
||
49 | |||
50 | /** |
||
51 | * Return for laravel-wechat. |
||
52 | * |
||
53 | * @return array |
||
54 | */ |
||
55 | public function listServe() |
||
67 | |||
68 | /** |
||
69 | * Listen for wechat push event. |
||
70 | * |
||
71 | * @param callable|null $callback |
||
72 | * |
||
73 | * @return mixed |
||
74 | * |
||
75 | * @throws InvalidArgumentException |
||
76 | */ |
||
77 | public function listen($callback = null) |
||
91 | |||
92 | /** |
||
93 | * Get handler class. |
||
94 | * |
||
95 | * @return \EasyWeChat\OpenPlatform\EventHandlers\EventHandler |
||
96 | * |
||
97 | * @throws InvalidArgumentException |
||
98 | */ |
||
99 | private function getHandleClass() |
||
111 | } |
||
112 |
Let’s assume that you have a directory layout like this:
and let’s assume the following content of
Bar.php
:If both files
OtherDir/Foo.php
andSomeDir/Foo.php
are loaded in the same runtime, you will see a PHP error such as the following:PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php
However, as
OtherDir/Foo.php
does not necessarily have to be loaded and the error is only triggered if it is loaded beforeOtherDir/Bar.php
, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias: