This commit is contained in:
Fabien Potencier
2019-08-07 20:54:50 +02:00
parent d0c0f7e3b0
commit 336d69c166
4 changed files with 9 additions and 11 deletions
+1 -1
View File
@@ -348,7 +348,7 @@ namespace {
use Twig\Source;
use Twig\Template;
/**
/**
* Cycles over a value.
*
* @param \ArrayAccess|array $values
+7 -7
View File
@@ -54,14 +54,14 @@ final class HtmlExtension extends AbstractExtension
if (!class_exists(MimeTypes::class)) {
throw new \LogicException('The "data_uri" function requires the symfony/mime package to be installed.');
}
$this->mimeTypes = new MimeTypes();
}
try {
$tmp = tempnam(sys_get_temp_dir(), 'mime');
file_put_contents($tmp, $data);
if (null === $mime = $this->mimeTypes->guessMimeType($tmp)) {
$mime = 'text/plain';
}
@@ -93,12 +93,12 @@ function twig_html_classes(...$args): string
{
$classes = [];
foreach ($args as $i => $arg) {
if (is_string($arg)) {
if (\is_string($arg)) {
$classes[] = $arg;
} elseif (is_array($arg)) {
} elseif (\is_array($arg)) {
foreach ($arg as $class => $condition) {
if (!is_string($class)) {
throw new RuntimeError(sprintf('The html_classes function argument %d (key %d) should be a string, got "%s".', $i, $class, gettype($class)));
if (!\is_string($class)) {
throw new RuntimeError(sprintf('The html_classes function argument %d (key %d) should be a string, got "%s".', $i, $class, \gettype($class)));
}
if (!$condition) {
continue;
@@ -106,7 +106,7 @@ function twig_html_classes(...$args): string
$classes[] = $class;
}
} else {
throw new RuntimeError(sprintf('The html_classes function argument %d should be either a string or an array, got "%s".', $i, gettype($arg)));
throw new RuntimeError(sprintf('The html_classes function argument %d should be either a string or an array, got "%s".', $i, \gettype($arg)));
}
}
-1
View File
@@ -14,7 +14,6 @@ namespace Twig\Tests;
use PHPUnit\Framework\TestCase;
use Twig\Environment;
use Twig\Loader\LoaderInterface;
use Twig\Node\MacroNode;
use Twig\Node\Node;
use Twig\Node\SetNode;
use Twig\Node\TextNode;
+1 -2
View File
@@ -11,9 +11,8 @@ namespace Twig\Tests\Profiler\Dumper;
* file that was distributed with this source code.
*/
use Twig\Profiler\Profile;
use PHPUnit\Framework\TestCase;
use Twig\Profiler\Profile;
abstract class AbstractTest extends TestCase
{