Laravel-Lang / publisher

Publisher provides functionality for working with application localization
https://laravel-lang.com/packages-publisher.html
MIT License
212 stars 25 forks source link

All commands fail - TypeError Processors/Processor.php #265

Closed ghost closed 2 years ago

ghost commented 2 years ago

Description:

  TypeError

  LaravelLang\Publisher\Processors\Processor::LaravelLang\Publisher\Processors\{closure}(): Argument #1 ($plugin) must be of type string, array given, called in .../vendor/dragon-code/support/src/Instances/Call.php on line 163

  at vendor/laravel-lang/publisher/src/Processors/Processor.php:123
    119▕     {
    120▕         return Arr::of($this->config->plugins())
    121▕             ->map(static function (array $plugins): array {
    122▕                 return Arr::of($plugins)
  ➜ 123▕                     ->map(static fn (string $plugin)    => new $plugin())
    124▕                     ->filter(static fn (Plugin $plugin) => $plugin->has())
    125▕                     ->toArray();
    126▕             })
    127▕             ->filter()

Steps To Reproduce:

  1. Install the package
  2. Run any command.
andrey-helldar commented 2 years ago

What localization plugins do you use? Only laravel-lang/lang or something else?

andrey-helldar commented 2 years ago

PHP 8.1.7

laravel new blog
cd blog
composer require laravel-lang/publisher laravel-lang/lang --dev
php artisan lang:add fr
php artisan lang:update

image

Next,

composer require laravel/jetstream laravel/ui laravel/cashier
php artisan lang:update

image

andrey-helldar commented 2 years ago

Can you show your composer.json file?

ghost commented 2 years ago

I don't get the error on a clean install. I'll investigate what's the cause.

My composer.json

{
    "name": "laravel/laravel",
    "type": "project",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "require": {
        "php": "^8.1.0",
        "barryvdh/laravel-snappy": "^1.0",
        "danielebarbaro/laravel-vat-eu-validator": "^1.0",
        "guzzlehttp/guzzle": "^7.2",
        "h4cc/wkhtmltopdf-amd64": "0.12.x",
        "laravel/framework": "^9.9",
        "laravel/jetstream": "^2.7",
        "laravel/sanctum": "^2.14.1",
        "laravel/tinker": "^2.7",
        "livewire/livewire": "^2.5",
        "spatie/laravel-ignition": "^1.2",
        "spatie/laravel-model-states": "^2.4",
        "stripe/stripe-php": "^8.4",
        "symfony/http-client": "^6.0",
        "symfony/postmark-mailer": "^6.0"
    },
    "require-dev": {
        "barryvdh/laravel-debugbar": "^3.6",
        "barryvdh/laravel-ide-helper": "^2.12",
        "fakerphp/faker": "^1.9.1",
        "jetbrains/phpstorm-attributes": "^1.0",
        "laravel-lang/lang": "^11.0",
        "laravel-lang/publisher": "^14.0",
        "mockery/mockery": "^1.4.4",
        "nascent-africa/jetstrap": "^2.5",
        "nunomaduro/collision": "^6.1",
        "nunomaduro/larastan": "^2.0",
        "phpunit/phpunit": "^9.5.10"
    },
    "autoload": {
        "psr-4": {
            "App\\": "src/App",
            "Domain\\": "src/Domain",
            "Support\\": "src/Support",
            "Database\\Factories\\": "database/factories/",
            "Database\\Seeders\\": "database/seeders/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        }
    },
    "scripts": {
        "post-autoload-dump": [
            "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover --ansi"
        ],
        "post-update-cmd": [
            "@php artisan vendor:publish --tag=laravel-assets --ansi --force",
             "Illuminate\\Foundation\\ComposerScripts::postUpdate",
            "@php artisan ide-helper:generate",
            "@php artisan ide-helper:meta"
        ],
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate --ansi"
        ]
    },
    "extra": {
        "laravel": {
            "dont-discover": []
        }
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": "dist",
        "sort-packages": true
    },
    "minimum-stability": "dev",
    "prefer-stable": true
}
ghost commented 2 years ago

It seems like the issue is with the dot in my project folder name. eg. "projectfolder.com"

When I dump the config->plugins()

^ array:1 [
  "/shared/httpd/projectfolder" => array:1 [
    "com/vendor/laravel-lang/lang" => array:23 [
      0 => "LaravelLang\Lang\Plugins\Breeze\V1"
      1 => "LaravelLang\Lang\Plugins\Cashier\Stripe\V12"
      2 => "LaravelLang\Lang\Plugins\Cashier\Stripe\V13"
      3 => "LaravelLang\Lang\Plugins\Fortify\V1"
      4 => "LaravelLang\Lang\Plugins\Jetstream\Master"
      5 => "LaravelLang\Lang\Plugins\Jetstream\V1"
      6 => "LaravelLang\Lang\Plugins\Jetstream\V2"
      7 => "LaravelLang\Lang\Plugins\Laravel\Master"
      8 => "LaravelLang\Lang\Plugins\Laravel\V6"
      9 => "LaravelLang\Lang\Plugins\Laravel\V7"
      10 => "LaravelLang\Lang\Plugins\Laravel\V8"
      11 => "LaravelLang\Lang\Plugins\Laravel\V9"
      12 => "LaravelLang\Lang\Plugins\Lumen\V6"
      13 => "LaravelLang\Lang\Plugins\Lumen\V7"
      14 => "LaravelLang\Lang\Plugins\Lumen\V8"
      15 => "LaravelLang\Lang\Plugins\Lumen\V9"
      16 => "LaravelLang\Lang\Plugins\Nova\V3"
      17 => "LaravelLang\Lang\Plugins\Nova\V4"
      18 => "LaravelLang\Lang\Plugins\Spark\Paddle"
      19 => "LaravelLang\Lang\Plugins\Spark\Stripe"
      20 => "LaravelLang\Lang\Plugins\UI\V1"
      21 => "LaravelLang\Lang\Plugins\UI\V2"
      22 => "LaravelLang\Lang\Plugins\UI\V3"
    ]
  ]
]
andrey-helldar commented 2 years ago

Yes indeed. I will fix this bug soon.

andrey-helldar commented 2 years ago

@Vincent-Ntriga, patch 14.0.4 has been released with a fix.

Thank you for issue!

ghost commented 2 years ago

That's fast! Thx!

andrey-helldar commented 2 years ago

You're welcome!