Skip to content

Commit

Permalink
Refactor code to use parameter, return type hints
Browse files Browse the repository at this point in the history
Signed-off-by: Sam Poyigi <6567634+sampoyigi@users.noreply.github.com>
  • Loading branch information
sampoyigi committed Jan 14, 2024
1 parent 79a2aca commit aa39a2b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
8 changes: 4 additions & 4 deletions src/Extension.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Extension extends BaseExtension
PaymentGateways::class,
];

public function registerPaymentGateways()
public function registerPaymentGateways(): array
{
return [
\Igniter\PayRegister\Payments\Cod::class => [
Expand Down Expand Up @@ -67,7 +67,7 @@ public function registerPaymentGateways()
];
}

public function registerFormWidgets()
public function registerFormWidgets(): array
{
return [
\Igniter\PayRegister\FormWidgets\PaymentAttempts::class => [
Expand All @@ -77,7 +77,7 @@ public function registerFormWidgets()
];
}

public function registerNavigation()
public function registerNavigation(): array
{
return [
'sales' => [
Expand All @@ -94,7 +94,7 @@ public function registerNavigation()
];
}

public function registerPermissions()
public function registerPermissions(): array
{
return [
'Admin.Payments' => [
Expand Down
5 changes: 3 additions & 2 deletions src/FormWidgets/PaymentAttempts.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Igniter\Cart\Models\Order;
use Igniter\Flame\Exception\FlashException;
use Igniter\PayRegister\Models\PaymentLog;
use Illuminate\Database\Eloquent\Model;

class PaymentAttempts extends BaseFormWidget
{
Expand All @@ -19,7 +20,7 @@ class PaymentAttempts extends BaseFormWidget
/**
* @var Order Form model object.
*/
public $model;
public ?Model $model = null;

public $form;

Expand Down Expand Up @@ -49,7 +50,7 @@ public function render()
return $this->makePartial('paymentattempts/paymentattempts');
}

public function getSaveValue($value)
public function getSaveValue(mixed $value): int
{
return FormField::NO_SAVE_DATA;
}
Expand Down
8 changes: 4 additions & 4 deletions src/Http/Controllers/Payments.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@

class Payments extends \Igniter\Admin\Classes\AdminController
{
public $implement = [
public array $implement = [
\Igniter\Admin\Http\Actions\ListController::class,
\Igniter\Admin\Http\Actions\FormController::class,
];

public $listConfig = [
public array $listConfig = [
'list' => [
'model' => \Igniter\PayRegister\Models\Payment::class,
'title' => 'lang:igniter.payregister::default.text_title',
Expand All @@ -27,7 +27,7 @@ class Payments extends \Igniter\Admin\Classes\AdminController
],
];

public $formConfig = [
public array $formConfig = [
'name' => 'lang:igniter.payregister::default.text_form_name',
'model' => \Igniter\PayRegister\Models\Payment::class,
'create' => [
Expand All @@ -48,7 +48,7 @@ class Payments extends \Igniter\Admin\Classes\AdminController
'configFile' => 'payment',
];

protected $requiredPermissions = 'Admin.Payments';
protected null|string|array $requiredPermissions = 'Admin.Payments';

protected $gateway;

Expand Down

0 comments on commit aa39a2b

Please sign in to comment.