mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-11 17:58:41 +00:00
Type fixes
This commit is contained in:
parent
3397adacb2
commit
2188c25f01
|
|
@ -241,7 +241,7 @@ class Location implements \JsonSerializable, \Serializable
|
|||
*/
|
||||
public function serialize()
|
||||
{
|
||||
return $this->jsonSerialize();
|
||||
return json_encode($this->jsonSerialize());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -200,7 +200,7 @@ class Money implements \Serializable
|
|||
$left = substr($value, 0, -self::MAX_DECIMALS);
|
||||
$right = substr($value, -self::MAX_DECIMALS);
|
||||
|
||||
return ($decimals > 0) ? number_format($left, 0, $this->decimal, $this->thousands) . $this->decimal . substr($right, 0, $decimals) : (string) $left;
|
||||
return ($decimals > 0) ? number_format((float) $left, 0, $this->decimal, $this->thousands) . $this->decimal . substr($right, 0, $decimals) : (string) $left;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -65,9 +65,11 @@ class Numbers
|
|||
*/
|
||||
public static function isSelfdescribing(int $n) : bool
|
||||
{
|
||||
$n = (string) $n;
|
||||
$split = str_split($n);
|
||||
|
||||
foreach ($split as $place => $value) {
|
||||
if (substr_count($n, $place) != $value) {
|
||||
if (substr_count($n, (string) $place) != $value) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -94,14 +94,14 @@ class Prime
|
|||
for ($i = 0; $i < $k; $i++) {
|
||||
$a = mt_rand(2, $n - 1);
|
||||
|
||||
$x = bcpowmod($a, $d, $n);
|
||||
$x = bcpowmod((string) $a, (string) $d, (string) $n);
|
||||
|
||||
if ($x == 1 || $x == $n - 1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for ($j = 1; $j < $s; $j++) {
|
||||
$x = bcmod(bcmul($x, $x), $n);
|
||||
$x = bcmod(bcmul($x, $x), (string) $n);
|
||||
|
||||
if ($x == 1) {
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ abstract class ResponseAbstract implements MessageInterface, \JsonSerializable
|
|||
*/
|
||||
public function set($key, $response, bool $overwrite = true) /* : void */
|
||||
{
|
||||
$this->response = ArrayUtils::setArray($key, $this->response, $response, ':', $overwrite);
|
||||
$this->response = ArrayUtils::setArray((string) $key, $this->response, $response, ':', $overwrite);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -390,7 +390,7 @@ class Encryption
|
|||
{
|
||||
$pad = ord($value[($len = strlen($value)) - 1]);
|
||||
|
||||
return $this->paddingIsValid($pad, $value) ? substr($value, 0, $len - $pad) : $value;
|
||||
return $this->paddingIsValid((string) $pad, $value) ? substr($value, 0, $len - $pad) : $value;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -408,7 +408,7 @@ class Encryption
|
|||
{
|
||||
$beforePad = strlen($value) - $pad;
|
||||
|
||||
return substr($value, $beforePad) == str_repeat(substr($value, -1), $pad);
|
||||
return substr($value, $beforePad) == str_repeat(substr($value, -1), (int) $pad);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ abstract class FileAbstract implements ContainerInterface
|
|||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $permission = '0000';
|
||||
protected $permission = 0644;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
|
@ -194,6 +194,6 @@ abstract class FileAbstract implements ContainerInterface
|
|||
$this->createdAt->setTimestamp(filemtime($this->path));
|
||||
$this->changedAt->setTimestamp(filectime($this->path));
|
||||
$this->owner = fileowner($this->path);
|
||||
$this->permission = substr(sprintf('%o', fileperms($this->path)), -4);
|
||||
$this->permission = (int) substr(sprintf('%o', fileperms($this->path)), -4);
|
||||
}
|
||||
}
|
||||
|
|
@ -193,7 +193,7 @@ class Http implements UriInterface
|
|||
*/
|
||||
public static function isValid(string $uri) : bool
|
||||
{
|
||||
return filter_var($uri, FILTER_VALIDATE_URL);
|
||||
return (bool) filter_var($uri, FILTER_VALIDATE_URL);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -252,7 +252,7 @@ class MemberParser
|
|||
} elseif (is_string($value)) {
|
||||
return '"' . $value . '"';
|
||||
} elseif (is_scalar($value)) {
|
||||
return $value;
|
||||
return (string) $value;
|
||||
} elseif (is_null($value)) {
|
||||
return 'null';
|
||||
} elseif (is_bool($value)) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user