Skip to content

Commit

Permalink
test: add @var for PHPStan
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjis committed Aug 3, 2024
1 parent c408acf commit 72c92e0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 18 deletions.
18 changes: 0 additions & 18 deletions phpstan-baseline.php
Original file line number Diff line number Diff line change
Expand Up @@ -12955,24 +12955,6 @@
'count' => 1,
'path' => __DIR__ . '/tests/system/ControllerTest.php',
];
$ignoreErrors[] = [
// identifier: missingType.property
'message' => '#^Property class@anonymous/tests/system/ControllerTest\\.php\\:128\\:\\:\\$signup has no type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/tests/system/ControllerTest.php',
];
$ignoreErrors[] = [
// identifier: missingType.property
'message' => '#^Property class@anonymous/tests/system/ControllerTest\\.php\\:128\\:\\:\\$signup_errors has no type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/tests/system/ControllerTest.php',
];
$ignoreErrors[] = [
// identifier: missingType.property
'message' => '#^Property class@anonymous/tests/system/ControllerTest\\.php\\:151\\:\\:\\$signup has no type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/tests/system/ControllerTest.php',
];
$ignoreErrors[] = [
// identifier: argument.type
'message' => '#^Parameter \\#1 \\$cookies of class CodeIgniter\\\\Cookie\\\\CookieStore constructor expects array\\<CodeIgniter\\\\Cookie\\\\Cookie\\>, array\\<int, DateTimeImmutable\\> given\\.$#',
Expand Down
10 changes: 10 additions & 0 deletions tests/system/ControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,16 @@ public function testValidateWithStringRulesNotFound(): void
public function testValidateWithStringRulesFoundReadMessagesFromValidationConfig(): void
{
$validation = new class () extends ValidationConfig {
/**
* @var array<string, string>
*/
public array $signup = [
'username' => 'required',
];

/**
* @var array<string, array<string, string>>
*/
public array $signup_errors = [
'username' => [
'required' => 'You must choose a username.',
Expand All @@ -149,6 +156,9 @@ public function testValidateWithStringRulesFoundReadMessagesFromValidationConfig
public function testValidateWithStringRulesFoundUseMessagesParameter(): void
{
$validation = new class () extends ValidationConfig {
/**
* @var array<string, string>
*/
public array $signup = [
'username' => 'required',
];
Expand Down

0 comments on commit 72c92e0

Please sign in to comment.