Skip to content

Commit b3d05d2

Browse files
committed
Rename namedObjectT() to objectT()
1 parent 4075f60 commit b3d05d2

4 files changed

Lines changed: 7 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ Complex types requiring reflection and/or additional context have been removed a
3131
- **BC Break:** Require at least one type in `unionT`, return `UnionT`.
3232
- **BC Break:** Require at least one type in `bitmaskT`.
3333
- **BC Break:** Do not accept `WeakReference<Visitor>` in `Stringify` — use `WeakVisitor` instead.
34+
- **BC Break:** Rename `namedObjectT()` to `objectT()`.
3435

3536
### Removed
3637

src/Type/constructors.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ function stringT(string $value): StringValueT
138138
function classT(string|Type $object): ClassT
139139
{
140140
if (\is_string($object)) {
141-
return new ClassT(namedObjectT($object));
141+
return new ClassT(objectT($object));
142142
}
143143

144144
return new ClassT($object);
@@ -286,7 +286,7 @@ function iterableT(Type $key = mixedT, Type $value = mixedT): IterableT
286286
* @param list<Type> $templateArguments
287287
* @return NamedObjectT<T>
288288
*/
289-
function namedObjectT(string $class, array $templateArguments = []): NamedObjectT
289+
function objectT(string $class, array $templateArguments = []): NamedObjectT
290290
{
291291
return new NamedObjectT($class, $templateArguments);
292292
}

tests/Type/ConstructorsTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
#[CoversFunction('Typhoon\Type\arrayShapeT')]
3030
#[CoversFunction('Typhoon\Type\unsealedArrayShapeT')]
3131
#[CoversFunction('Typhoon\Type\iterableT')]
32-
#[CoversFunction('Typhoon\Type\namedObjectT')]
32+
#[CoversFunction('Typhoon\Type\objectT')]
3333
#[CoversFunction('Typhoon\Type\objectShapeT')]
3434
#[CoversFunction('Typhoon\Type\callableT')]
3535
#[CoversFunction('Typhoon\Type\closureT')]

tests/Type/StringifyTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public static function provideCases(): iterable
101101
yield [stringT("\n"), "'\\n'"];
102102
yield [lowercaseStringT, 'lowercase-string'];
103103
yield [classT(\stdClass::class), 'class-string<stdClass>'];
104-
yield [classT(namedObjectT(\stdClass::class)), 'class-string<stdClass>'];
104+
yield [classT(objectT(\stdClass::class)), 'class-string<stdClass>'];
105105
yield [scalarT, 'scalar'];
106106
yield [resourceT, 'resource'];
107107
yield [nonEmptyListT(), 'non-empty-list<mixed>'];
@@ -138,8 +138,8 @@ public static function provideCases(): iterable
138138
yield [arrayShapeT(['a' => optional(intT)]), "array{'a'?: int}"];
139139
yield [unsealedArrayShapeT(['a' => floatT], key: intT, value: stringT), "array{'a': float, ...<int, string>}"];
140140
yield [objectT, 'object'];
141-
yield [namedObjectT(\ArrayObject::class), 'ArrayObject'];
142-
yield [namedObjectT(\ArrayObject::class, [arrayKeyT, stringT]), 'ArrayObject<array-key, string>'];
141+
yield [objectT(\ArrayObject::class), 'ArrayObject'];
142+
yield [objectT(\ArrayObject::class, [arrayKeyT, stringT]), 'ArrayObject<array-key, string>'];
143143
yield [unionT(intT, stringT), 'int|string'];
144144
yield [unionT(intT, unionT(stringT, floatT)), 'int|(string|float)'];
145145
yield [unionT(intT, intersectionT(stringT, floatT)), 'int|(string&float)'];

0 commit comments

Comments
 (0)