ALPHA 3.0.2a

This commit is contained in:
TheGamecraft
2018-09-10 08:51:18 -04:00
parent 7fe13ae0a7
commit 0e0ef86b71
1404 changed files with 10604 additions and 33714 deletions

View File

@@ -35,10 +35,10 @@ class ArgsStub extends EnumStub
return;
}
if (count($values) < count($params)) {
$params = array_slice($params, 0, count($values));
} elseif (count($values) > count($params)) {
$values[] = new EnumStub(array_splice($values, count($params)), false);
if (\count($values) < \count($params)) {
$params = \array_slice($params, 0, \count($values));
} elseif (\count($values) > \count($params)) {
$values[] = new EnumStub(array_splice($values, \count($params)), false);
$params[] = $variadic;
}
if (array('...') === $params) {

View File

@@ -117,10 +117,10 @@ class Caster
} elseif (false === $v || '' === $v || '0' === $v || 0 === $v || 0.0 === $v || array() === $v) {
$type |= self::EXCLUDE_EMPTY & $filter;
}
if ((self::EXCLUDE_NOT_IMPORTANT & $filter) && !in_array($k, $listedProperties, true)) {
if ((self::EXCLUDE_NOT_IMPORTANT & $filter) && !\in_array($k, $listedProperties, true)) {
$type |= self::EXCLUDE_NOT_IMPORTANT;
}
if ((self::EXCLUDE_VERBOSE & $filter) && in_array($k, $listedProperties, true)) {
if ((self::EXCLUDE_VERBOSE & $filter) && \in_array($k, $listedProperties, true)) {
$type |= self::EXCLUDE_VERBOSE;
}

View File

@@ -27,7 +27,7 @@ class ClassStub extends ConstStub
$this->value = $identifier;
if (0 < $i = strrpos($identifier, '\\')) {
$this->attr['ellipsis'] = strlen($identifier) - $i;
$this->attr['ellipsis'] = \strlen($identifier) - $i;
$this->attr['ellipsis-type'] = 'class';
$this->attr['ellipsis-tail'] = 1;
}
@@ -36,9 +36,9 @@ class ClassStub extends ConstStub
if (null !== $callable) {
if ($callable instanceof \Closure) {
$r = new \ReflectionFunction($callable);
} elseif (is_object($callable)) {
} elseif (\is_object($callable)) {
$r = array($callable, '__invoke');
} elseif (is_array($callable)) {
} elseif (\is_array($callable)) {
$r = $callable;
} elseif (false !== $i = strpos($callable, '::')) {
$r = array(substr($callable, 0, $i), substr($callable, 2 + $i));
@@ -51,7 +51,7 @@ class ClassStub extends ConstStub
$r = new \ReflectionClass($identifier);
}
if (is_array($r)) {
if (\is_array($r)) {
try {
$r = new \ReflectionMethod($r[0], $r[1]);
} catch (\ReflectionException $e) {
@@ -70,13 +70,13 @@ class ClassStub extends ConstStub
public static function wrapCallable($callable)
{
if (is_object($callable) || !is_callable($callable)) {
if (\is_object($callable) || !\is_callable($callable)) {
return $callable;
}
if (!is_array($callable)) {
if (!\is_array($callable)) {
$callable = new static($callable);
} elseif (is_string($callable[0])) {
} elseif (\is_string($callable[0])) {
$callable[0] = new static($callable[0]);
} else {
$callable[1] = new static($callable[1], $callable);

View File

@@ -25,6 +25,6 @@ class CutArrayStub extends CutStub
parent::__construct($value);
$this->preservedSubset = array_intersect_key($value, array_flip($preservedKeys));
$this->cut -= count($this->preservedSubset);
$this->cut -= \count($this->preservedSubset);
}
}

View File

@@ -24,17 +24,17 @@ class CutStub extends Stub
{
$this->value = $value;
switch (gettype($value)) {
switch (\gettype($value)) {
case 'object':
$this->type = self::TYPE_OBJECT;
$this->class = get_class($value);
$this->class = \get_class($value);
$this->cut = -1;
break;
case 'array':
$this->type = self::TYPE_ARRAY;
$this->class = self::ARRAY_ASSOC;
$this->cut = $this->value = count($value);
$this->cut = $this->value = \count($value);
break;
case 'resource':
@@ -51,7 +51,7 @@ class CutStub extends Stub
case 'string':
$this->type = self::TYPE_STRING;
$this->class = preg_match('//u', $value) ? self::STRING_UTF8 : self::STRING_BINARY;
$this->cut = self::STRING_BINARY === $this->class ? strlen($value) : mb_strlen($value, 'UTF-8');
$this->cut = self::STRING_BINARY === $this->class ? \strlen($value) : mb_strlen($value, 'UTF-8');
$this->value = '';
break;
}

View File

@@ -73,7 +73,7 @@ class DateCaster
{
$location = $timeZone->getLocation();
$formatted = (new \DateTime('now', $timeZone))->format($location ? 'e (P)' : 'P');
$title = $location && extension_loaded('intl') ? \Locale::getDisplayRegion('-'.$location['country_code']) : '';
$title = $location && \extension_loaded('intl') ? \Locale::getDisplayRegion('-'.$location['country_code']) : '';
$z = array(Caster::PREFIX_VIRTUAL.'timezone' => new ConstStub($formatted, $title));
@@ -117,6 +117,6 @@ class DateCaster
private static function formatSeconds($s, $us)
{
return sprintf('%02d.%s', $s, 0 === ($len = strlen($t = rtrim($us, '0'))) ? '0' : ($len <= 3 ? str_pad($t, 3, '0') : $us));
return sprintf('%02d.%s', $s, 0 === ($len = \strlen($t = rtrim($us, '0'))) ? '0' : ($len <= 3 ? str_pad($t, 3, '0') : $us));
}
}

View File

@@ -12,8 +12,8 @@
namespace Symfony\Component\VarDumper\Caster;
use Doctrine\Common\Proxy\Proxy as CommonProxy;
use Doctrine\ORM\Proxy\Proxy as OrmProxy;
use Doctrine\ORM\PersistentCollection;
use Doctrine\ORM\Proxy\Proxy as OrmProxy;
use Symfony\Component\VarDumper\Cloner\Stub;
/**

View File

@@ -12,8 +12,8 @@
namespace Symfony\Component\VarDumper\Caster;
use Symfony\Component\Debug\Exception\SilencedErrorContext;
use Symfony\Component\VarDumper\Exception\ThrowingCasterException;
use Symfony\Component\VarDumper\Cloner\Stub;
use Symfony\Component\VarDumper\Exception\ThrowingCasterException;
/**
* Casts common Exception classes to array representation.
@@ -71,8 +71,8 @@ class ExceptionCaster
if (isset($a[$xPrefix.'previous'], $a[$trace]) && $a[$xPrefix.'previous'] instanceof \Exception) {
$b = (array) $a[$xPrefix.'previous'];
self::traceUnshift($b[$xPrefix.'trace'], get_class($a[$xPrefix.'previous']), $b[$prefix.'file'], $b[$prefix.'line']);
$a[$trace] = new TraceStub($b[$xPrefix.'trace'], false, 0, -count($a[$trace]->value));
self::traceUnshift($b[$xPrefix.'trace'], \get_class($a[$xPrefix.'previous']), $b[$prefix.'file'], $b[$prefix.'line']);
$a[$trace] = new TraceStub($b[$xPrefix.'trace'], false, 0, -\count($a[$trace]->value));
}
unset($a[$xPrefix.'previous'], $a[$prefix.'code'], $a[$prefix.'file'], $a[$prefix.'line']);
@@ -118,7 +118,7 @@ class ExceptionCaster
$prefix = Caster::PREFIX_VIRTUAL;
$a = array();
$j = count($frames);
$j = \count($frames);
if (0 > $i = $trace->sliceOffset) {
$i = max(0, $j + $i);
}
@@ -175,7 +175,7 @@ class ExceptionCaster
$lastCall = $call;
}
if (null !== $trace->sliceLength) {
$a = array_slice($a, 0, $trace->sliceLength, true);
$a = \array_slice($a, 0, $trace->sliceLength, true);
}
return $a;
@@ -199,7 +199,7 @@ class ExceptionCaster
$a[$prefix.'src'] = self::$framesCache[$cacheKey];
} else {
if (preg_match('/\((\d+)\)(?:\([\da-f]{32}\))? : (?:eval\(\)\'d code|runtime-created function)$/', $f['file'], $match)) {
$f['file'] = substr($f['file'], 0, -strlen($match[0]));
$f['file'] = substr($f['file'], 0, -\strlen($match[0]));
$f['line'] = (int) $match[1];
}
$caller = isset($f['function']) ? sprintf('in %s() on line %d', (isset($f['class']) ? $f['class'].$f['type'] : '').$f['function'], $f['line']) : null;
@@ -212,7 +212,7 @@ class ExceptionCaster
if (file_exists($f['file']) && 0 <= self::$srcContext) {
if (!empty($f['class']) && (is_subclass_of($f['class'], 'Twig\Template') || is_subclass_of($f['class'], 'Twig_Template')) && method_exists($f['class'], 'getDebugInfo')) {
$template = isset($f['object']) ? $f['object'] : unserialize(sprintf('O:%d:"%s":0:{}', strlen($f['class']), $f['class']));
$template = isset($f['object']) ? $f['object'] : unserialize(sprintf('O:%d:"%s":0:{}', \strlen($f['class']), $f['class']));
$ellipsis = 0;
$templateSrc = method_exists($template, 'getSourceContext') ? $template->getSourceContext()->getCode() : (method_exists($template, 'getSource') ? $template->getSource() : '');
@@ -231,7 +231,7 @@ class ExceptionCaster
$src = self::extractSource(file_get_contents($f['file']), $f['line'], self::$srcContext, $caller, 'php', $f['file']);
$srcKey .= ':'.$f['line'];
if ($ellipsis) {
$ellipsis += 1 + strlen($f['line']);
$ellipsis += 1 + \strlen($f['line']);
}
}
$srcAttr .= '&separator= ';

View File

@@ -30,7 +30,7 @@ class LinkStub extends ConstStub
if (null === $href) {
$href = $label;
}
if (!is_string($href)) {
if (!\is_string($href)) {
return;
}
if (0 === strpos($href, 'file://')) {
@@ -53,11 +53,11 @@ class LinkStub extends ConstStub
return;
}
if ($composerRoot = $this->getComposerRoot($href, $this->inVendor)) {
$this->attr['ellipsis'] = strlen($href) - strlen($composerRoot) + 1;
$this->attr['ellipsis'] = \strlen($href) - \strlen($composerRoot) + 1;
$this->attr['ellipsis-type'] = 'path';
$this->attr['ellipsis-tail'] = 1 + ($this->inVendor ? 2 + strlen(implode(array_slice(explode(DIRECTORY_SEPARATOR, substr($href, 1 - $this->attr['ellipsis'])), 0, 2))) : 0);
} elseif (3 < count($ellipsis = explode(DIRECTORY_SEPARATOR, $href))) {
$this->attr['ellipsis'] = 2 + strlen(implode(array_slice($ellipsis, -2)));
$this->attr['ellipsis-tail'] = 1 + ($this->inVendor ? 2 + \strlen(implode(\array_slice(explode(\DIRECTORY_SEPARATOR, substr($href, 1 - $this->attr['ellipsis'])), 0, 2))) : 0);
} elseif (3 < \count($ellipsis = explode(\DIRECTORY_SEPARATOR, $href))) {
$this->attr['ellipsis'] = 2 + \strlen(implode(\array_slice($ellipsis, -2)));
$this->attr['ellipsis-type'] = 'path';
$this->attr['ellipsis-tail'] = 1;
}
@@ -71,16 +71,16 @@ class LinkStub extends ConstStub
foreach (get_declared_classes() as $class) {
if ('C' === $class[0] && 0 === strpos($class, 'ComposerAutoloaderInit')) {
$r = new \ReflectionClass($class);
$v = dirname(dirname($r->getFileName()));
$v = \dirname(\dirname($r->getFileName()));
if (file_exists($v.'/composer/installed.json')) {
self::$vendorRoots[] = $v.DIRECTORY_SEPARATOR;
self::$vendorRoots[] = $v.\DIRECTORY_SEPARATOR;
}
}
}
}
$inVendor = false;
if (isset(self::$composerRoots[$dir = dirname($file)])) {
if (isset(self::$composerRoots[$dir = \dirname($file)])) {
return self::$composerRoots[$dir];
}
@@ -96,13 +96,13 @@ class LinkStub extends ConstStub
// open_basedir restriction in effect
break;
}
if ($parent === dirname($parent)) {
if ($parent === \dirname($parent)) {
return self::$composerRoots[$dir] = false;
}
$parent = dirname($parent);
$parent = \dirname($parent);
}
return self::$composerRoots[$dir] = $parent.DIRECTORY_SEPARATOR;
return self::$composerRoots[$dir] = $parent.\DIRECTORY_SEPARATOR;
}
}

View File

@@ -70,7 +70,7 @@ class PdoCaster
}
try {
$attr[$k] = 'ERRMODE' === $k ? $errmode : $c->getAttribute(constant('PDO::ATTR_'.$k));
$attr[$k] = 'ERRMODE' === $k ? $errmode : $c->getAttribute(\constant('PDO::ATTR_'.$k));
if ($v && isset($v[$attr[$k]])) {
$attr[$k] = new ConstStub($v[$attr[$k]], $attr[$k]);
}

View File

@@ -37,7 +37,7 @@ class RedisCaster
}
$ser = $c->getOption(\Redis::OPT_SERIALIZER);
$retry = defined('Redis::OPT_SCAN') ? $c->getOption(\Redis::OPT_SCAN) : 0;
$retry = \defined('Redis::OPT_SCAN') ? $c->getOption(\Redis::OPT_SCAN) : 0;
return $a + array(
$prefix.'isConnected' => $connected,

View File

@@ -198,7 +198,7 @@ class ReflectionCaster
if ($v = $c->getStaticVariables()) {
foreach ($v as $k => &$v) {
if (is_object($v)) {
if (\is_object($v)) {
$a[$prefix.'use']['$'.$k] = new CutStub($v);
} else {
$a[$prefix.'use']['$'.$k] = &$v;

View File

@@ -30,7 +30,7 @@ class StubCaster
$stub->cut = $c->cut;
$stub->attr = $c->attr;
if (Stub::TYPE_REF === $c->type && !$c->class && is_string($c->value) && !preg_match('//u', $c->value)) {
if (Stub::TYPE_REF === $c->type && !$c->class && \is_string($c->value) && !preg_match('//u', $c->value)) {
$stub->type = Stub::TYPE_STRING;
$stub->class = Stub::STRING_BINARY;
}
@@ -49,7 +49,7 @@ class StubCaster
public static function cutInternals($obj, array $a, Stub $stub, $isNested)
{
if ($isNested) {
$stub->cut += count($a);
$stub->cut += \count($a);
return array();
}

View File

@@ -166,7 +166,7 @@ abstract class AbstractCloner implements ClonerInterface
public function addCasters(array $casters)
{
foreach ($casters as $type => $callback) {
$this->casters[strtolower($type)][] = is_string($callback) && false !== strpos($callback, '::') ? explode('::', $callback, 2) : $callback;
$this->casters[strtolower($type)][] = \is_string($callback) && false !== strpos($callback, '::') ? explode('::', $callback, 2) : $callback;
}
}
@@ -218,7 +218,7 @@ abstract class AbstractCloner implements ClonerInterface
}
if ($this->prevErrorHandler) {
return call_user_func($this->prevErrorHandler, $type, $msg, $file, $line, $context);
return \call_user_func($this->prevErrorHandler, $type, $msg, $file, $line, $context);
}
return false;

View File

@@ -44,7 +44,7 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
$item = $item->value;
}
if (!$item instanceof Stub) {
return gettype($item);
return \gettype($item);
}
if (Stub::TYPE_STRING === $item->type) {
return 'string';
@@ -106,13 +106,13 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
public function count()
{
return count($this->getValue());
return \count($this->getValue());
}
public function getIterator()
{
if (!is_array($value = $this->getValue())) {
throw new \LogicException(sprintf('%s object holds non-iterable type "%s".', self::class, gettype($value)));
if (!\is_array($value = $this->getValue())) {
throw new \LogicException(sprintf('%s object holds non-iterable type "%s".', self::class, \gettype($value)));
}
foreach ($value as $k => $v) {
@@ -158,11 +158,11 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
{
$value = $this->getValue();
if (!is_array($value)) {
if (!\is_array($value)) {
return (string) $value;
}
return sprintf('%s (count=%d)', $this->getType(), count($value));
return sprintf('%s (count=%d)', $this->getType(), \count($value));
}
/**
@@ -300,7 +300,7 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
$cursor->hardRefCount = $item->refCount;
}
$cursor->attr = $item->attr;
$type = $item->class ?: gettype($item->value);
$type = $item->class ?: \gettype($item->value);
$item = $this->getStub($item->value);
}
if ($item instanceof Stub) {
@@ -322,7 +322,7 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
if ($cursor->stop) {
if ($cut >= 0) {
$cut += count($children);
$cut += \count($children);
}
$children = array();
}
@@ -351,7 +351,7 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
$cut = $this->dumpChildren($dumper, $cursor, $refs, $children, $cut, $item->type, null !== $item->class);
}
} elseif ($children && 0 <= $cut) {
$cut += count($children);
$cut += \count($children);
}
$cursor->skipChildren = false;
$dumper->leaveHash($cursor, $item->type, $item->class, $withChildren, $cut);
@@ -389,7 +389,7 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
++$cursor->depth;
$cursor->hashType = $hashType;
$cursor->hashIndex = 0;
$cursor->hashLength = count($children);
$cursor->hashLength = \count($children);
$cursor->hashCut = $hashCut;
foreach ($children as $key => $child) {
$cursor->hashKeyIsBinary = isset($key[0]) && !preg_match('//u', $key);

View File

@@ -49,7 +49,7 @@ abstract class AbstractDumper implements DataDumperInterface, DumperInterface
$this->decimalPoint = localeconv();
$this->decimalPoint = $this->decimalPoint['decimal_point'];
$this->setOutput($output ?: static::$defaultOutput);
if (!$output && is_string(static::$defaultOutput)) {
if (!$output && \is_string(static::$defaultOutput)) {
static::$defaultOutput = $this->outputStream;
}
}
@@ -65,11 +65,11 @@ abstract class AbstractDumper implements DataDumperInterface, DumperInterface
{
$prev = null !== $this->outputStream ? $this->outputStream : $this->lineDumper;
if (is_callable($output)) {
if (\is_callable($output)) {
$this->outputStream = null;
$this->lineDumper = $output;
} else {
if (is_string($output)) {
if (\is_string($output)) {
$output = fopen($output, 'wb');
}
$this->outputStream = $output;
@@ -195,7 +195,7 @@ abstract class AbstractDumper implements DataDumperInterface, DumperInterface
return $s;
}
if (!function_exists('iconv')) {
if (!\function_exists('iconv')) {
throw new \RuntimeException('Unable to convert a non-UTF-8 string to UTF-8: required function iconv() does not exist. You should install ext-iconv or symfony/polyfill-iconv.');
}

View File

@@ -62,7 +62,7 @@ class CliDumper extends AbstractDumper
{
parent::__construct($output, $charset, $flags);
if ('\\' === DIRECTORY_SEPARATOR && !$this->isWindowsTrueColor()) {
if ('\\' === \DIRECTORY_SEPARATOR && !$this->isWindowsTrueColor()) {
// Use only the base 16 xterm colors when using ANSICON or standard Windows 10 CLI
$this->setStyles(array(
'default' => '31',
@@ -186,7 +186,7 @@ class CliDumper extends AbstractDumper
unset($str[1]);
$str[0] .= "\n";
}
$m = count($str) - 1;
$m = \count($str) - 1;
$i = $lineCut = 0;
if (self::DUMP_STRING_LENGTH & $this->flags) {
@@ -339,7 +339,7 @@ class CliDumper extends AbstractDumper
$style = 'index';
// no break
case Cursor::HASH_ASSOC:
if (is_int($key)) {
if (\is_int($key)) {
$this->line .= $this->style($style, $key).' => ';
} else {
$this->line .= $bin.'"'.$this->style($style, $key).'" => ';
@@ -417,8 +417,8 @@ class CliDumper extends AbstractDumper
if (isset($attr['ellipsis'], $attr['ellipsis-type'])) {
$prefix = substr($value, 0, -$attr['ellipsis']);
if ('cli' === PHP_SAPI && 'path' === $attr['ellipsis-type'] && isset($_SERVER[$pwd = '\\' === DIRECTORY_SEPARATOR ? 'CD' : 'PWD']) && 0 === strpos($prefix, $_SERVER[$pwd])) {
$prefix = '.'.substr($prefix, strlen($_SERVER[$pwd]));
if ('cli' === \PHP_SAPI && 'path' === $attr['ellipsis-type'] && isset($_SERVER[$pwd = '\\' === \DIRECTORY_SEPARATOR ? 'CD' : 'PWD']) && 0 === strpos($prefix, $_SERVER[$pwd])) {
$prefix = '.'.substr($prefix, \strlen($_SERVER[$pwd]));
}
if (!empty($attr['ellipsis-tail'])) {
$prefix .= substr($value, -$attr['ellipsis'], $attr['ellipsis-tail']);
@@ -439,7 +439,7 @@ class CliDumper extends AbstractDumper
$s = $startCchr;
$c = $c[$i = 0];
do {
$s .= isset($map[$c[$i]]) ? $map[$c[$i]] : sprintf('\x%02X', ord($c[$i]));
$s .= isset($map[$c[$i]]) ? $map[$c[$i]] : sprintf('\x%02X', \ord($c[$i]));
} while (isset($c[++$i]));
return $s.$endCchr;
@@ -447,12 +447,12 @@ class CliDumper extends AbstractDumper
if ($this->colors) {
if ($cchrCount && "\033" === $value[0]) {
$value = substr($value, strlen($startCchr));
$value = substr($value, \strlen($startCchr));
} else {
$value = "\033[{$style}m".$value;
}
if ($cchrCount && $endCchr === substr($value, -strlen($endCchr))) {
$value = substr($value, 0, -strlen($endCchr));
if ($cchrCount && $endCchr === substr($value, -\strlen($endCchr))) {
$value = substr($value, 0, -\strlen($endCchr));
} else {
$value .= "\033[{$this->styles['default']}m";
}
@@ -474,7 +474,7 @@ class CliDumper extends AbstractDumper
}
if (isset($_SERVER['argv'][1])) {
$colors = $_SERVER['argv'];
$i = count($colors);
$i = \count($colors);
while (--$i > 0) {
if (isset($colors[$i][5])) {
switch ($colors[$i]) {
@@ -537,23 +537,27 @@ class CliDumper extends AbstractDumper
*/
private function hasColorSupport($stream)
{
if (!is_resource($stream) || 'stream' !== get_resource_type($stream)) {
if (!\is_resource($stream) || 'stream' !== get_resource_type($stream)) {
return false;
}
if (DIRECTORY_SEPARATOR === '\\') {
return (function_exists('sapi_windows_vt100_support')
if ('Hyper' === getenv('TERM_PROGRAM')) {
return true;
}
if (\DIRECTORY_SEPARATOR === '\\') {
return (\function_exists('sapi_windows_vt100_support')
&& @sapi_windows_vt100_support($stream))
|| false !== getenv('ANSICON')
|| 'ON' === getenv('ConEmuANSI')
|| 'xterm' === getenv('TERM');
}
if (function_exists('stream_isatty')) {
if (\function_exists('stream_isatty')) {
return @stream_isatty($stream);
}
if (function_exists('posix_isatty')) {
if (\function_exists('posix_isatty')) {
return @posix_isatty($stream);
}
@@ -575,9 +579,10 @@ class CliDumper extends AbstractDumper
{
$result = 183 <= getenv('ANSICON_VER')
|| 'ON' === getenv('ConEmuANSI')
|| 'xterm' === getenv('TERM');
|| 'xterm' === getenv('TERM')
|| 'Hyper' === getenv('TERM_PROGRAM');
if (!$result && PHP_VERSION_ID >= 70200) {
if (!$result && \PHP_VERSION_ID >= 70200) {
$version = sprintf(
'%s.%s.%s',
PHP_WINDOWS_VERSION_MAJOR,

View File

@@ -20,7 +20,7 @@ final class CliContextProvider implements ContextProviderInterface
{
public function getContext(): ?array
{
if ('cli' !== PHP_SAPI) {
if ('cli' !== \PHP_SAPI) {
return null;
}

View File

@@ -74,7 +74,7 @@ final class SourceContextProvider implements ContextProviderInterface
$src = explode("\n", $src);
$fileExcerpt = array();
for ($i = max($line - 3, 1), $max = min($line + 3, count($src)); $i <= $max; ++$i) {
for ($i = max($line - 3, 1), $max = min($line + 3, \count($src)); $i <= $max; ++$i) {
$fileExcerpt[] = '<li'.($i === $line ? ' class="selected"' : '').'><code>'.$this->htmlEncode($src[$i - 1]).'</code></li>';
}
@@ -99,7 +99,7 @@ final class SourceContextProvider implements ContextProviderInterface
if (null !== $this->projectDir) {
$context['project_dir'] = $this->projectDir;
if (0 === strpos($file, $this->projectDir)) {
$context['file_relative'] = ltrim(substr($file, strlen($this->projectDir)), DIRECTORY_SEPARATOR);
$context['file_relative'] = ltrim(substr($file, \strlen($this->projectDir)), \DIRECTORY_SEPARATOR);
}
}

View File

@@ -826,10 +826,10 @@ EOHTML
}
$label = esc(substr($value, -$attr['ellipsis']));
$style = str_replace(' title="', " title=\"$v\n", $style);
$v = sprintf('<span class=%s>%s</span>', $class, substr($v, 0, -strlen($label)));
$v = sprintf('<span class=%s>%s</span>', $class, substr($v, 0, -\strlen($label)));
if (!empty($attr['ellipsis-tail'])) {
$tail = strlen(esc(substr($value, -$attr['ellipsis'], $attr['ellipsis-tail'])));
$tail = \strlen(esc(substr($value, -$attr['ellipsis'], $attr['ellipsis-tail'])));
$v .= sprintf('<span class=sf-dump-ellipsis>%s</span>%s', substr($label, 0, $tail), substr($label, $tail));
} else {
$v .= $label;
@@ -840,7 +840,7 @@ EOHTML
$s = '<span class=sf-dump-default>';
$c = $c[$i = 0];
do {
$s .= isset($map[$c[$i]]) ? $map[$c[$i]] : sprintf('\x%02X', ord($c[$i]));
$s .= isset($map[$c[$i]]) ? $map[$c[$i]] : sprintf('\x%02X', \ord($c[$i]));
} while (isset($c[++$i]));
return $s.'</span>';
@@ -895,7 +895,7 @@ EOHTML
$options = $this->extraDisplayOptions + $this->displayOptions;
if ($fmt = $options['fileLinkFormat']) {
return is_string($fmt) ? strtr($fmt, array('%f' => $file, '%l' => $line)) : $fmt->format($file, $line);
return \is_string($fmt) ? strtr($fmt, array('%f' => $file, '%l' => $line)) : $fmt->format($file, $line);
}
return false;

View File

@@ -21,6 +21,6 @@ class ThrowingCasterException extends \Exception
*/
public function __construct(\Exception $prev)
{
parent::__construct('Unexpected '.get_class($prev).' thrown from a caster: '.$prev->getMessage(), 0, $prev);
parent::__construct('Unexpected '.\get_class($prev).' thrown from a caster: '.$prev->getMessage(), 0, $prev);
}
}

View File

@@ -102,7 +102,7 @@ pre.sf-dump {
margin-bottom: 0;
}
.hidden {
display: none; !important
display: none !important;
}
.dumped-tag > .sf-dump {
display: inline-block;

View File

@@ -63,7 +63,7 @@ class DumpServer
continue;
}
if (!is_array($payload) || count($payload) < 2 || !$payload[0] instanceof Data || !is_array($payload[1])) {
if (!\is_array($payload) || \count($payload) < 2 || !$payload[0] instanceof Data || !\is_array($payload[1])) {
if ($this->logger) {
$this->logger->warning('Invalid payload from {clientId} client. Expected an array of two elements (Data $data, array $context)', array('clientId' => $clientId));
}

View File

@@ -48,7 +48,7 @@ trait VarDumperTestTrait
private function prepareExpectation($expected, $filter)
{
if (!is_string($expected)) {
if (!\is_string($expected)) {
$expected = $this->getDump($expected, null, $filter);
}

View File

@@ -94,7 +94,7 @@ EODUMP;
*/
public function testDumpInterval($intervalSpec, $ms, $invert, $expected)
{
if ($ms && PHP_VERSION_ID >= 70200 && version_compare(PHP_VERSION, '7.2.0rc3', '<=')) {
if ($ms && \PHP_VERSION_ID >= 70200 && version_compare(PHP_VERSION, '7.2.0rc3', '<=')) {
$this->markTestSkipped('Skipped on 7.2 before rc4 because of php bug #75354.');
}
@@ -114,7 +114,7 @@ EODUMP;
*/
public function testDumpIntervalExcludingVerbosity($intervalSpec, $ms, $invert, $expected)
{
if ($ms && PHP_VERSION_ID >= 70200 && version_compare(PHP_VERSION, '7.2.0rc3', '<=')) {
if ($ms && \PHP_VERSION_ID >= 70200 && version_compare(PHP_VERSION, '7.2.0rc3', '<=')) {
$this->markTestSkipped('Skipped on 7.2 before rc4 because of php bug #75354.');
}
@@ -134,7 +134,7 @@ EODUMP;
*/
public function testCastInterval($intervalSpec, $ms, $invert, $xInterval, $xSeconds)
{
if ($ms && PHP_VERSION_ID >= 70200 && version_compare(PHP_VERSION, '7.2.0rc3', '<=')) {
if ($ms && \PHP_VERSION_ID >= 70200 && version_compare(PHP_VERSION, '7.2.0rc3', '<=')) {
$this->markTestSkipped('Skipped on 7.2 before rc4 because of php bug #75354.');
}
@@ -272,7 +272,7 @@ EODUMP;
public function provideTimeZones()
{
$xRegion = extension_loaded('intl') ? '%s' : '';
$xRegion = \extension_loaded('intl') ? '%s' : '';
return array(
// type 1 (UTC offset)
@@ -302,7 +302,7 @@ EODUMP;
*/
public function testDumpPeriod($start, $interval, $end, $options, $expected)
{
$p = new \DatePeriod(new \DateTime($start), new \DateInterval($interval), is_int($end) ? $end : new \DateTime($end), $options);
$p = new \DatePeriod(new \DateTime($start), new \DateInterval($interval), \is_int($end) ? $end : new \DateTime($end), $options);
$xDump = <<<EODUMP
DatePeriod {
@@ -318,7 +318,7 @@ EODUMP;
*/
public function testCastPeriod($start, $interval, $end, $options, $xPeriod, $xDates)
{
$p = new \DatePeriod(new \DateTime($start), new \DateInterval($interval), is_int($end) ? $end : new \DateTime($end), $options);
$p = new \DatePeriod(new \DateTime($start), new \DateInterval($interval), \is_int($end) ? $end : new \DateTime($end), $options);
$stub = new Stub();
$cast = DateCaster::castPeriod($p, array(), $stub, false, 0);

View File

@@ -164,16 +164,16 @@ EODUMP;
*/
public function testFrameWithTwig()
{
require_once dirname(__DIR__).'/Fixtures/Twig.php';
require_once \dirname(__DIR__).'/Fixtures/Twig.php';
$f = array(
new FrameStub(array(
'file' => dirname(__DIR__).'/Fixtures/Twig.php',
'file' => \dirname(__DIR__).'/Fixtures/Twig.php',
'line' => 20,
'class' => '__TwigTemplate_VarDumperFixture_u75a09',
)),
new FrameStub(array(
'file' => dirname(__DIR__).'/Fixtures/Twig.php',
'file' => \dirname(__DIR__).'/Fixtures/Twig.php',
'line' => 21,
'class' => '__TwigTemplate_VarDumperFixture_u75a09',
'object' => new \__TwigTemplate_VarDumperFixture_u75a09(null, __FILE__),

View File

@@ -154,7 +154,7 @@ EOTXT
public function testGenerator()
{
if (extension_loaded('xdebug')) {
if (\extension_loaded('xdebug')) {
$this->markTestSkipped('xdebug is active');
}

View File

@@ -26,14 +26,14 @@ class DataTest extends TestCase
$clonedValues = array();
$this->assertInstanceOf(Data::class, $data);
$this->assertCount(count($values), $data);
$this->assertCount(\count($values), $data);
$this->assertFalse(isset($data->{0}));
$this->assertFalse(isset($data[0]));
foreach ($data as $k => $v) {
$this->assertTrue(isset($data->{$k}));
$this->assertTrue(isset($data[$k]));
$this->assertSame(gettype($values[$k]), $data->seek($k)->getType());
$this->assertSame(\gettype($values[$k]), $data->seek($k)->getType());
$this->assertSame($values[$k], $data->seek($k)->getValue());
$this->assertSame($values[$k], $data->{$k});
$this->assertSame($values[$k], $data[$k]);

View File

@@ -29,13 +29,13 @@ class VarDumper
{
if (null === self::$handler) {
$cloner = new VarCloner();
$dumper = \in_array(PHP_SAPI, array('cli', 'phpdbg'), true) ? new CliDumper() : new HtmlDumper();
$dumper = \in_array(\PHP_SAPI, array('cli', 'phpdbg'), true) ? new CliDumper() : new HtmlDumper();
self::$handler = function ($var) use ($cloner, $dumper) {
$dumper->dump($cloner->cloneVar($var));
};
}
return call_user_func(self::$handler, $var);
return \call_user_func(self::$handler, $var);
}
public static function setHandler(callable $callable = null)