Skip to content

Commit

Permalink
Fix CS
Browse files Browse the repository at this point in the history
  • Loading branch information
cesurapp committed Mar 20, 2024
1 parent b0e200a commit ba45f0e
Show file tree
Hide file tree
Showing 14 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions src/AbstractClass/ApiController.php
Expand Up @@ -122,7 +122,7 @@ protected function isCsrfTokenValid(string $id, ?string $token): bool
*
* @param $message string #TranslationKey to translate the URL for
*/
protected function createNotFoundException(string $message = 'Not Found', \Throwable $previous = null): NotFoundHttpException
protected function createNotFoundException(string $message = 'Not Found', ?\Throwable $previous = null): NotFoundHttpException
{
return new NotFoundHttpException($message, $previous);
}
Expand All @@ -138,7 +138,7 @@ protected function createNotFoundException(string $message = 'Not Found', \Throw
*
* @throws \LogicException If the Security component is not available
*/
protected function createAccessDeniedException(string $message = 'Access Denied.', \Throwable $previous = null): AccessDeniedException
protected function createAccessDeniedException(string $message = 'Access Denied.', ?\Throwable $previous = null): AccessDeniedException
{
return new AccessDeniedException($message, $previous);
}
Expand Down
2 changes: 1 addition & 1 deletion src/AbstractClass/ApiDto.php
Expand Up @@ -76,7 +76,7 @@ final public function validate(bool $throw = true): bool
/**
* Get Validated Data.
*/
final public function validated(string $key = null): mixed
final public function validated(?string $key = null): mixed
{
if (!$this->validated) {
$this->validated = array_diff_key(
Expand Down
2 changes: 1 addition & 1 deletion src/Exception/ResourceNotFoundException.php
Expand Up @@ -13,7 +13,7 @@ class ResourceNotFoundException extends ApiException
public function __construct(
string $message = 'Api Resource Not Found!',
int $code = 424,
ConstraintViolationListInterface|array $errors = null
ConstraintViolationListInterface|array|null $errors = null
) {
parent::__construct($message, $code, $errors);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Response/ApiResourceLocator.php
Expand Up @@ -30,7 +30,7 @@ public function all(): array
return $this->locator->getProvidedServices();
}

public function process(object|array $object, string $resource = null, mixed $optionalData = null): ?array
public function process(object|array $object, ?string $resource = null, mixed $optionalData = null): ?array
{
$res = $this->get($resource);

Expand Down
2 changes: 1 addition & 1 deletion src/Response/ApiResponse.php
Expand Up @@ -154,7 +154,7 @@ public function getHTTPCache(): ?array
/**
* Enable HTTP Proxy Cache.
*/
public function setHTTPCache(int $lifetime = 60, array $tags = null): self
public function setHTTPCache(int $lifetime = 60, ?array $tags = null): self
{
$this->options['httpCache'] = [
'public' => true,
Expand Down
2 changes: 1 addition & 1 deletion src/Response/Traits/FileDownloadTrait.php
Expand Up @@ -24,7 +24,7 @@ public static function downloadFile(
/**
* Download Large File.
*/
public static function downloadFileLarge(string $filePath, string $fileName = null): StreamedResponse
public static function downloadFileLarge(string $filePath, ?string $fileName = null): StreamedResponse
{
$file = new File($filePath);

Expand Down
2 changes: 1 addition & 1 deletion src/Thor/Attribute/ThorResource.php
Expand Up @@ -9,7 +9,7 @@
final class ThorResource
{
// @phpstan-ignore-next-line
public function __construct(protected array $data = [], callable|string $callback = null)
public function __construct(protected array $data = [], callable|string|null $callback = null)
{
}
}
4 changes: 2 additions & 2 deletions src/Thor/Extractor/ThorExtractor.php
Expand Up @@ -33,7 +33,7 @@ public function __construct(
/**
* Render Documentation Template.
*/
public function render(array $data = null): string
public function render(?array $data = null): string
{
// Template Data
if (!$data) {
Expand Down Expand Up @@ -176,7 +176,7 @@ private function routerList(): array
return $list;
}

public static function baseClass(string|object|null $class): string|null
public static function baseClass(string|object|null $class): ?string
{
return $class ? basename(str_replace('\\', '/', is_object($class) ? get_class($class) : $class)) : null;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Thor/Generator/TypeScriptGenerator.php
Expand Up @@ -89,7 +89,7 @@ public function generate(): self
/**
* Compress TS Library to TAR Format.
*/
public function compress(string $path = null): File
public function compress(?string $path = null): File
{
$tmpPath = $path ?? sys_get_temp_dir();

Expand Down
2 changes: 1 addition & 1 deletion src/Thor/Template/typescript/index.ts.php
Expand Up @@ -20,7 +20,7 @@
<?php if (isset($route['routeAttr'])) {
foreach ($route['routeAttr'] as $name => $class) { ?>
<?php if (enum_exists($class)) { ?>
import type { <?php echo ucfirst(\Cesurapp\ApiBundle\Thor\Extractor\ThorExtractor::baseClass($class)); ?> } from './Enum/<?php echo ucfirst(\Cesurapp\ApiBundle\Thor\Extractor\ThorExtractor::baseClass($class)); ?>';
import type { <?php echo ucfirst(Cesurapp\ApiBundle\Thor\Extractor\ThorExtractor::baseClass($class)); ?> } from './Enum/<?php echo ucfirst(Cesurapp\ApiBundle\Thor\Extractor\ThorExtractor::baseClass($class)); ?>';
<?php } ?>
<?php }
} ?>
Expand Down
2 changes: 1 addition & 1 deletion src/Validator/PhoneNumber.php
Expand Up @@ -26,7 +26,7 @@ public function __construct(
public ?int $format = null,
public ?string $message = null,
mixed $options = null,
array $groups = null,
?array $groups = null,
mixed $payload = null
) {
$this->defaultRegion ??= 'ZZ'; // PhoneNumberUtil::UNKNOWN_REGION
Expand Down
2 changes: 1 addition & 1 deletion src/Validator/UniqueEntity.php
Expand Up @@ -14,7 +14,7 @@ public function __construct(
public ?string $editColumn = null,
public string $message = 'This value is already used.',
mixed $options = null,
array $groups = null,
?array $groups = null,
mixed $payload = null
) {
parent::__construct($options, $groups, $payload);
Expand Down
10 changes: 5 additions & 5 deletions tests/Validator/PhoneNumberValidatorTest.php
Expand Up @@ -29,12 +29,12 @@ protected function setUp(): void
* @dataProvider validateProvider
*/
public function testValidate(
string|null $value,
?string $value,
bool $violates,
array|string $type = null,
string $defaultRegion = null,
string $regionPath = null,
int $format = null
array|string|null $type = null,
?string $defaultRegion = null,
?string $regionPath = null,
?int $format = null
): void {
$constraint = new PhoneNumber(types: $type, defaultRegion: $defaultRegion, regionPath: $regionPath, format: $format);

Expand Down
2 changes: 1 addition & 1 deletion tests/Validator/UsernameValidatorTest.php
Expand Up @@ -10,7 +10,7 @@ class UsernameValidatorTest extends KernelTestCase
/**
* @dataProvider validateProvider
*/
public function testValidate(string|null $username, int $exceptedCount = 0): void
public function testValidate(?string $username, int $exceptedCount = 0): void
{
$validator = self::getContainer()->get('validator');
$class = new UsernameDummy();
Expand Down

0 comments on commit ba45f0e

Please sign in to comment.