core-bundle/src/Routing/Matcher/DomainFilter.php
public function filter(RouteCollection $collection, Request $request): RouteCollection
    {
        $hasDomainMatch = false;
        $httpHost = $request->getHttpHost();

        foreach ($collection->all() as $route) {
            $host = $route->getHost();

            if ($host && $host === $httpHost) {
                $hasDomainMatch = true;
                break;
            }
        }

        if ($hasDomainMatch) {
            foreach ($collection->all() as $name => $route) {
                $host = $route->getHost();

                if (!$host || $host !== $httpHost) {
                    $collection->remove($name);
                }
            }
        }

        return $collection;
    }
public function filter(RouteCollection $collection, Request $request): RouteCollection
    {
        $hasDomainMatch = false;
        $httpHost = $request->getHttpHost();

        foreach ($collection->all() as $route) {
            $host = $route->getHost();

            if ($host && $host === $httpHost) {
                $hasDomainMatch = true;
                break;
            }
        }

        if ($hasDomainMatch) {
            foreach ($collection->all() as $name => $route) {
                $host = $route->getHost();

                if (!$host || $host !== $httpHost) {
                    $collection->remove($name);
                }
            }
        }

        return $collection;
    }
{@inheritdoc}