Fixed bitrot issues related to PHP updates.

This commit is contained in:
flash 2023-01-01 18:47:24 +00:00
parent 3bcb7781dd
commit 9bb07806a0
6 changed files with 16 additions and 9 deletions

View file

@ -1 +1 @@
0.2301.11835
0.2301.11846

View file

@ -1,7 +1,7 @@
<?php
// MariaDBBackend.php
// Created: 2021-04-30
// Updated: 2022-02-28
// Updated: 2023-01-01
namespace Index\Data\MariaDB;
@ -107,7 +107,7 @@ class MariaDBBackend implements IDbBackend {
}
if($needsUnix) {
if($unixPath === null)
if(empty($unixPath))
throw new InvalidArgumentException('Unix socket path is missing from DSN.');
$endPoint = new UnixEndPoint($unixPath);
}

View file

@ -1,7 +1,7 @@
<?php
// DateTime.php
// Created: 2021-06-11
// Updated: 2022-02-27
// Updated: 2023-01-01
namespace Index;
@ -641,6 +641,7 @@ class DateTime extends DateTimeImmutable implements JsonSerializable, Stringable
* @param \DateTime $object Mutable object that should be sourced.
* @return DateTime New immutable DateTime representing the same value.
*/
#[\ReturnTypeWillChange]
public static function createFromMutable(\DateTime $object): DateTime {
return self::cast($object);
}

View file

@ -1,7 +1,7 @@
<?php
// Base32Serialiser.php
// Created: 2022-01-13
// Updated: 2022-02-27
// Updated: 2023-01-01
namespace Index\Serialisation;
@ -30,7 +30,7 @@ class Base32Serialiser extends Serialiser {
$bin = str_split($bin, 5);
$last = array_pop($bin);
$bin[] = str_pad($last, 5, '0', STR_PAD_RIGHT);
$bin[] = str_pad((string)$last, 5, '0', STR_PAD_RIGHT);
foreach($bin as $part)
$output .= self::CHARS[bindec($part)];

View file

@ -1,7 +1,7 @@
<?php
// Version.php
// Created: 2021-04-29
// Updated: 2022-02-27
// Updated: 2023-01-01
namespace Index;
@ -234,6 +234,12 @@ class Version implements Stringable, IComparable, IEquatable {
if(!preg_match('#^v?(?P<major>0|[1-9]\d*)\.(?P<minor>0|[1-9]\d*)\.(?P<patch>0|[1-9]\d*)(?:-(?P<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?P<build>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$#', $versionString, $matches))
throw new InvalidArgumentException('$versionString is not a valid version string.');
return new Version($matches['major'], $matches['minor'], $matches['patch'], $matches['prerelease'] ?? '', $matches['build'] ?? '');
return new Version(
(int)$matches['major'],
(int)$matches['minor'],
(int)$matches['patch'],
$matches['prerelease'] ?? '',
$matches['build'] ?? ''
);
}
}

View file

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
pushd .
cd $(dirname "$0")