We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 93f84fd commit 4d03902Copy full SHA for 4d03902
src/With.php
@@ -1,19 +1,23 @@
1
<?php
2
namespace nixn\php;
3
4
-/** @since 1.1 */
+/**
5
+ * @template T
6
+ * @type With<T>
7
+ * @since 1.1
8
+ */
9
final class With
10
{
11
/**
- * @template T
- * @param class-string<T> $class
- * @param mixed ...$args
- * @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`
16
* @since 1.1
17
*/
- public static function new(string $class, mixed ...$args): object
18
+ public static function new(string $class, mixed ...$args): With
19
- return new $class(...$args);
20
+ return new self(new $class(...$args));
21
}
22
23
public function __construct(
0 commit comments