Skip to content

Commit 24efc4e

Browse files
committed
add Strict
1 parent f52e6bb commit 24efc4e

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/Strict/Strict.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php declare(strict_types = 1);
2+
3+
namespace Utilitte\Php\Strict;
4+
5+
final class Strict
6+
{
7+
8+
/**
9+
* @template T
10+
* @param class-string<T> $className
11+
* @return T
12+
*/
13+
public static function instanceOf(mixed $object, string $className): object
14+
{
15+
assert($object instanceof $className);
16+
17+
return $object;
18+
}
19+
20+
}

0 commit comments

Comments
 (0)