Skip to content

Commit

Permalink
style: apply automated php-cs-fixer changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Mohammad-Alavi authored and github-actions[bot] committed Feb 5, 2024
1 parent 34192ca commit f5fee4b
Show file tree
Hide file tree
Showing 42 changed files with 47 additions and 47 deletions.
10 changes: 5 additions & 5 deletions src/Abstracts/Exceptions/Exception.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,22 @@ abstract class Exception extends BaseException
protected array $errors = [];

public function __construct(
null|string $message = null,
null|int $code = null,
null|\Throwable $previous = null,
string|null $message = null,
int|null $code = null,
\Throwable|null $previous = null,
) {
// Detect and set the running environment
$this->environment = Config::get('app.env');

parent::__construct($this->prepareMessage($message), $this->prepareStatusCode($code), $previous);
}

private function prepareMessage(null|string $message = null): string
private function prepareMessage(string|null $message = null): string
{
return is_null($message) ? $this->message : $message;
}

private function prepareStatusCode(null|int $code = null): int
private function prepareStatusCode(int|null $code = null): int
{
return is_null($code) ? $this->code : $code;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Abstracts/Repositories/Repository.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ abstract class Repository extends PrettusRepository implements PrettusCacheable
*/
protected int $maxPaginationLimit = 0;

protected null|bool $allowDisablePagination = null;
protected bool|null $allowDisablePagination = null;

/**
* This function relies on strict conventions:
Expand Down
4 changes: 2 additions & 2 deletions src/Abstracts/Requests/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ abstract class Request extends LaravelRequest
/**
* To be used mainly from unit tests.
*/
public static function injectData(array $parameters = [], null|User $user = null, array $cookies = [], array $files = [], array $server = []): static
public static function injectData(array $parameters = [], User|null $user = null, array $cookies = [], array $files = [], array $server = []): static
{
// if user is passed, will be returned when asking for the authenticated user using `\Auth::user()`
if ($user) {
Expand Down Expand Up @@ -111,7 +111,7 @@ public function getUrlParametersArray(): array
* User can set multiple permissions (separated with "|") and if the user has
* any of the permissions, he will be authorized to proceed with this action.
*/
public function hasAccess(null|User $user = null): bool
public function hasAccess(User|null $user = null): bool
{
// if not in parameters, take from the request object {$this}
$user = $user ?: $this->user();
Expand Down
2 changes: 1 addition & 1 deletion src/Foundation/Apiato.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function getClassFullNameFromFile(string $filePathName): string
/**
* Get the class namespace form file path using token.
*/
protected function getClassNamespaceFromFile(string $filePathName): null|string
protected function getClassNamespaceFromFile(string $filePathName): string|null
{
$src = file_get_contents($filePathName);

Expand Down
2 changes: 1 addition & 1 deletion src/Generator/Commands/ActionGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class ActionGenerator extends GeneratorCommand implements ComponentsGenerator
*/
protected string $stubName = 'actions/generic.stub';

public function getUserInputs(): null|array
public function getUserInputs(): array|null
{
$model = $this->checkParameterOrAsk('model', 'Enter the name of the model this action is for.', $this->containerName);
$ui = Str::upper($this->checkParameterOrChoice('ui', 'Which UI is this Action for?', ['API', 'WEB'], 0));
Expand Down
2 changes: 1 addition & 1 deletion src/Generator/Commands/ConfigurationGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class ConfigurationGenerator extends GeneratorCommand implements ComponentsGener
*/
protected string $stubName = 'config.stub';

public function getUserInputs(): null|array
public function getUserInputs(): array|null
{
return [
'path-parameters' => [
Expand Down
2 changes: 1 addition & 1 deletion src/Generator/Commands/ContainerApiGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class ContainerApiGenerator extends GeneratorCommand implements ComponentsGenera
*/
protected string $stubName = 'composer.stub';

public function getUserInputs(): null|array
public function getUserInputs(): array|null
{
$ui = 'api';

Expand Down
2 changes: 1 addition & 1 deletion src/Generator/Commands/ContainerGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class ContainerGenerator extends GeneratorCommand implements ComponentsGenerator
*/
protected string $stubName = 'composer.stub';

public function getUserInputs(): null|array
public function getUserInputs(): array|null
{
$ui = Str::lower($this->checkParameterOrChoice('ui', 'Select the UI for this container', ['API', 'WEB', 'BOTH'], 0));

Expand Down
2 changes: 1 addition & 1 deletion src/Generator/Commands/ContainerWebGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class ContainerWebGenerator extends GeneratorCommand implements ComponentsGenera
*/
protected string $stubName = 'composer.stub';

public function getUserInputs(): null|array
public function getUserInputs(): array|null
{
$ui = 'web';

Expand Down
2 changes: 1 addition & 1 deletion src/Generator/Commands/ControllerGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class ControllerGenerator extends GeneratorCommand implements ComponentsGenerato
*/
protected string $stubName = 'controllers/generic.stub';

public function getUserInputs(): null|array
public function getUserInputs(): array|null
{
$ui = Str::lower($this->checkParameterOrChoice('ui', 'Select the UI for the controller', ['API', 'WEB'], 0));

Expand Down
2 changes: 1 addition & 1 deletion src/Generator/Commands/EventGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class EventGenerator extends GeneratorCommand implements ComponentsGenerator
*/
protected string $stubName = 'events/generic.stub';

public function getUserInputs(): null|array
public function getUserInputs(): array|null
{
$model = $this->checkParameterOrAsk('model', 'Enter the name of the Model to generate this Event for', Str::ucfirst($this->containerName));

Expand Down
2 changes: 1 addition & 1 deletion src/Generator/Commands/EventListenerGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class EventListenerGenerator extends GeneratorCommand implements ComponentsGener
*/
protected string $stubName = 'listeners/listener.stub';

public function getUserInputs(): null|array
public function getUserInputs(): array|null
{
$event = $this->checkParameterOrAsk('event', 'Enter the name of the Event to generate this Listener for');

Expand Down
2 changes: 1 addition & 1 deletion src/Generator/Commands/ExceptionGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class ExceptionGenerator extends GeneratorCommand implements ComponentsGenerator
*/
protected string $stubName = 'exception.stub';

public function getUserInputs(): null|array
public function getUserInputs(): array|null
{
return [
'path-parameters' => [
Expand Down
2 changes: 1 addition & 1 deletion src/Generator/Commands/JobGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class JobGenerator extends GeneratorCommand implements ComponentsGenerator
*/
protected string $stubName = 'job.stub';

public function getUserInputs(): null|array
public function getUserInputs(): array|null
{
return [
'path-parameters' => [
Expand Down
2 changes: 1 addition & 1 deletion src/Generator/Commands/MailGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class MailGenerator extends GeneratorCommand implements ComponentsGenerator
*/
protected string $stubName = 'mail.stub';

public function getUserInputs(): null|array
public function getUserInputs(): array|null
{
$view = $this->checkParameterOrAsk('view', 'Enter the name of the view to be loaded when sending this Mail');

Expand Down
2 changes: 1 addition & 1 deletion src/Generator/Commands/MiddlewareGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class MiddlewareGenerator extends GeneratorCommand implements ComponentsGenerato
*/
protected string $stubName = 'middleware.stub';

public function getUserInputs(): null|array
public function getUserInputs(): array|null
{
return [
'path-parameters' => [
Expand Down
2 changes: 1 addition & 1 deletion src/Generator/Commands/MigrationGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class MigrationGenerator extends GeneratorCommand implements ComponentsGenerator
*/
protected string $stubName = 'migration.stub';

public function getUserInputs(): null|array
public function getUserInputs(): array|null
{
$tableName = Str::lower($this->checkParameterOrAsk('tablename', 'Enter the name of the database table', Str::snake(Pluralizer::plural($this->containerName))));

Expand Down
2 changes: 1 addition & 1 deletion src/Generator/Commands/ModelFactoryGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class ModelFactoryGenerator extends GeneratorCommand implements ComponentsGenera
*/
protected string $stubName = 'factory.stub';

public function getUserInputs(): null|array
public function getUserInputs(): array|null
{
$model = $this->checkParameterOrAsk('model', 'Enter the name of the Model to generate this Factory for');

Expand Down
2 changes: 1 addition & 1 deletion src/Generator/Commands/ModelGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class ModelGenerator extends GeneratorCommand implements ComponentsGenerator
*/
protected string $stubName = 'model.stub';

public function getUserInputs(): null|array
public function getUserInputs(): array|null
{
$repository = $this->checkParameterOrConfirm('repository', 'Do you want to generate the corresponding Repository for this Model?', true);
if ($repository) {
Expand Down
2 changes: 1 addition & 1 deletion src/Generator/Commands/NotificationGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class NotificationGenerator extends GeneratorCommand implements ComponentsGenera
*/
protected string $stubName = 'notification.stub';

public function getUserInputs(): null|array
public function getUserInputs(): array|null
{
return [
'path-parameters' => [
Expand Down
2 changes: 1 addition & 1 deletion src/Generator/Commands/PolicyGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class PolicyGenerator extends GeneratorCommand implements ComponentsGenerator
*/
protected string $stubName = 'policy.stub';

public function getUserInputs(): null|array
public function getUserInputs(): array|null
{
return [
'path-parameters' => [
Expand Down
2 changes: 1 addition & 1 deletion src/Generator/Commands/ReadmeGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class ReadmeGenerator extends GeneratorCommand implements ComponentsGenerator
*/
protected string $stubName = 'readme.stub';

public function getUserInputs(): null|array
public function getUserInputs(): array|null
{
return [
'path-parameters' => [
Expand Down
2 changes: 1 addition & 1 deletion src/Generator/Commands/RepositoryGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class RepositoryGenerator extends GeneratorCommand implements ComponentsGenerato
*/
protected string $stubName = 'repository.stub';

public function getUserInputs(): null|array
public function getUserInputs(): array|null
{
return [
'path-parameters' => [
Expand Down
2 changes: 1 addition & 1 deletion src/Generator/Commands/RequestGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class RequestGenerator extends GeneratorCommand implements ComponentsGenerator
*/
protected string $stubName = 'requests/generic.stub';

public function getUserInputs(): null|array
public function getUserInputs(): array|null
{
$ui = Str::lower($this->checkParameterOrChoice('ui', 'Select the UI for the controller', ['API', 'WEB'], 0));
$stub = $this->option('stub');
Expand Down
2 changes: 1 addition & 1 deletion src/Generator/Commands/RouteGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class RouteGenerator extends GeneratorCommand implements ComponentsGenerator
*/
protected string $stubName = 'routes/generic.stub';

public function getUserInputs(): null|array
public function getUserInputs(): array|null
{
$ui = Str::lower($this->checkParameterOrChoice('ui', 'Select the UI for the controller', ['API', 'WEB'], 0));
$version = $this->checkParameterOrAsk('docversion', 'Enter the endpoint version (integer)', 1);
Expand Down
2 changes: 1 addition & 1 deletion src/Generator/Commands/SeederGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class SeederGenerator extends GeneratorCommand implements ComponentsGenerator
*/
protected string $stubName = 'seeder.stub';

public function getUserInputs(): null|array
public function getUserInputs(): array|null
{
return [
'path-parameters' => [
Expand Down
2 changes: 1 addition & 1 deletion src/Generator/Commands/ServiceProviderGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class ServiceProviderGenerator extends GeneratorCommand implements ComponentsGen
*/
protected string $stubName = 'providers/mainserviceprovider.stub';

public function getUserInputs(): null|array
public function getUserInputs(): array|null
{
$stub = Str::lower(
$this->checkParameterOrChoice(
Expand Down
2 changes: 1 addition & 1 deletion src/Generator/Commands/SubActionGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class SubActionGenerator extends GeneratorCommand implements ComponentsGenerator
*/
protected string $stubName = 'subaction.stub';

public function getUserInputs(): null|array
public function getUserInputs(): array|null
{
return [
'path-parameters' => [
Expand Down
2 changes: 1 addition & 1 deletion src/Generator/Commands/TaskGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class TaskGenerator extends GeneratorCommand implements ComponentsGenerator
*/
protected string $stubName = 'tasks/generic.stub';

public function getUserInputs(): null|array
public function getUserInputs(): array|null
{
$model = $this->checkParameterOrAsk('model', 'Enter the name of the model this task is for.', $this->containerName);
$stub = Str::lower(
Expand Down
2 changes: 1 addition & 1 deletion src/Generator/Commands/TestFunctionalTestGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class TestFunctionalTestGenerator extends GeneratorCommand implements Components
*/
protected string $stubName = 'tests/functional/generic.stub';

public function getUserInputs(): null|array
public function getUserInputs(): array|null
{
$ui = Str::lower($this->checkParameterOrChoice('ui', 'Select the UI for the Test', ['API', 'WEB', 'CLI'], 0));

Expand Down
2 changes: 1 addition & 1 deletion src/Generator/Commands/TestTestCaseGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class TestTestCaseGenerator extends GeneratorCommand implements ComponentsGenera
*/
protected string $stubName = 'tests/testcase/generic.stub';

public function getUserInputs(): null|array
public function getUserInputs(): array|null
{
$type = Str::lower($this->checkParameterOrChoice('type', 'Select the TestCase type', ['Unit', 'Functional'], 0));

Expand Down
2 changes: 1 addition & 1 deletion src/Generator/Commands/TestUnitTestGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class TestUnitTestGenerator extends GeneratorCommand implements ComponentsGenera
*/
protected string $stubName = 'tests/unit/generic.stub';

public function getUserInputs(): null|array
public function getUserInputs(): array|null
{
$model = $this->option('model');
$stub = $this->option('stub');
Expand Down
2 changes: 1 addition & 1 deletion src/Generator/Commands/TransformerGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class TransformerGenerator extends GeneratorCommand implements ComponentsGenerat
*/
protected string $stubName = 'transformer.stub';

public function getUserInputs(): null|array
public function getUserInputs(): array|null
{
$model = $this->checkParameterOrAsk('model', 'Enter the name of the Model to generate this Transformer for');
$full = $this->checkParameterOrConfirm('full', 'Generate a Transformer with all fields', false);
Expand Down
2 changes: 1 addition & 1 deletion src/Generator/Commands/ValueGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class ValueGenerator extends GeneratorCommand implements ComponentsGenerator
*/
protected string $stubName = 'value.stub';

public function getUserInputs(): null|array
public function getUserInputs(): array|null
{
return [
'path-parameters' => [
Expand Down
2 changes: 1 addition & 1 deletion src/Generator/GeneratorCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ private function validateGenerator($generator): void
/**
* Checks if the param is set (via CLI), otherwise asks the user for a value.
*/
protected function checkParameterOrAsk($param, $question, null|string $default = null): mixed
protected function checkParameterOrAsk($param, $question, string|null $default = null): mixed
{
// Check if we already have a param set
$value = $this->option($param);
Expand Down
2 changes: 1 addition & 1 deletion src/Generator/Interfaces/ComponentsGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ interface ComponentsGenerator
/**
* Reads all data for the component to be generated (as well as the mappings for path, file and stubs).
*/
public function getUserInputs(): null|array;
public function getUserInputs(): array|null;
}
2 changes: 1 addition & 1 deletion src/Loaders/LocalizationLoaderTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ private function loadLocals($directory, $containerName, $sectionName = null): vo
}
}

private function buildLocaleNamespace(null|string $sectionName, string $containerName): string
private function buildLocaleNamespace(string|null $sectionName, string $containerName): string
{
return $sectionName ? (Str::camel($sectionName) . '@' . Str::camel($containerName)) : Str::camel($containerName);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Loaders/RoutesLoaderTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ private function getMiddlewares(): array
]);
}

private function getRateLimitMiddleware(): null|string
private function getRateLimitMiddleware(): string|null
{
$rateLimitMiddleware = null;

Expand Down
2 changes: 1 addition & 1 deletion src/Loaders/ViewsLoaderTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ private function loadViews($directory, $containerName, $sectionName = null): voi
}
}

private function buildViewNamespace(null|string $sectionName, string $containerName): string
private function buildViewNamespace(string|null $sectionName, string $containerName): string
{
return $sectionName ? (Str::camel($sectionName) . '@' . Str::camel($containerName)) : Str::camel($containerName);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Traits/FactoryLocatorTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

trait FactoryLocatorTrait
{
protected static function newFactory(): null|Factory
protected static function newFactory(): Factory|null
{
$separator = '\\';
$containersFactoriesPath = $separator . 'Data' . $separator . 'Factories' . $separator;
Expand Down
2 changes: 1 addition & 1 deletion src/Traits/HasRequestCriteriaTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ private function decodeSearchQueryString(array $fieldsToDecode): void
request()->query->replace($query);
}

private function decodeValue(string $searchQuery): null|string
private function decodeValue(string $searchQuery): string|null
{
$searchValue = $this->parserSearchValue($searchQuery);

Expand Down
Loading

0 comments on commit f5fee4b

Please sign in to comment.