Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dependencies update #198

Merged
merged 1 commit into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ mu: vendor ## Mutation tests
.PHONY: tests
tests: vendor ## Run all tests
vendor/bin/phpunit --color
yarn test

.PHONY: cc
cc: vendor ## Show test coverage rates (HTML)
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@
},
"require-dev": {
"ekino/phpstan-banned-code": "^1.0",
"infection/infection": "^0.26.20",
"infection/infection": "^0.27",
"php-parallel-lint/php-parallel-lint": "^1.3",
"phpstan/phpstan": "^1.0",
"phpstan/phpstan-deprecation-rules": "^1.0",
"phpstan/phpstan-phpunit": "^1.0",
"phpstan/phpstan-strict-rules": "^1.0",
"phpunit/phpunit": "^10.1",
"qossmic/deptrac-shim": "^1.0",
"rector/rector": "^0.16",
"symplify/easy-coding-standard": "^11.0"
"rector/rector": "^0.18",
"symplify/easy-coding-standard": "^12.0"
},
"autoload": {
"psr-4": { "OTPHP\\": "src/" }
Expand Down
7 changes: 3 additions & 4 deletions ecs.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,12 @@
'import_functions' => true,
]);

$config->services()
->remove(PhpUnitTestClassRequiresCoversFixer::class)
;

$config->parallel();
$config->paths([
__DIR__.'/src',
__DIR__.'/tests',
]);
$config->skip([
PhpUnitTestClassRequiresCoversFixer::class
]);
};
11 changes: 6 additions & 5 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Rector\Core\ValueObject\PhpVersion;
use Rector\Doctrine\Set\DoctrineSetList;
use Rector\Php74\Rector\Property\TypedPropertyRector;
use Rector\PHPUnit\CodeQuality\Rector\Class_\PreferPHPUnitThisCallRector;
use Rector\PHPUnit\Set\PHPUnitLevelSetList;
use Rector\PHPUnit\Set\PHPUnitSetList;
use Rector\Set\ValueObject\LevelSetList;
Expand All @@ -22,20 +23,20 @@
SymfonySetList::SYMFONY_CONSTRUCTOR_INJECTION,
DoctrineSetList::DOCTRINE_CODE_QUALITY,
DoctrineSetList::ANNOTATIONS_TO_ATTRIBUTES,
PHPUnitSetList::PHPUNIT_SPECIFIC_METHOD,
PHPUnitLevelSetList::UP_TO_PHPUNIT_100,
PHPUnitSetList::PHPUNIT_CODE_QUALITY,
PHPUnitSetList::PHPUNIT_EXCEPTION,
PHPUnitSetList::REMOVE_MOCKS,
PHPUnitSetList::PHPUNIT_YIELD_DATA_PROVIDER,
PHPUnitSetList::ANNOTATIONS_TO_ATTRIBUTES,
]);
$config->parallel();
$config->paths([
__DIR__ . '/src',
__DIR__ . '/tests',
]);
$config->skip([
PreferPHPUnitThisCallRector::class,
]);
$config->phpVersion(PhpVersion::PHP_81);
$config->parallel();
$config->importNames();
$config->importShortClasses();

};
4 changes: 2 additions & 2 deletions src/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

namespace OTPHP;

use function assert;
use function count;
use InvalidArgumentException;
use Psr\Clock\ClockInterface;
use Throwable;
use function assert;
use function count;

/**
* This class is used to load OTP object from a provisioning Uri.
Expand All @@ -21,11 +21,11 @@
{
try {
$parsed_url = Url::fromString($uri);
$parsed_url->getScheme() === 'otpauth' || throw new InvalidArgumentException('Invalid scheme.');

Check warning on line 24 in src/Factory.php

View workflow job for this annotation

GitHub Actions / 5️⃣ Mutation Testing

Escaped Mutant for Mutator "LogicalOrNegation": --- Original +++ New @@ @@ { try { $parsed_url = Url::fromString($uri); - $parsed_url->getScheme() === 'otpauth' || throw new InvalidArgumentException('Invalid scheme.'); + !($parsed_url->getScheme() === 'otpauth' || throw new InvalidArgumentException('Invalid scheme.')); } catch (Throwable $throwable) { throw new InvalidArgumentException('Not a valid OTP provisioning URI', $throwable->getCode(), $throwable); }
} catch (Throwable $throwable) {
throw new InvalidArgumentException('Not a valid OTP provisioning URI', $throwable->getCode(), $throwable);
}
if ($clock === null) {

Check warning on line 28 in src/Factory.php

View workflow job for this annotation

GitHub Actions / 5️⃣ Mutation Testing

Escaped Mutant for Mutator "Identical": --- Original +++ New @@ @@ } catch (Throwable $throwable) { throw new InvalidArgumentException('Not a valid OTP provisioning URI', $throwable->getCode(), $throwable); } - if ($clock === null) { + if ($clock !== null) { trigger_deprecation('spomky-labs/otphp', '11.3.0', 'The parameter "$clock" will become mandatory in 12.0.0. Please set a valid PSR Clock implementation instead of "null".'); $clock = new InternalClock(); }
trigger_deprecation(
'spomky-labs/otphp',
'11.3.0',
Expand Down Expand Up @@ -60,15 +60,15 @@
}

if ($otp->getIssuer() !== null) {
$result[0] === $otp->getIssuer() || throw new InvalidArgumentException(

Check warning on line 63 in src/Factory.php

View workflow job for this annotation

GitHub Actions / 5️⃣ Mutation Testing

Escaped Mutant for Mutator "LogicalOrNegation": --- Original +++ New @@ @@ return; } if ($otp->getIssuer() !== null) { - $result[0] === $otp->getIssuer() || throw new InvalidArgumentException('Invalid OTP: invalid issuer in parameter'); + !($result[0] === $otp->getIssuer() || throw new InvalidArgumentException('Invalid OTP: invalid issuer in parameter')); $otp->setIssuerIncludedAsParameter(true); } assert($result[0] !== '');
'Invalid OTP: invalid issuer in parameter'
);
$otp->setIssuerIncludedAsParameter(true);

Check warning on line 66 in src/Factory.php

View workflow job for this annotation

GitHub Actions / 5️⃣ Mutation Testing

Escaped Mutant for Mutator "MethodCallRemoval": --- Original +++ New @@ @@ } if ($otp->getIssuer() !== null) { $result[0] === $otp->getIssuer() || throw new InvalidArgumentException('Invalid OTP: invalid issuer in parameter'); - $otp->setIssuerIncludedAsParameter(true); + } assert($result[0] !== ''); $otp->setIssuer($result[0]);
}

assert($result[0] !== '');

$otp->setIssuer($result[0]);

Check warning on line 71 in src/Factory.php

View workflow job for this annotation

GitHub Actions / 5️⃣ Mutation Testing

Escaped Mutant for Mutator "MethodCallRemoval": --- Original +++ New @@ @@ $otp->setIssuerIncludedAsParameter(true); } assert($result[0] !== ''); - $otp->setIssuer($result[0]); + } private static function createOTP(Url $parsed_url, ClockInterface $clock) : OTPInterface {
}

private static function createOTP(Url $parsed_url, ClockInterface $clock): OTPInterface
Expand Down
8 changes: 4 additions & 4 deletions src/OTP.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

namespace OTPHP;

use function assert;
use function chr;
use function count;
use Exception;
use InvalidArgumentException;
use function is_string;
use ParagonIE\ConstantTime\Base32;
use RuntimeException;
use function assert;
use function chr;
use function count;
use function is_string;
use const STR_PAD_LEFT;

abstract class OTP implements OTPInterface
Expand Down
2 changes: 1 addition & 1 deletion src/ParameterTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

namespace OTPHP;

use InvalidArgumentException;
use function array_key_exists;
use function assert;
use function in_array;
use InvalidArgumentException;
use function is_int;
use function is_string;

Expand Down
4 changes: 2 additions & 2 deletions src/TOTP.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

namespace OTPHP;

use function assert;
use InvalidArgumentException;
use function is_int;
use Psr\Clock\ClockInterface;
use function assert;
use function is_int;

/**
* @see \OTPHP\Test\TOTPTest
Expand Down
2 changes: 1 addition & 1 deletion src/Url.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

namespace OTPHP;

use function array_key_exists;
use InvalidArgumentException;
use function array_key_exists;
use function is_string;

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/TOTPTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace OTPHP\Test;

use function assert;
use DateTimeImmutable;
use InvalidArgumentException;
use OTPHP\InternalClock;
Expand All @@ -16,6 +15,7 @@
use PHPUnit\Framework\TestCase;
use Psr\Clock\ClockInterface;
use RuntimeException;
use function assert;

/**
* @internal
Expand Down
Loading