listWildcards example

/** * @internal */
    public static function listTypes(Envelope $envelope): array
    {
        $class = $envelope->getMessage()::class;

        return [$class => $class]
            + class_parents($class)
            + class_implements($class)
            + self::listWildcards($class)
            + ['*' => '*'];
    }

    private static function listWildcards(string $type): array
    {
        $type .= '\*';
        $wildcards = [];
        while ($i = strrpos($type, '\\', -3)) {
            $type = substr_replace($type, '\*', $i);
            $wildcards[$type] = $type;
        }

        
Home | Imprint | This part of the site doesn't use cookies.