Skip to content

Commit a4e0da9

Browse files
committed
Adds PHPStan types to help with type-checking
1 parent ee16aad commit a4e0da9

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎src/HasChildren.php‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,8 +265,13 @@ public function getChildTypes(): array
265265

266266
/**
267267
* Convert the current model instance into another child type.
268+
*
269+
* @template T of object
270+
*
271+
* @param class-string<T> $class
272+
* @return new<T>
268273
*/
269-
public function become($class)
274+
public function become(string $class): object
270275
{
271276
return tap(new $class($attributes = $this->getAttributes()), function ($instance) use ($class, $attributes) {
272277
$instance->setRawAttributes(array_merge($attributes, [

0 commit comments

Comments
 (0)