for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Jaybizzle\MigrationsOrganiser;
use Illuminate\Database\Migrations\Migrator as M;
use RecursiveIteratorIterator as Iterator;
use RecursiveDirectoryIterator as DirectoryIterator;
class Migrator extends M
{
/**
* Fully qualified path to the application's migration directory
*
* @var string
*/
private $path;
$path
This check marks private properties in classes that are never used. Those properties can be removed.
* Get all of the migration files in a given path.
* @param string $path
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 $recursive
* @return array
public function getMigrationFiles($paths = [], $recursive = true)
if ($recursive) {
$paths = $this->getRecursiveFolders($paths);
}
$files = parent::getMigrationFiles($paths);
return $files;
* Get all subdirectories located in an array of folders
* @param array $folders
public function getRecursiveFolders($folders)
$paths = [];
foreach ($folders as $folder) {
$iter = new Iterator(
new DirectoryIterator($folder, DirectoryIterator::SKIP_DOTS),
Iterator::SELF_FIRST,
Iterator::CATCH_GET_CHILD // Ignore "Permission denied"
);
$subPaths = array($folder);
foreach ($iter as $path => $dir) {
if ($dir->isDir()) {
$subPaths[] = $path;
$paths = array_merge($paths, $subPaths);
return $paths;
* Add date folders to migrations path.
* @param string $file
* @return string
public function getDateFolderStructure($file)
$parts = explode('_', $file);
return $parts[0].'/'.$parts[1].'/';
This check marks private properties in classes that are never used. Those properties can be removed.