chore: adjusts coding style

This commit is contained in:
Nuno Maduro
2024-01-11 11:26:48 +00:00
parent b143ed7aac
commit 5aa13b8e97
12 changed files with 23 additions and 23 deletions

View File

@ -31,8 +31,8 @@ jobs:
- name: Install Dependencies
run: composer update --prefer-stable --no-interaction --no-progress --ansi
- name: Type Check
run: composer test:type:check
# - name: Type Check
# run: composer test:type:check
- name: Type Coverage
run: composer test:type:coverage

View File

@ -86,7 +86,7 @@ final class DefaultResultCache implements ResultCache
*/
private array $times = [];
public function __construct(?string $filepath = null)
public function __construct(string $filepath = null)
{
if ($filepath !== null && is_dir($filepath)) {
$filepath .= DIRECTORY_SEPARATOR.self::DEFAULT_RESULT_CACHE_FILENAME;

View File

@ -190,7 +190,7 @@ final class Expectation
*
* @return EachExpectation<TValue>
*/
public function each(?callable $callback = null): EachExpectation
public function each(callable $callback = null): EachExpectation
{
if (! is_iterable($this->value)) {
throw new BadMethodCallException('Expectation value is not iterable.');

View File

@ -55,7 +55,7 @@ if (! function_exists('beforeEach')) {
*
* @return HigherOrderTapProxy<Expectable|TestCall|TestCase>|Expectable|TestCall|TestCase|mixed
*/
function beforeEach(?Closure $closure = null): BeforeEachCall
function beforeEach(Closure $closure = null): BeforeEachCall
{
$filename = Backtrace::file();
@ -116,7 +116,7 @@ if (! function_exists('test')) {
*
* @return Expectable|TestCall|TestCase|mixed
*/
function test(?string $description = null, ?Closure $closure = null): HigherOrderTapProxy|TestCall
function test(string $description = null, Closure $closure = null): HigherOrderTapProxy|TestCall
{
if ($description === null && TestSuite::getInstance()->test instanceof \PHPUnit\Framework\TestCase) {
return new HigherOrderTapProxy(TestSuite::getInstance()->test);
@ -136,7 +136,7 @@ if (! function_exists('it')) {
*
* @return Expectable|TestCall|TestCase|mixed
*/
function it(string $description, ?Closure $closure = null): TestCall
function it(string $description, Closure $closure = null): TestCall
{
$description = sprintf('it %s', $description);
@ -171,7 +171,7 @@ if (! function_exists('afterEach')) {
*
* @return Expectable|HigherOrderTapProxy<Expectable|TestCall|TestCase>|TestCall|mixed
*/
function afterEach(?Closure $closure = null): AfterEachCall
function afterEach(Closure $closure = null): AfterEachCall
{
$filename = Backtrace::file();

View File

@ -106,7 +106,7 @@ final class ServiceMessage
]);
}
public static function testIgnored(string $name, string $message, ?string $details = null): self
public static function testIgnored(string $name, string $message, string $details = null): self
{
return new self('testIgnored', [
'name' => $name,

View File

@ -920,7 +920,7 @@ final class Expectation
* @param (Closure(Throwable): mixed)|string $exception
* @return self<TValue>
*/
public function toThrow(callable|string|Throwable $exception, ?string $exceptionMessage = null, string $message = ''): self
public function toThrow(callable|string|Throwable $exception, string $exceptionMessage = null, string $message = ''): self
{
$callback = NullClosure::create();

View File

@ -35,7 +35,7 @@ final class AfterEachCall
public function __construct(
private readonly TestSuite $testSuite,
private readonly string $filename,
?Closure $closure = null
Closure $closure = null
) {
$this->closure = $closure instanceof Closure ? $closure : NullClosure::create();

View File

@ -40,7 +40,7 @@ final class BeforeEachCall
public function __construct(
public readonly TestSuite $testSuite,
private readonly string $filename,
?Closure $closure = null
Closure $closure = null
) {
$this->closure = $closure instanceof Closure ? $closure : NullClosure::create();

View File

@ -51,8 +51,8 @@ final class TestCall
public function __construct(
private readonly TestSuite $testSuite,
private readonly string $filename,
?string $description = null,
?Closure $closure = null
string $description = null,
Closure $closure = null
) {
$this->testCaseMethod = new TestCaseMethodFactory($filename, $description, $closure);
@ -66,7 +66,7 @@ final class TestCall
/**
* Asserts that the test fails with the given message.
*/
public function fails(?string $message = null): self
public function fails(string $message = null): self
{
return $this->throws(AssertionFailedError::class, $message);
}
@ -74,7 +74,7 @@ final class TestCall
/**
* Asserts that the test throws the given `$exceptionClass` when called.
*/
public function throws(string|int $exception, ?string $exceptionMessage = null, ?int $exceptionCode = null): self
public function throws(string|int $exception, string $exceptionMessage = null, int $exceptionCode = null): self
{
if (is_int($exception)) {
$exceptionCode = $exception;
@ -106,7 +106,7 @@ final class TestCall
*
* @param (callable(): bool)|bool $condition
*/
public function throwsIf(callable|bool $condition, string|int $exception, ?string $exceptionMessage = null, ?int $exceptionCode = null): self
public function throwsIf(callable|bool $condition, string|int $exception, string $exceptionMessage = null, int $exceptionCode = null): self
{
$condition = is_callable($condition)
? $condition
@ -124,7 +124,7 @@ final class TestCall
*
* @param (callable(): bool)|bool $condition
*/
public function throwsUnless(callable|bool $condition, string|int $exception, ?string $exceptionMessage = null, ?int $exceptionCode = null): self
public function throwsUnless(callable|bool $condition, string|int $exception, string $exceptionMessage = null, int $exceptionCode = null): self
{
$condition = is_callable($condition)
? $condition
@ -401,7 +401,7 @@ final class TestCall
*
* @param array<int, mixed>|null $arguments
*/
private function addChain(string $file, int $line, string $name, ?array $arguments = null): self
private function addChain(string $file, int $line, string $name, array $arguments = null): self
{
$exporter = Exporter::default();

View File

@ -45,7 +45,7 @@ final class Environment implements HandlesArguments
/**
* Gets the environment name.
*/
public static function name(?string $name = null): string
public static function name(string $name = null): string
{
if (is_string($name)) {
self::$name = $name;

View File

@ -41,7 +41,7 @@ final class Exporter
*
* @param array<int|string, mixed> $data
*/
public function shortenedRecursiveExport(array &$data, ?Context $context = null): string
public function shortenedRecursiveExport(array &$data, Context $context = null): string
{
$result = [];
$array = $data;

View File

@ -87,8 +87,8 @@ final class TestSuite
* Returns the current instance of the test suite.
*/
public static function getInstance(
?string $rootPath = null,
?string $testPath = null,
string $rootPath = null,
string $testPath = null,
): TestSuite {
if (is_string($rootPath) && is_string($testPath)) {
self::$instance = new TestSuite($rootPath, $testPath);