Skip to content

Commit 4d03902

Browse files
author
nix
committed
fixed With::new() and updated / corrected PHPdocs
1 parent 93f84fd commit 4d03902

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

src/With.php

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
11
<?php
22
namespace nixn\php;
33

4-
/** @since 1.1 */
4+
/**
5+
* @template T
6+
* @type With<T>
7+
* @since 1.1
8+
*/
59
final class With
610
{
711
/**
8-
* @template T
9-
* @param class-string<T> $class
10-
* @param mixed ...$args
11-
* @return T
12+
* @template W
13+
* @param class-string<W> $class the class name to create
14+
* @param mixed ...$args constructor arguments
15+
* @return With<W> the created object, wrapped into `With`
1216
* @since 1.1
1317
*/
14-
public static function new(string $class, mixed ...$args): object
18+
public static function new(string $class, mixed ...$args): With
1519
{
16-
return new $class(...$args);
20+
return new self(new $class(...$args));
1721
}
1822

1923
public function __construct(

0 commit comments

Comments
 (0)