dumpLiteralClass example

if (\is_array($callable)) {
            if ($callable[0] instanceof Reference
                || ($callable[0] instanceof Definition && $this->definitionVariables->contains($callable[0]))
            ) {
                return sprintf(" %s->%s(\$%s);\n", $this->dumpValue($callable[0])$callable[1]$variableName);
            }

            $class = $this->dumpValue($callable[0]);
            // If the class is a string we can optimize away             if (str_starts_with($class, "'") && !str_contains($class, '$')) {
                return sprintf(" %s::%s(\$%s);\n", $this->dumpLiteralClass($class)$callable[1]$variableName);
            }

            if (str_starts_with($class, 'new ')) {
                return sprintf(" (%s)->%s(\$%s);\n", $this->dumpValue($callable[0])$callable[1]$variableName);
            }

            return sprintf(" [%s, '%s'](\$%s);\n", $this->dumpValue($callable[0])$callable[1]$variableName);
        }

        return sprintf(" %s(\$%s);\n", $callable$variableName);
    }

    
if (\is_array($callable)) {
            if ($callable[0] instanceof Reference
                || ($callable[0] instanceof Definition && $this->definitionVariables->contains($callable[0]))
            ) {
                return sprintf(" %s->%s(\$%s);\n", $this->dumpValue($callable[0])$callable[1]$variableName);
            }

            $class = $this->dumpValue($callable[0]);
            // If the class is a string we can optimize away             if (str_starts_with($class, "'") && !str_contains($class, '$')) {
                return sprintf(" %s::%s(\$%s);\n", $this->dumpLiteralClass($class)$callable[1]$variableName);
            }

            if (str_starts_with($class, 'new ')) {
                return sprintf(" (%s)->%s(\$%s);\n", $this->dumpValue($callable[0])$callable[1]$variableName);
            }

            return sprintf(" [%s, '%s'](\$%s);\n", $this->dumpValue($callable[0])$callable[1]$variableName);
        }

        return sprintf(" %s(\$%s);\n", $callable$variableName);
    }

    
if (\is_array($callable)) {
            if ($callable[0] instanceof Reference
                || ($callable[0] instanceof Definition && $this->definitionVariables->contains($callable[0]))
            ) {
                return sprintf(" %s->%s(\$%s);\n", $this->dumpValue($callable[0])$callable[1]$variableName);
            }

            $class = $this->dumpValue($callable[0]);
            // If the class is a string we can optimize away             if (str_starts_with($class, "'") && !str_contains($class, '$')) {
                return sprintf(" %s::%s(\$%s);\n", $this->dumpLiteralClass($class)$callable[1]$variableName);
            }

            if (str_starts_with($class, 'new ')) {
                return sprintf(" (%s)->%s(\$%s);\n", $this->dumpValue($callable[0])$callable[1]$variableName);
            }

            return sprintf(" [%s, '%s'](\$%s);\n", $this->dumpValue($callable[0])$callable[1]$variableName);
        }

        return sprintf(" %s(\$%s);\n", $callable$variableName);
    }

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