forked from jolicode/castor
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is needed for people using this lib as a global composer install or not using the phar archive
- Loading branch information
Showing
5 changed files
with
199 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,153 @@ | ||
<?php | ||
|
||
namespace Castor; | ||
|
||
class PathHelper | ||
{ | ||
public static function getRoot() : string | ||
{ | ||
} | ||
public static function realpath(string $path) : string | ||
{ | ||
} | ||
} | ||
namespace Castor; | ||
|
||
/** | ||
* @return array<mixed> | ||
*/ | ||
function parallel(callable ...$callbacks) : array | ||
{ | ||
} | ||
/** | ||
* @param string|array<string> $command | ||
* @param (callable(string, string, Process) :void)|null $callback | ||
* @param array<string, string>|null $environment | ||
*/ | ||
function exec(string|array $command, array|null $environment = null, string|null $path = null, bool|null $tty = null, bool|null $pty = null, float|null $timeout = null, bool|null $quiet = null, bool|null $allowFailure = null, bool|null $notify = null, callable $callback = null, Context $context = null) : \Symfony\Component\Process\Process | ||
{ | ||
} | ||
function notify(string $message) : void | ||
{ | ||
} | ||
/** @param (callable(string, string) : (false|null)) $function */ | ||
function watch(string $path, callable $function, Context $context = null) : void | ||
{ | ||
} | ||
/** | ||
* @param array<string, mixed> $context | ||
*/ | ||
function log(string $message, string $level = 'info', array $context = []) : void | ||
{ | ||
} | ||
function import(string $path) : void | ||
{ | ||
} | ||
namespace Castor; | ||
|
||
class Context implements \ArrayAccess | ||
{ | ||
public readonly string $currentDirectory; | ||
/** | ||
* @param array<(int|string), mixed> $data The input parameter accepts an array or an Object | ||
* @param array<string, string> $environment A list of environment variables to add to the command | ||
*/ | ||
public function __construct(public readonly array $data = [], public readonly array $environment = [], string $currentDirectory = null, public readonly bool $tty = false, public readonly bool $pty = true, public readonly float|null $timeout = 60, public readonly bool $quiet = false, public readonly bool $allowFailure = false, public readonly bool $notify = false) | ||
{ | ||
} | ||
/** @param array<(int|string), mixed> $data */ | ||
public function withData(array $data, bool $keepExisting = true) : self | ||
{ | ||
} | ||
/** @param array<string, string> $environment */ | ||
public function withEnvironment(array $environment, bool $keepExisting = true) : self | ||
{ | ||
} | ||
public function withPath(string $path) : self | ||
{ | ||
} | ||
public function withTty(bool $tty = true) : self | ||
{ | ||
} | ||
public function withPty(bool $pty = true) : self | ||
{ | ||
} | ||
public function withTimeout(float|null $timeout) : self | ||
{ | ||
} | ||
public function withQuiet(bool $quiet = true) : self | ||
{ | ||
} | ||
public function withAllowFailure(bool $allowFailure = true) : self | ||
{ | ||
} | ||
public function withNotify(bool $notify = true) : self | ||
{ | ||
} | ||
public function offsetExists(mixed $offset) : bool | ||
{ | ||
} | ||
public function offsetGet(mixed $offset) : mixed | ||
{ | ||
} | ||
public function offsetSet(mixed $offset, mixed $value) : void | ||
{ | ||
} | ||
public function offsetUnset(mixed $offset) : void | ||
{ | ||
} | ||
} | ||
namespace Castor\Attribute; | ||
|
||
#[\Attribute(\Attribute::TARGET_FUNCTION)] | ||
class AsTask | ||
{ | ||
/** | ||
* @param array<string> $aliases | ||
*/ | ||
public function __construct(public string $name = '', public string|null $namespace = null, public string $description = '', public array $aliases = []) | ||
{ | ||
} | ||
} | ||
namespace Castor\Attribute; | ||
|
||
#[\Attribute(\Attribute::TARGET_FUNCTION)] | ||
class AsContext | ||
{ | ||
public function __construct(public string $name = '', public bool $default = false) | ||
{ | ||
} | ||
} | ||
namespace Castor\Attribute; | ||
|
||
abstract class AsCommandArgument | ||
{ | ||
public function __construct(public readonly string|null $name = null) | ||
{ | ||
} | ||
} | ||
namespace Castor\Attribute; | ||
|
||
#[\Attribute(\Attribute::TARGET_PARAMETER)] | ||
class AsArgument extends AsCommandArgument | ||
{ | ||
/** | ||
* @param array<string> $suggestedValues | ||
*/ | ||
public function __construct(string|null $name = null, public readonly string $description = '', public readonly array $suggestedValues = []) | ||
{ | ||
} | ||
} | ||
namespace Castor\Attribute; | ||
|
||
#[\Attribute(\Attribute::TARGET_PARAMETER)] | ||
class AsOption extends AsCommandArgument | ||
{ | ||
/** | ||
* @param string|array<string>|null $shortcut | ||
* @param array<string> $suggestedValues | ||
*/ | ||
public function __construct(string|null $name = null, public readonly string|array|null $shortcut = null, public readonly int|null $mode = null, public readonly string $description = '', public readonly array $suggestedValues = []) | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: 'Build the PHAR' | ||
description: 'Build the PHAR for the current commit' | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '8.1' | ||
|
||
- name: Install dependencies (project) | ||
run: composer install --prefer-dist --no-progress --no-dev --optimize-autoloader --classmap-authoritative | ||
shell: bash | ||
|
||
- name: Install dependencies (PHAR builder) | ||
run: composer install --prefer-dist --no-progress --optimize-autoloader --classmap-authoritative | ||
shell: bash | ||
working-directory: tools/phar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: Check stub | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
stub: | ||
name: Check there is no change to the stub | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Install tools | ||
uses: ./.github/actions/tools | ||
|
||
- name: Check if there is no change | ||
run: git diff --exit-code | ||
shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
/var/ | ||
/vendor/ | ||
.php-cs-fixer.cache | ||
.castor.stub.php |