diff --git a/src/Commands/Publish.php b/src/Commands/Publish.php index 7b473cd..18c5ae5 100644 --- a/src/Commands/Publish.php +++ b/src/Commands/Publish.php @@ -30,7 +30,7 @@ public function __construct() /** * Execute the console command. * - * @return mixed + * @return void */ public function handle() { @@ -39,10 +39,11 @@ public function handle() $sourcePath = base_path('vendor/laravel-lang/lang/locales'); $sourceJsonPath = base_path('vendor/laravel-lang/lang/locales'); - $targetPath = base_path('resources/lang/'); + $targetPath = base_path('lang'); if (!is_dir($targetPath) && !mkdir($targetPath)) { - return $this->error('The lang path "resources/lang/" does not exist or not writable.'); + $this->error('The lang path "lang" does not exist or not writable.'); + return; } $files = []; @@ -100,11 +101,11 @@ public function handle() $files = implode(' ', $files); $targetPath = escapeshellarg($targetPath); $command = "cp -r{$force} {$files} {$targetPath}"; - $process = \method_exists(Process::class, 'fromShellCommandline') ? Process::fromShellCommandline($command) : new Process($command); + $process = \method_exists(Process::class, 'fromShellCommandline') ? Process::fromShellCommandline($command) : new Process([$command]); $process->run(function ($type, $buffer) { if (Process::ERR === $type) { - return $this->error(trim($buffer)); + $this->error(trim($buffer)); } }); diff --git a/src/FileLoader.php b/src/FileLoader.php index 1da926c..9f8f415 100644 --- a/src/FileLoader.php +++ b/src/FileLoader.php @@ -23,10 +23,10 @@ class FileLoader extends LaravelTranslationFileLoader * Create a new file loader instance. * * @param \Illuminate\Filesystem\Filesystem $files - * @param array $path - * @param array $paths + * @param string $path + * @param array $paths */ - public function __construct(Filesystem $files, $path, $paths = []) + public function __construct(Filesystem $files, string $path, array $paths = []) { $this->paths = $paths; @@ -64,7 +64,7 @@ public function load($locale, $group, $namespace = null) * * @return array */ - protected function loadPath($path, $locale, $group) + protected function loadPath($path, $locale, $group): array { $result = parent::loadPath($path, $locale, $group); diff --git a/src/TranslationServiceProvider.php b/src/TranslationServiceProvider.php index bd0f2ed..fc0d5cb 100644 --- a/src/TranslationServiceProvider.php +++ b/src/TranslationServiceProvider.php @@ -51,7 +51,7 @@ protected function registerLoader() if ($this->inLumen) { $this->app['path.lang'] = base_path('vendor/laravel/lumen-framework/resources/lang'); - array_push($paths, base_path('resources/lang/')); + $paths[] = base_path('lang'); } $loader = new FileLoader($app['files'], $app['path.lang'], $paths); @@ -77,7 +77,7 @@ protected function registerCommands() * * @return array */ - public function provides() + public function provides(): array { return array_merge(parent::provides(), [PublishCommand::class]); }