Symfony News

New in Symfony 4.2: Better autowiring debug

Nicolas Grekas

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:


Be trained by Symfony experts - 2018-11-5 Paris - 2018-11-5 Paris - 2018-11-7 Paris


About us

What a Symfony developer should know about the framework: News, Jobs, Tweets, Events, Videos,...

Resources

Find us on Twitter

Find us on Facebook