This commit is contained in:
2026-01-06 10:02:25 +01:00
parent f685c2490a
commit b52d3a11be
111 changed files with 12830 additions and 76 deletions

View File

@@ -34,7 +34,7 @@ class CachingIterator extends \CachingIterator implements \Countable
public function __construct(iterable|\stdClass $iterable)
{
$iterable = $iterable instanceof \stdClass
? new \ArrayIterator($iterable)
? new \ArrayIterator((array) $iterable)
: Nette\Utils\Iterables::toIterator($iterable);
parent::__construct($iterable, 0);
}

View File

@@ -533,7 +533,7 @@ class Arrays
*/
public static function toKey(mixed $value): int|string
{
return key([$value => null]);
return key(@[$value => null]);
}

View File

@@ -239,8 +239,8 @@ class Image
*/
public static function detectTypeFromFile(string $file, &$width = null, &$height = null): ?int
{
[$width, $height, $type] = @getimagesize($file); // @ - files smaller than 12 bytes causes read error
return isset(self::Formats[$type]) ? $type : null;
[$width, $height, $type] = Helpers::falseToNull(@getimagesize($file)); // @ - files smaller than 12 bytes causes read error
return $type && isset(self::Formats[$type]) ? $type : null;
}
@@ -250,8 +250,8 @@ class Image
*/
public static function detectTypeFromString(string $s, &$width = null, &$height = null): ?int
{
[$width, $height, $type] = @getimagesizefromstring($s); // @ - strings smaller than 12 bytes causes read error
return isset(self::Formats[$type]) ? $type : null;
[$width, $height, $type] = Helpers::falseToNull(@getimagesizefromstring($s)); // @ - strings smaller than 12 bytes causes read error
return $type && isset(self::Formats[$type]) ? $type : null;
}