我正在运行Laravel 5.8,在 seeder 时出现此错误
Seeding: CategoriesTableSeeder
ErrorException : implode(): Passing glue string after array is deprecated. Swap the parameters
在/Users/saly/Sites/Saly/vendor/fzaninotto/faker/src/Faker/Provider/Lorem.php:95
91|
92| $words = static::words($nbWords);
93| $words[0] = ucwords($words[0]);
94|
95| return implode($words, ' ') . '.';
96| }
97|
98| /**
99| * Generate an array of sentences
Exception trace:
1 implode(" ")
/Users/saly/Sites/Saly/vendor/fzaninotto/faker/src/Faker/Provider/Lorem.php:95
2 Faker\Provider\Lorem::sentence()
/Users/saly/Sites/Saly/vendor/fzaninotto/faker/src/Faker/Generator.php:222
> Please use the argument -v to see more details.
该应用程序在使用PHP7.3和7.2的CI中通过了测试,所以问题可能是我本地机器"OSX"中的PHP7.4
这是我的种子文件
<?php
use Saly\Category;
use Illuminate\Database\Seeder;
class CategoriesTableSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
factory(Category::class, 3)->create();
}
}
And the factory
<?php
use Saly\Category;
use Faker\Generator as Faker;
$factory->define(Category::class, function (Faker $faker) {
$name = $faker->sentence(4, true); // Here maybe?
return [
'name' => $name,
'slug' => sluggify($name),
];
});
I think the problem is in the line where sentence()
is used but I can't tell how to solve it because I just copied that line from the Faker docs
What does this error mean and how can I solve it?