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

'array' as alias for ArrayStorage in default installation for cache config do not work #1161

Open
shanginn opened this issue Oct 22, 2024 · 0 comments
Labels

Comments

@shanginn
Copy link

Description

On the fresh spiral framework install in the config/cache.php local driver for cache is defined as

'local' => [
    // Alias for ArrayStorage type
    'type' => 'array',
],

But the alias itself is missing or not working properly, because when running default tests the error is thrown:

[Spiral\Core\Exception\Container\NotFoundException]
Can't resolve `Spiral\Scheduler\JobsLocatorInterface`: undefined class or binding `array`.
Container trace list:
- action: 'resolve from binding'
  alias: 'Spiral\Scheduler\JobsLocatorInterface'
  scope: 'root'
  context: Parameter #0 [ <required> Spiral\Scheduler\JobsLocatorInterface $locator ]
  binding: Alias to `Spiral\Scheduler\JobsLocator`
  - action: 'resolve from binding'
    alias: 'Spiral\Scheduler\JobsLocator'
    scope: 'root'
    context: Parameter #0 [ <required> Spiral\Scheduler\JobsLocatorInterface $locator ]
    binding: Deferred factory 'Spiral\Scheduler\Bootloader\SchedulerBootloader'->initJobsLocator()
    - action: 'resolve from binding'
      alias: 'Spiral\Scheduler\Mutex\JobMutexInterface'
      scope: 'root'
      context: Parameter #1 [ <required> Spiral\Scheduler\Mutex\JobMutexInterface $mutex ]
      binding: Deferred factory 'Spiral\Scheduler\Bootloader\SchedulerBootloader'->initEventMutex()
      - action: 'autowire'
        alias: 'array'
        context: null
in vendor/spiral/framework/src/Core/src/Internal/Factory.php:359

The fix that worked for me is just to replace it with the class itself:

'local' => [
    'type' => ArrayStorage::class,
],

How To Reproduce

Repo with the problem present. Just run phpunit and you will get the error

Install log and phpunit run with error

Additional Info

Q A
Framework Version 3.14.5
PHP version 8.3.10
Operating system MacOS
@shanginn shanginn added the Bug label Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant