Skip to content

Using Tag attribute when loading DefinitionsLoader import #399

@vgrish

Description

@vgrish

Пробую загрузить определения из папки используя


// загрузка из файлов исходников.
$loader = (new DefinitionsLoader())
    ->import(namespace: 'MoonShine\\Page\\', src: __DIR__.'/src/Page/');

Ожидаю что определения в контейнере будут автоматом тегированы

$definitions = $loader->definitions();
foreach ($definitions as $key => $definition) {
    var_export($definition);echo PHP_EOL;
}

\Kaspi\DiContainer\DiDefinition\DiDefinitionAutowire::__set_state(array(
   'definition' => 'MoonShine\\Page\\Dashboard',
   'isSingleton' => NULL,
   'bindArguments' => 
  array (
  ),
   'tags' => 
  array (
  ),
   'setup' => 
  array (
  ),
))
\Kaspi\DiContainer\DiDefinition\DiDefinitionAutowire::__set_state(array(
   'definition' => 'MoonShine\\Page\\Test1',
   'isSingleton' => NULL,
   'bindArguments' => 
  array (
  ),
   'tags' => 
  array (
  ),
   'setup' => 
  array (
  ),
))

теги отсутствуют.

пример загружаемого класса

<?php

declare(strict_types=1);

namespace MoonShine\Page;

use Kaspi\DiContainer\Attributes\Tag;

#[Tag(name: 'pages.group')]
class Test {

} 

подобное поведение на версии

  • v3.15.x
  • 4.0.x/383-container-builder

Подскажи пожалуйста что я не так делаю?

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions