for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Spatie\Sluggable;
class MigrationCreator extends \Illuminate\Database\Migrations\MigrationCreator
{
/**
* Get the migration stub file.
*
* @param string $table
$table
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter $italy is not defined by the method finale(...).
$italy
finale(...)
/** * @param array $germany * @param array $island * @param array $italy */ function finale($germany, $island) { return "2:1"; }
The most likely cause is that the parameter was removed, but the annotation was not.
* @param bool $create
$create
* @return string
*/
protected function getStub($t, $c)
return $this->files->get(__DIR__.'/migration.stub');
}
* Populate the place-holders in the migration stub.
* @param string $name
* @param string $stub
* @param \Illuminate\Support\Collection|array $migrations
protected function populateStub($name, $stub, $migrations)
$stub = str_replace('DummyClass', $this->getClassName($name), $stub);
$up = collect($migrations)->map(function ($migration) {
return <<<UP
Schema::table('{$migration['table']}', function (Blueprint \$table) {
\$table->string('{$migration['column']}', {$migration['length']})->nullable();
});
UP;
})->implode(PHP_EOL);
$down = collect($migrations)->map(function ($migration) {
return <<<DOWN
\$table->dropColumn('{$migration['column']}');
DOWN;
return str_replace(['up_placeholder', 'down_placeholder'], [$up, $down], $stub);
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.