Skip to content

Commit

Permalink
refactor: add return type hint for getModel() method in condition cla…
Browse files Browse the repository at this point in the history
…sses

Signed-off-by: Sam Poyigi <[email protected]>
  • Loading branch information
sampoyigi committed Feb 27, 2025
1 parent 45fb942 commit 3d7311e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
10 changes: 7 additions & 3 deletions tests/Classes/BaseConditionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
$model = Mockery::mock(Model::class);
$condition = new class($model) extends BaseCondition
{
public function getModel()
public function getModel(): ?Model
{
return $this->model;
}
Expand All @@ -23,13 +23,17 @@ public function getModel()
});

it('defines a name and description', function(): void {
$condition = new class extends BaseCondition {};
$condition = new class extends BaseCondition
{
};

expect($condition->conditionDetails())->toHaveKeys(['name', 'description']);
});

it('checks condition', function(): void {
$condition = new class extends BaseCondition {};
$condition = new class extends BaseCondition
{
};

$params = [];

Expand Down
10 changes: 7 additions & 3 deletions tests/Classes/BaseModelAttributesConditionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
$model = Mockery::mock(Model::class)->makePartial();
$condition = new class($model) extends BaseModelAttributesCondition
{
public function getModel()
public function getModel(): ?Model
{
return $this->model;
}
Expand Down Expand Up @@ -103,7 +103,9 @@ public function __construct($operator)
],
];

$this->model = new class($attributes) extends Model {};
$this->model = new class($attributes) extends Model
{
};
}

public function defineModelAttributes(): array
Expand Down Expand Up @@ -137,7 +139,9 @@ public function __construct($operator, $value)
],
];

$this->model = new class($attributes) extends Model {};
$this->model = new class($attributes) extends Model
{
};
}

public function defineModelAttributes(): array
Expand Down

0 comments on commit 3d7311e

Please sign in to comment.