Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions stubs/fields/array_of.stub.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php
/** @generate-class-entries */

namespace Attributes\Validation\Fields {
#[Attribute(Attribute::TARGET_PROPERTY|Attribute::TARGET_PARAMETER)]
class ArrayOf implements Field {
/**
* @param class-string|string ...$types
*/
public function __construct(public string ...$types) {}
}
}
9 changes: 9 additions & 0 deletions stubs/fields/length.stub.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php
/** @generate-class-entries */

namespace Attributes\Validation\Fields {
#[Attribute(Attribute::TARGET_PROPERTY|Attribute::TARGET_PARAMETER)]
class Length implements Field {
public function __construct(public ?int $min = null, public ?int $max = null) {}
}
}
12 changes: 12 additions & 0 deletions stubs/rules/custom.stub.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php
/** @generate-class-entries */

namespace Attributes\Validation\Rules {
interface Custom {
/**
* Validates the value and returns true if valid, false otherwise.
* Can also throw ValidationException for more detailed error messages.
*/
public function validate(mixed $value): bool;
}
}