Skip to content

Commit

Permalink
Fix: Cast values to expected types
Browse files Browse the repository at this point in the history
  • Loading branch information
localheinz committed Sep 22, 2023
1 parent ff3476f commit 9296c8d
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions test/Calculator/LuhnTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function checkDigitProvider()
public function testComputeCheckDigit($partialNumber, $checkDigit): void
{
self::assertIsString($checkDigit);
self::assertEquals($checkDigit, Luhn::computeCheckDigit($partialNumber));
self::assertEquals($checkDigit, Luhn::computeCheckDigit((string) $partialNumber));
}

public function validatorProvider()
Expand All @@ -59,7 +59,7 @@ public function validatorProvider()
*/
public function testIsValid($number, $isValid): void
{
self::assertEquals($isValid, Luhn::isValid($number));
self::assertEquals($isValid, Luhn::isValid((string) $number));
}

public function testGenerateLuhnNumberWithInvalidPrefix(): void
Expand Down
2 changes: 1 addition & 1 deletion test/Provider/BaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function testRandomFloat(): void

$result = BaseProvider::randomFloat($nbMaxDecimals, $min, $max);

$parts = explode('.', $result);
$parts = explode('.', (string) $result);

self::assertIsFloat($result);
self::assertGreaterThanOrEqual($min, $result);
Expand Down
2 changes: 1 addition & 1 deletion test/Provider/nl_BE/PaymentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ private function validateChecksum($vat): void
self::assertStringStartsWith('0', $numbers);

// Mod97 check on first 8 digits
$checksum = 97 - fmod(substr($numbers, 0, 8), 97);
$checksum = 97 - fmod((float) substr($numbers, 0, 8), 97);
// Make sure checksum is 2 characters long
$checksum = sprintf('%02d', $checksum);

Expand Down
2 changes: 1 addition & 1 deletion test/Provider/ro_RO/PersonTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ protected function isValidMaleCnp($value)
protected function isValidCnp($cnp)
{
if (preg_match(self::TEST_CNP_REGEX, $cnp) !== false) {
$checkNumber = 279146358279;
$checkNumber = '279146358279';

$checksum = 0;

Expand Down

0 comments on commit 9296c8d

Please sign in to comment.