Mercurial > hg > cmmr2012-drupal-site
diff vendor/symfony/validator/Constraints/FileValidator.php @ 4:a9cd425dd02b
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:11:55 +0000 |
parents | c75dbcec494b |
children |
line wrap: on
line diff
--- a/vendor/symfony/validator/Constraints/FileValidator.php Thu Feb 28 11:14:44 2019 +0000 +++ b/vendor/symfony/validator/Constraints/FileValidator.php Thu Feb 28 13:11:55 2019 +0000 @@ -27,13 +27,13 @@ const KIB_BYTES = 1024; const MIB_BYTES = 1048576; - private static $suffices = array( + private static $suffices = [ 1 => 'bytes', self::KB_BYTES => 'kB', self::MB_BYTES => 'MB', self::KIB_BYTES => 'KiB', self::MIB_BYTES => 'MiB', - ); + ]; /** * {@inheritdoc} @@ -57,7 +57,7 @@ $binaryFormat = $constraint->binaryFormat; } else { $limitInBytes = $iniLimitSize; - $binaryFormat = true; + $binaryFormat = null === $constraint->binaryFormat ? true : $constraint->binaryFormat; } list($sizeAsString, $limitAsString, $suffix) = $this->factorizeSizes(0, $limitInBytes, $binaryFormat); @@ -113,7 +113,7 @@ } } - if (!is_scalar($value) && !$value instanceof FileObject && !(is_object($value) && method_exists($value, '__toString'))) { + if (!is_scalar($value) && !$value instanceof FileObject && !(\is_object($value) && method_exists($value, '__toString'))) { throw new UnexpectedTypeException($value, 'string'); } @@ -196,7 +196,7 @@ private static function moreDecimalsThan($double, $numberOfDecimals) { - return strlen((string) $double) > strlen(round($double, $numberOfDecimals)); + return \strlen((string) $double) > \strlen(round($double, $numberOfDecimals)); } /** @@ -233,6 +233,6 @@ $sizeAsString = (string) round($size / $coef, 2); } - return array($sizeAsString, $limitAsString, self::$suffices[$coef]); + return [$sizeAsString, $limitAsString, self::$suffices[$coef]]; } }