更新时间:2023-02-21 09:10:17
Laravel 5.8在setUp
方法的返回类型中添加了void typehint.
因此,您必须像这样声明:
Laravel 5.8 added the void typehint to the return type of the setUp
method.
So you have to declare that like this:
public function setUp(): void
{
// you should also call parent::setUp() to properly boot
// the Laravel application in your tests
$this->instance = new MyService;
}
请注意在函数参数后的: void
,以声明该函数的返回类型
Note the : void
after the function arguments to state the return type of that function