<p dir="auto">It follows  <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="44694367" data-permission-text="Title is private" data-url="https://github.com/symfony/symfony/issues/12099" data-hovercard-type="issue" data-hovercard-url="/symfony/symfony/issues/12099/hovercard" href="https://github.com/symfony/symfony/issues/12099">#12099</a>.</p>
<p dir="auto">This matcher is IMO really dirty.</p>
<p dir="auto">It searches for routes with a whole bunch of methods, hosts and all, and even if each route is different in its requirements, we know that there are a "fix" amount of requirement types which can all have their own "priority", each with a wildcard <code class="notranslate">*</code> to allow non-required elements.</p>
<p dir="auto">Here is an example of a priority usage (all beginning with wilcard check, and after that, specific check):</p>
<ul dir="auto">
<li>host
<ul dir="auto">
<li>prefix
<ul dir="auto">
<li>methods
<ul dir="auto">
<li>requirements</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<p dir="auto">This may creates a few duplicates for multiple methods, but it may get rid of these old and dirty <code class="notranslate">goto</code> inside the matcher for example. The best point IMO is that it would really more "flatten" the matcher.</p>
<p dir="auto">I don't know if this issue is relevant enough for Symfony, but feel free to close it if it really does not suit :)</p>
<p dir="auto">Currently, decorating event listeners (<code class="notranslate">kernel.event_listener</code>) makes the decorated service private:<br>
<a href="https://github.com/symfony/dependency-injection/blob/5d4f4ff02a3a5b24a7c81bb7e22f2e57c7526ee2/Compiler/DecoratorServicePass.php#L47-L58">https://github.com/symfony/dependency-injection/blob/5d4f4ff02a3a5b24a7c81bb7e22f2e57c7526ee2/Compiler/DecoratorServicePass.php#L47-L58</a><br>
resulting in an exception being thrown here:<br>
</p><div class="Box Box--condensed my-2">
  <div class="Box-header f6">
    <p class="mb-0 text-bold">
      <a href="https://github.com/symfony/symfony/blob/94078a09aceeb5b890288a4ae088c5aeee0b1724/src/Symfony/Component/EventDispatcher/DependencyInjection/RegisterListenersPass.php#L61-L63">symfony/src/Symfony/Component/EventDispatcher/DependencyInjection/RegisterListenersPass.php</a>
    </p>
    <p class="mb-0 color-fg-muted">
        Lines 61 to 63
      in
      <a data-pjax="true" class="commit-tease-sha" href="/symfony/symfony/commit/94078a09aceeb5b890288a4ae088c5aeee0b1724">94078a0</a>
    </p>
  </div>
  <div itemprop="text" class="Box-body p-0 blob-wrapper blob-wrapper-embedded data">
    <table class="highlight tab-size mb-0 js-file-line-container" data-tab-size="8" data-paste-markdown-skip="">

        <tbody><tr class="border-0">
          <td id="L61" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="61"></td>
          <td id="LC61" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-k">if</span> (!<span class="pl-s1"><span class="pl-c1">$</span>def</span>-&gt;<span class="pl-en">isPublic</span>()) { </td>
        </tr>

        <tr class="border-0">
          <td id="L62" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="62"></td>
          <td id="LC62" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">     <span class="pl-k">throw</span> <span class="pl-k">new</span> \<span class="pl-v">InvalidArgumentException</span>(sprintf(<span class="pl-s">'The service "%s" must be public as event listeners are lazy-loaded.'</span>, <span class="pl-s1"><span class="pl-c1">$</span>id</span>)); </td>
        </tr>

        <tr class="border-0">
          <td id="L63" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="63"></td>
          <td id="LC63" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> } </td>
        </tr>
    </tbody></table>
  </div>
</div>
<p></p>
<p dir="auto">This makes it impossible to decorate event listeners. (Also, I can't find any tests of decorating event listeners. Are there any?)</p>