mirror of
https://github.com/pestphp/pest.git
synced 2026-03-07 00:07:22 +01:00
feat: adds pest function
This commit is contained in:
@ -48,11 +48,14 @@ final class UsesCall
|
||||
*/
|
||||
public function __construct(
|
||||
private readonly string $filename,
|
||||
private readonly array $classAndTraits
|
||||
private array $classAndTraits
|
||||
) {
|
||||
$this->targets = [$filename];
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use `pest()->theme()->compact()` instead.
|
||||
*/
|
||||
public function compact(): self
|
||||
{
|
||||
DefaultPrinter::compact(true);
|
||||
@ -60,11 +63,31 @@ final class UsesCall
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies the class or traits to use.
|
||||
*
|
||||
* @alias extend
|
||||
*/
|
||||
public function use(string ...$classAndTraits): self
|
||||
{
|
||||
return $this->extend(...$classAndTraits);
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies the class or traits to use.
|
||||
*/
|
||||
public function extend(string ...$classAndTraits): self
|
||||
{
|
||||
$this->classAndTraits = array_values($classAndTraits);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The directories or file where the
|
||||
* class or traits should be used.
|
||||
*/
|
||||
public function in(string ...$targets): void
|
||||
public function in(string ...$targets): self
|
||||
{
|
||||
$targets = array_map(function (string $path): string {
|
||||
$startChar = DIRECTORY_SEPARATOR;
|
||||
@ -92,6 +115,8 @@ final class UsesCall
|
||||
|
||||
return $accumulator;
|
||||
}, []);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user