New in Symfony 4.2: Better autowiring debug

Contributed by
Nicolas Grekas
in #28970.

The debug:autowiring command displays all classes and interfaces that Symfony developers can use as type-hints for service autowiring. In previous Symfony versions, it looked like this when looking for something specific (e.g. the cache):

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
$ ./bin/console debug:autowiring cache

Autowirable Services
====================

 The following classes & interfaces can be used as type-hints when autowiring:
 (only showing classes/interfaces matching cache)

 --------------------------------------------------
  Psr\Cache\CacheItemPoolInterface
      alias to cache.app
  Psr\SimpleCache\CacheInterface
      alias to cache.app.simple
  Symfony\Component\Cache\Adapter\AdapterInterface
      alias to cache.app
  Symfony\Contracts\Cache\CacheInterface
      alias to cache.app
  Symfony\Contracts\Cache\TagAwareCacheInterface
      alias to cache.app.taggable
 --------------------------------------------------

In Symfony 4.2 we improved this command to make the information easier to understand. The same search for cache now looks like this:

As you can see, the description of what the service does now appears above it. This description is taken from the PHPdoc of the related interface. Also, the autowire by type and name feature introduced in Symfony 4.2 is displayed (e.g. CacheInterface $cacheApp).

Comments

Nice!!!

Thanks!!!
it too great.... :)
great improvement...keep it up :-)
Thanks Nicolas!
Awesome.
Login with SymfonyConnect to post a comment