Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type error: implode(): Argument #2 ($array) must be of type ?array, string given #68

Closed
xigu opened this issue Dec 23, 2021 · 0 comments

Comments

@xigu
Copy link

xigu commented Dec 23, 2021

D:\www\cdirs\master>php think migrate:create Users

[think\exception\ThrowableError]
Type error: implode(): Argument #2 ($array) must be of type ?array, string given

Exception trace:
() at D:\www\cdirs\master\vendor\topthink\think-migration\phinx\src\Phinx\Util\Util.php:110
implode() at D:\www\cdirs\master\vendor\topthink\think-migration\phinx\src\Phinx\Util\Util.php:110
Phinx\Util\Util::mapClassNameToFileName() at D:\www\cdirs\master\vendor\topthink\think-migration\src\command\migrate\Create.php:65
think\migration\command\migrate\Create->execute() at D:\www\cdirs\master\thinkphp\library\think\console\Command.php:175
think\console\Command->run() at D:\www\cdirs\master\thinkphp\library\think\Console.php:675
think\Console->doRunCommand() at D:\www\cdirs\master\thinkphp\library\think\Console.php:261
think\Console->doRun() at D:\www\cdirs\master\thinkphp\library\think\Console.php:198
think\Console->run() at D:\www\cdirs\master\thinkphp\library\think\Console.php:115
think\Console::init() at D:\www\cdirs\master\think:20

"topthink/think-migration": "2.0.3"
public static function mapClassNameToFileName($className)
{
$arr = preg_split('/(?=[A-Z])/', $className);
unset($arr[0]); // remove the first element ('')
$fileName = static::getCurrentTimestamp() . '' . strtolower(implode( $arr,'')) . '.php';
return $fileName;
}
Change
public static function mapClassNameToFileName($className)
{
$arr = preg_split('/(?=[A-Z])/', $className);
unset($arr[0]); // remove the first element ('')
$fileName = static::getCurrentTimestamp() . '' . strtolower(implode( '',$arr)) . '.php';
return $fileName;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants