Skip to content

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

@shanginn

Description

@shanginn

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

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions