static analysis fixes

This commit is contained in:
Dennis Eichhorn 2019-06-06 21:43:45 +02:00
parent 44a003b787
commit 93a972eb55
5 changed files with 12 additions and 14 deletions

View File

@ -83,16 +83,9 @@ class DataMapperAbstract implements DataMapperInterface
protected static $columns = [];
/**
* Relations.
*
* Relation is defined in a relation table
*
* @var string[]
* @since 1.0.0
*/ /**
* Has many relation.
*
* @var array<string, array<string, null|string>>
* @var array<string, array>
* @since 1.0.0
*/
protected static $hasMany = [];
@ -102,7 +95,7 @@ class DataMapperAbstract implements DataMapperInterface
*
* Relation is defined in current mapper
*
* @var string[]
* @var array<string, array>
* @since 1.0.0
*/
protected static $ownsOne = [];

View File

@ -62,7 +62,7 @@ final class Prime
*/
public static function mersenne(int $p) : int
{
return 2 ** $p - 1;
return (int) (2 ** $p) - 1;
}
/**
@ -135,6 +135,10 @@ final class Prime
$range = \range(2, $n);
$primes = \array_combine($range, $range);
if ($primes === false) {
return [];
}
while ($number * $number < $n) {
for ($i = $number; $i <= $n; $i += $number) {
if ($i == $number) {

View File

@ -30,7 +30,7 @@ final class Rest
*
* @param Request $request Request
*
* @return Request Returns the request result
* @return Response Returns the request result
*
* @throws \Exception this exception is thrown if an internal curl_init error occurs
*
@ -104,10 +104,11 @@ final class Rest
\curl_setopt($curl, \CURLOPT_RETURNTRANSFER, 1);
$result = \curl_exec($curl);
$len = \strlen($cHeaderString);
\curl_close($curl);
$response->set('', \substr($result, \strlen($cHeaderString)));
$response->set('', \substr(\is_bool($result) ? '' : $result, $len === false ? 0 : $len));
return $response;
}

View File

@ -48,7 +48,7 @@ final class ModuleManager
*
* This is important to inform other moduels what kind of information they can receive from other modules.
*
* @var \phpOMS\Module\ModuleAbstract[]
* @var array<string, array<int, string>>
* @since 1.0.0
*/
private $providing = [];

View File

@ -45,7 +45,7 @@ final class CreditCard extends ValidatorAbstract
// Loop through each digit and do the maths
$total = 0;
for ($i = 0; $i < $numberLength; ++$i) {
$digit = $value[$i];
$digit = (int) $value[$i];
// Multiply alternate digits by two
if ($i % 2 == $parity) {
$digit *= 2;