Skip to content

Commit

Permalink
Merge pull request #94 from ans-group/add-phpmd
Browse files Browse the repository at this point in the history
Add PHPMD design rules
  • Loading branch information
phily245 authored Jul 24, 2024
2 parents 81b3e79 + 98b5a6e commit d804ad3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
4 changes: 3 additions & 1 deletion .phpmd/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,7 @@

<rule ref="rulesets/codesize.xml" />

<rule ref="rulesets/design.xml">
<exclude name="NumberOfChildren" />
</rule>
</ruleset>

7 changes: 2 additions & 5 deletions src/AppHealth.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,14 @@ class AppHealth
{
public function __construct(
/**
* @var Collection<int, class-string>
* @var Collection<int, HealthCheck>
*/
protected Collection $checks,
) {
}

public function passes($checkName)
{
/**
* @var HealthCheck $check
*/
$check = $this->checks->filter(function ($check) use ($checkName) {
return $check->name() == $checkName;
})->first();
Expand All @@ -44,7 +41,7 @@ public function fails($checkName): bool
/**
* Returns a collection of all health checks
*
* @return Collection<int, class-string>
* @return Collection<int, HealthCheck>
*/
public function all(): Collection
{
Expand Down
9 changes: 9 additions & 0 deletions src/Facade/HealthCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,17 @@

namespace UKFast\HealthCheck\Facade;

use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Facade;
use UKFast\HealthCheck\AppHealth;
use UKFast\HealthCheck\HealthCheck as Check;

/**
* @method static bool passes(string $checkName)
* @method static bool fails(string $checkName)
* @method static Collection<int, Check> all()
* @see AppHealth
*/
class HealthCheck extends Facade
{
public static function getFacadeAccessor(): string
Expand Down

0 comments on commit d804ad3

Please sign in to comment.