for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace LaravelLangBundler\Commands;
class MakeNewBundleFile extends LaravelLangBundlerCommand
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'langb:new {path}';
* The console command description.
protected $description = 'Make a new empty bundle file.';
* Execute the console command.
public function handle()
$this->setUp();
$pathArray = collect(explode('.', $this->argument('path')));
$filename = $pathArray->pop().'.php';
$pathArray->prepend('bundles');
$basePath = resource_path('lang/');
$path = $this->buildPath($pathArray, $basePath);
$pathArray
object<Illuminate\Support\Collection>
array
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example:
function acceptsInteger($int) { } $x = '123'; // string "123" // Instead of acceptsInteger($x); // we recommend to use acceptsInteger((integer) $x);
$this->createFile($path, $filename);
$this->info('Bundle file successfully created!');
}
* Create file from stub.
* @param string $path
* @param string $filename
protected function createFile($path, $filename)
$filePath = $path.$filename;
$stub = __DIR__.'/bundle-file-stub.php';
if (!$this->filesystem->exists($filePath)) {
$this->filesystem->copy($stub, $filePath);
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: