Skip to content

Cannot optimize app when boost is installed #37

@webard

Description

@webard

Laravel Package Version

1.0.1

Laravel Version

12.23.1

PHP Version

8.4.11

Database Driver & Version

Postgresql 17

Description

After installing laravel/boost package, there is an error during php artisan optimize:

 INFO  Caching framework bootstrap, configuration, and metadata.  

  config .............................................................................................................................. 46.56ms DONE
  events ............................................................................................................................... 0.89ms DONE
  routes .............................................................................................................................. 41.77ms FAIL

   TypeError 

  Cannot assign Laravel\SerializableClosure\Serializers\Native to property Spatie\LaravelPackageTools\Commands\InstallCommand::$startWith of type ?Closure

  at vendor/laravel/serializable-closure/src/Serializers/Native.php:288
    284▕                     if (is_array($value) || is_object($value)) {
    285▕                         static::wrapClosures($value, $storage);
    286▕                     }
    287▕ 
  ➜ 288▕                     $property->setValue($data, $value);
    289▕                 }
    290▕             } while ($reflection = $reflection->getParentClass());
    291▕         }
    292▕     }

  1   vendor/laravel/serializable-closure/src/Serializers/Native.php:288
      ReflectionProperty::setValue(Object(Spatie\LaravelPackageTools\Commands\InstallCommand), Object(Laravel\SerializableClosure\Serializers\Native))

  2   vendor/laravel/serializable-closure/src/Serializers/Native.php:229
      Laravel\SerializableClosure\Serializers\Native::wrapClosures(Object(Spatie\LaravelPackageTools\Commands\InstallCommand), Object(Laravel\SerializableClosure\Support\ClosureScope))

  3   vendor/laravel/serializable-closure/src/Serializers/Native.php:285
      Laravel\SerializableClosure\Serializers\Native::wrapClosures([Object(Spatie\LaravelPackageTools\Commands\InstallCommand)], Object(Laravel\SerializableClosure\Support\ClosureScope))

  4   vendor/laravel/serializable-closure/src/Serializers/Native.php:285
      Laravel\SerializableClosure\Serializers\Native::wrapClosures(Object(Spatie\LaravelPackageTools\Package), Object(Laravel\SerializableClosure\Support\ClosureScope))

  5   vendor/laravel/serializable-closure/src/Serializers/Native.php:229
      Laravel\SerializableClosure\Serializers\Native::wrapClosures(Object(Rmsramos\Activitylog\ActivitylogServiceProvider), Object(Laravel\SerializableClosure\Support\ClosureScope))

  6   vendor/laravel/serializable-closure/src/Serializers/Native.php:285
      Laravel\SerializableClosure\Serializers\Native::wrapClosures(Object(Laravel\SerializableClosure\Support\ClosureScope))

  7   vendor/laravel/serializable-closure/src/Serializers/Native.php:285
      Laravel\SerializableClosure\Serializers\Native::wrapClosures(Object(Illuminate\Foundation\Application), Object(Laravel\SerializableClosure\Support\ClosureScope))

  8   vendor/laravel/serializable-closure/src/Serializers/Native.php:125
      Laravel\SerializableClosure\Serializers\Native::wrapClosures(Object(Laravel\Boost\BoostServiceProvider), Object(Laravel\SerializableClosure\Support\ClosureScope))

  9   [internal]:0
      Laravel\SerializableClosure\Serializers\Native::__serialize()
  10  vendor/laravel/framework/src/Illuminate/Routing/Route.php:1383

  11  vendor/laravel/framework/src/Illuminate/Foundation/Console/RouteCacheCommand.php:63
      Illuminate\Routing\Route::prepareForSerialization()

  12  vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:36
      Illuminate\Foundation\Console\RouteCacheCommand::handle()

  13  vendor/laravel/framework/src/Illuminate/Container/Util.php:43
      Illuminate\Container\BoundMethod::{closure:Illuminate\Container\BoundMethod::call():35}()

  14  vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:96
      Illuminate\Container\Util::unwrapIfClosure(Object(Closure))

  15  vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:35
      Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Object(Closure))

  16  vendor/laravel/framework/src/Illuminate/Container/Container.php:812
      Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), [])

  17  vendor/laravel/framework/src/Illuminate/Console/Command.php:211
      Illuminate\Container\Container::call()

  18  vendor/symfony/console/Command/Command.php:318
      Illuminate\Console\Command::execute(Object(Symfony\Component\Console\Input\ArrayInput), Object(Illuminate\Console\OutputStyle))

  19  vendor/laravel/framework/src/Illuminate/Console/Command.php:180
      Symfony\Component\Console\Command\Command::run(Object(Symfony\Component\Console\Input\ArrayInput), Object(Illuminate\Console\OutputStyle))

  20  vendor/laravel/framework/src/Illuminate/Console/Concerns/CallsCommands.php:68
      Illuminate\Console\Command::run(Object(Symfony\Component\Console\Input\ArrayInput), Object(Symfony\Component\Console\Output\NullOutput))

  21  vendor/laravel/framework/src/Illuminate/Console/Concerns/CallsCommands.php:41
      Illuminate\Console\Command::runCommand("route:cache", ["route:cache"], Object(Symfony\Component\Console\Output\NullOutput))

  22  vendor/laravel/framework/src/Illuminate/Console/Concerns/CallsCommands.php:53
      Illuminate\Console\Command::callSilent("route:cache", [])

  23  vendor/laravel/framework/src/Illuminate/Foundation/Console/OptimizeCommand.php:48
      Illuminate\Console\Command::callSilently("route:cache")

  24  vendor/laravel/framework/src/Illuminate/Console/View/Components/Task.php:41
      Illuminate\Foundation\Console\OptimizeCommand::{closure:Illuminate\Foundation\Console\OptimizeCommand::handle():48}()

  25  vendor/laravel/framework/src/Illuminate/Console/View/Components/Factory.php:59
      Illuminate\Console\View\Components\Task::render("routes", Object(Closure))

  26  vendor/laravel/framework/src/Illuminate/Foundation/Console/OptimizeCommand.php:48
      Illuminate\Console\View\Components\Factory::__call("task")

  27  vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:36
      Illuminate\Foundation\Console\OptimizeCommand::handle()

  28  vendor/laravel/framework/src/Illuminate/Container/Util.php:43
      Illuminate\Container\BoundMethod::{closure:Illuminate\Container\BoundMethod::call():35}()

  29  vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:96
      Illuminate\Container\Util::unwrapIfClosure(Object(Closure))

  30  vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:35
      Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Object(Closure))

  31  vendor/laravel/framework/src/Illuminate/Container/Container.php:812
      Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), [])

  32  vendor/laravel/framework/src/Illuminate/Console/Command.php:211
      Illuminate\Container\Container::call()

  33  vendor/symfony/console/Command/Command.php:318
      Illuminate\Console\Command::execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))

  34  vendor/laravel/framework/src/Illuminate/Console/Command.php:180
      Symfony\Component\Console\Command\Command::run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))

  35  vendor/symfony/console/Application.php:1092
      Illuminate\Console\Command::run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

  36  vendor/symfony/console/Application.php:341
      Symfony\Component\Console\Application::doRunCommand(Object(Illuminate\Foundation\Console\OptimizeCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

  37  vendor/symfony/console/Application.php:192
      Symfony\Component\Console\Application::doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

  38  vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:197
      Symfony\Component\Console\Application::run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

  39  vendor/laravel/framework/src/Illuminate/Foundation/Application.php:1234
      Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

  40  artisan:13
      Illuminate\Foundation\Application::handleCommand(Object(Symfony\Component\Console\Input\ArgvInput))

Steps To Reproduce

  1. Install laravel/boost
  2. Run php artisan optimize

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions