Update coding style to include PSR-12, among other options

This also includes heavy use of slevomat/coding-standard to apply
various checks to the code, based on maintainer (me) preference.
This commit is contained in:
Ben Ramsey
2019-12-17 16:50:38 -06:00
parent e2a56d62e6
commit 0d7b8c2b7a
89 changed files with 1717 additions and 1444 deletions
+10 -10
View File
@@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Ramsey\Uuid\Test\Generator;
use AspectMock\Test as AspectMock;
@@ -10,26 +12,25 @@ use Ramsey\Uuid\Test\TestCase;
class RandomBytesGeneratorTest extends TestCase
{
/**
* @return array[]
* @phpcsSuppress SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification
*/
public function lengthAndHexDataProvider(): array
{
return [
[6, '4f17dd046fb8'],
[10, '4d25f6fe5327cb04267a'],
[12, '1ea89f83bd49cacfdf119e24']
[12, '1ea89f83bd49cacfdf119e24'],
];
}
/**
* @throws Exception
*
* @dataProvider lengthAndHexDataProvider
* @runInSeparateProcess
* @preserveGlobalState disabled
* @param int $length
* @param string $hex
* @throws Exception
*/
public function testGenerateUsesOpenSsl($length, $hex): void
public function testGenerateUsesOpenSsl(int $length, string $hex): void
{
$bytes = hex2bin($hex);
$openSsl = AspectMock::func('Ramsey\Uuid\Generator', 'random_bytes', $bytes);
@@ -40,14 +41,13 @@ class RandomBytesGeneratorTest extends TestCase
}
/**
* @throws Exception
*
* @dataProvider lengthAndHexDataProvider
* @runInSeparateProcess
* @preserveGlobalState disabled
* @param int $length
* @param string $hex
* @throws Exception
*/
public function testGenerateReturnsRandomBytes($length, $hex): void
public function testGenerateReturnsRandomBytes(int $length, string $hex): void
{
$bytes = hex2bin($hex);
AspectMock::func('Ramsey\Uuid\Generator', 'random_bytes', $bytes);