Skip to content

Commit e8f6e05

Browse files
committed
refactor: use consistent naming conventions
1 parent 428df47 commit e8f6e05

File tree

122 files changed

+623
-467
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

122 files changed

+623
-467
lines changed

packages/console/src/Middleware/InvalidCommandMiddleware.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
use Tempest\Core\Priority;
1717
use Tempest\Validation\Rules\IsBoolean;
1818
use Tempest\Validation\Rules\IsEnum;
19-
use Tempest\Validation\Rules\NotEmpty;
20-
use Tempest\Validation\Rules\Numeric;
19+
use Tempest\Validation\Rules\IsNotEmptyString;
20+
use Tempest\Validation\Rules\IsNumeric;
2121

2222
use function Tempest\Support\str;
2323

@@ -70,10 +70,10 @@ private function retry(Invocation $invocation, InvalidCommandException $exceptio
7070
validation: array_filter([
7171
$isEnum
7272
? new IsEnum($argument->type)
73-
: new NotEmpty(),
73+
: new IsNotEmptyString(),
7474
match ($argument->type) {
7575
'bool' => new IsBoolean(),
76-
'int' => new Numeric(),
76+
'int' => new IsNumeric(),
7777
default => null,
7878
},
7979
]),

packages/core/src/PublishesFiles.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
use Tempest\Support\Json;
2222
use Tempest\Support\Str\ImmutableString;
2323
use Tempest\Validation\Rules\EndsWith;
24-
use Tempest\Validation\Rules\NotEmpty;
24+
use Tempest\Validation\Rules\IsNotEmptyString;
2525
use Throwable;
2626

2727
use function strlen;
@@ -174,7 +174,7 @@ public function promptTargetPath(string $suggestedPath, ?array $rules = null): s
174174
$targetPath = $this->console->ask(
175175
question: sprintf('Where do you want to save the file <em>%s</em>?', $className),
176176
default: to_relative_path(root_path(), $suggestedPath),
177-
validation: $rules ?? [new NotEmpty(), new EndsWith('.php')],
177+
validation: $rules ?? [new IsNotEmptyString(), new EndsWith('.php')],
178178
);
179179

180180
return to_absolute_path(root_path(), $targetPath);

packages/database/src/Commands/MakeMigrationCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
use Tempest\Generation\Exceptions\FileGenerationFailedException;
1717
use Tempest\Generation\Exceptions\FileGenerationWasAborted;
1818
use Tempest\Validation\Rules\EndsWith;
19-
use Tempest\Validation\Rules\NotEmpty;
19+
use Tempest\Validation\Rules\IsNotEmptyString;
2020

2121
use function Tempest\Support\str;
2222

@@ -74,7 +74,7 @@ private function generateRawFile(
7474
->toString();
7575

7676
$targetPath = $this->promptTargetPath($suggestedPath, rules: [
77-
new NotEmpty(),
77+
new IsNotEmptyString(),
7878
new EndsWith('.sql'),
7979
]);
8080
$shouldOverride = $this->askForOverride($targetPath);

packages/database/src/Stubs/DatabaseModelStub.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
namespace Tempest\Database\Stubs;
66

77
use Tempest\Database\IsDatabaseModel;
8-
use Tempest\Validation\Rules\Length;
8+
use Tempest\Validation\Rules\HasLength;
99

1010
final class DatabaseModelStub
1111
{
1212
use IsDatabaseModel;
1313

1414
public function __construct(
15-
#[Length(min: 1, max: 120)]
15+
#[HasLength(min: 1, max: 120)]
1616
public string $title,
1717
) {}
1818
}

packages/http/src/Stubs/RequestStub.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66

77
use Tempest\Http\IsRequest;
88
use Tempest\Http\Request;
9-
use Tempest\Validation\Rules\Length;
9+
use Tempest\Validation\Rules\HasLength;
1010

1111
final class RequestStub implements Request
1212
{
1313
use IsRequest;
1414

15-
#[Length(min: 10, max: 120)]
15+
#[HasLength(min: 10, max: 120)]
1616
public string $title;
1717
}

packages/mapper/src/Casters/DateTimeCaster.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
use Tempest\DateTime\FormatPattern;
1111
use Tempest\Mapper\Caster;
1212
use Tempest\Reflection\PropertyReflector;
13-
use Tempest\Validation\Rules\DateTimeFormat;
13+
use Tempest\Validation\Rules\HasDateTimeFormat;
1414

1515
final readonly class DateTimeCaster implements Caster
1616
{
@@ -21,7 +21,7 @@ public function __construct(
2121
public static function fromProperty(PropertyReflector $property): self
2222
{
2323
return new self(
24-
$property->getAttribute(DateTimeFormat::class)->format ?? FormatPattern::ISO8601,
24+
$property->getAttribute(HasDateTimeFormat::class)->format ?? FormatPattern::ISO8601,
2525
);
2626
}
2727

packages/mapper/src/Casters/NativeDateTimeCaster.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
use DateTimeInterface;
1010
use Tempest\Mapper\Caster;
1111
use Tempest\Reflection\PropertyReflector;
12-
use Tempest\Validation\Rules\DateTimeFormat;
12+
use Tempest\Validation\Rules\HasDateTimeFormat;
1313

1414
final readonly class NativeDateTimeCaster implements Caster
1515
{
@@ -20,7 +20,7 @@ public function __construct(
2020

2121
public static function fromProperty(PropertyReflector $property): NativeDateTimeCaster
2222
{
23-
$format = $property->getAttribute(DateTimeFormat::class)->format ?? 'Y-m-d H:i:s';
23+
$format = $property->getAttribute(HasDateTimeFormat::class)->format ?? 'Y-m-d H:i:s';
2424

2525
return match ($property->getType()->getName()) {
2626
DateTime::class => new NativeDateTimeCaster($format, immutable: false),

packages/mapper/src/Serializers/DateTimeSerializer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
use Tempest\Mapper\Serializer;
1313
use Tempest\Reflection\PropertyReflector;
1414
use Tempest\Reflection\TypeReflector;
15-
use Tempest\Validation\Rules\DateTimeFormat;
15+
use Tempest\Validation\Rules\HasDateTimeFormat;
1616

1717
final readonly class DateTimeSerializer implements Serializer
1818
{
@@ -23,7 +23,7 @@ public function __construct(
2323
public static function fromReflector(PropertyReflector|TypeReflector $reflector): self
2424
{
2525
if ($reflector instanceof PropertyReflector) {
26-
$format = $reflector->getAttribute(DateTimeFormat::class)?->format ?? FormatPattern::SQL_DATE_TIME;
26+
$format = $reflector->getAttribute(HasDateTimeFormat::class)?->format ?? FormatPattern::SQL_DATE_TIME;
2727
} else {
2828
$format = FormatPattern::SQL_DATE_TIME;
2929
}

packages/mapper/src/Serializers/NativeDateTimeSerializer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
use Tempest\Reflection\ClassReflector;
1111
use Tempest\Reflection\PropertyReflector;
1212
use Tempest\Reflection\TypeReflector;
13-
use Tempest\Validation\Rules\DateTimeFormat;
13+
use Tempest\Validation\Rules\HasDateTimeFormat;
1414

1515
final readonly class NativeDateTimeSerializer implements Serializer
1616
{
@@ -21,7 +21,7 @@ public function __construct(
2121
public static function fromReflector(PropertyReflector|TypeReflector $property): self
2222
{
2323
if ($property instanceof PropertyReflector) {
24-
$format = $property->getAttribute(DateTimeFormat::class)?->format ?? 'Y-m-d H:i:s';
24+
$format = $property->getAttribute(HasDateTimeFormat::class)?->format ?? 'Y-m-d H:i:s';
2525
} else {
2626
$format = 'Y-m-d H:i:s';
2727
}

packages/validation/src/Rules/DoesNotEndWith.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
use Tempest\Validation\HasTranslationVariables;
99
use Tempest\Validation\Rule;
1010

11+
/**
12+
* Validates that the value does not end with a specified string.
13+
*/
1114
#[Attribute]
1215
final readonly class DoesNotEndWith implements Rule, HasTranslationVariables
1316
{

0 commit comments

Comments
 (0)