每当我启动php artisan
时,即使我没有修改文件,我也会在一段时间后发现随机错误。这些错误对我来说也没有意义。例如:
PHP Parse error: syntax error, unexpected '++' (T_INC), expecting '(' in /.../app/Providers/AuthServiceProvider.php on line 32
PHP Parse error: syntax error, unexpected '?' in /.../app/Providers/AuthServiceProvider.php on line 32
PHP Parse error: syntax error, unexpected '' in /.../app/Providers/AuthServiceProvider.php on line 32
AuthServiceProvider.php:
<?php
namespace App\Providers;
use Illuminate\Contracts\Auth\Access\Gate as GateContract;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
class AuthServiceProvider extends ServiceProvider
{
/**
* The policy mappings for the application.
*
* @var array
*/
protected $policies = [
'App\Model' => 'App\Policies\ModelPolicy',
];
/**
* Register any application authentication / authorization services.
*
* @param \Illuminate\Contracts\Auth\Access\Gate $gate
* @return void
*/
public function boot(GateContract $gate)
{
$this->registerPolicies($gate);
//
}
}
第32行是文件末尾的换行符。
有时工匠成功运作(再次没有我更改任何文件)。可能会发生什么?
PHP 5.6版,Laravel 5.2.45