Skip to content

Commit

Permalink
Merge branch 'release/v0.10.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
betterthanclay committed Apr 26, 2024
2 parents b252f2c + b746d51 commit f4f0969
Show file tree
Hide file tree
Showing 20 changed files with 450 additions and 271 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/integrate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
pull_request: null

env:
PHP_EXTENSIONS: "intl"
PHP_EXTENSIONS: "intl, :php-psr"

jobs:
file_consistency:
Expand All @@ -19,7 +19,7 @@ jobs:
- name: "Set up PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "8.0"
php-version: "8.1"
extensions: "${{ env.PHP_EXTENSIONS }}"
ini-values: "post_max_size=256M"

Expand Down Expand Up @@ -60,9 +60,9 @@ jobs:
strategy:
matrix:
php-version:
- "8.0"
- "8.1"
- "8.2"
- "8.3"
steps:
- name: "Set up PHP"
uses: "shivammathur/setup-php@v2"
Expand Down Expand Up @@ -101,7 +101,7 @@ jobs:
- name: "Set up PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "8.0"
php-version: "8.1"
extensions: "${{ env.PHP_EXTENSIONS }}"
ini-values: "post_max_size=256M"

Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## v0.10.2 (2024-04-26)
* Updated Archetype dependency
* Made PHP8.1 minimum version
* Refactored package file structure

## v0.10.1 (2023-10-05)
* Fixed Request replacement
* Added argument get helpers
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
"email": "[email protected]"
} ],
"require": {
"php": "^8.0",
"php": "^8.1",

"decodelabs/archetype": "^0.2.11",
"decodelabs/archetype": "^0.2|^0.3",
"decodelabs/coercion": "^0.2",
"decodelabs/deliverance": "^0.2",
"decodelabs/exceptional": "^0.4",
Expand All @@ -26,10 +26,10 @@
},
"autoload": {
"psr-4": {
"DecodeLabs\\Terminus\\": "src/Terminus"
"DecodeLabs\\Terminus\\": "src/"
},
"files": [
"src/global.php"
"src/Context.php"
]
},
"extra": {
Expand Down
5 changes: 4 additions & 1 deletion src/Terminus/Adapter.php → src/Adapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@
interface Adapter
{
public function hasStty(): bool;
public function setStty(string $config): void;

public function setStty(
string $config
): void;

public function getShellWidth(): int;
public function getShellHeight(): int;
Expand Down
5 changes: 3 additions & 2 deletions src/Terminus/Adapter/Unix.php → src/Adapter/Unix.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ public function hasStty(): bool
/**
* Set stty config
*/
public function setStty(string $config): void
{
public function setStty(
string $config
): void {
system('stty \'' . $config . '\'');
}

Expand Down
5 changes: 3 additions & 2 deletions src/Terminus/AdapterAbstract.php → src/AdapterAbstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ abstract class AdapterAbstract implements Adapter
/**
* Load for current OS
*/
public static function load(?string $name = null): Adapter
{
public static function load(
?string $name = null
): Adapter {
if ($name === null) {
$name = php_uname('s');

Expand Down
65 changes: 39 additions & 26 deletions src/Terminus/Command.php → src/Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ class Command extends Definition implements
/**
* @param Context $instance
*/
public static function loadAsVeneerPlugin(object $instance): static
{
public static function loadAsVeneerPlugin(
object $instance
): static {
/** @var static $output */
$output = new self($instance->getSession()->getRequest());
return $output;
Expand All @@ -50,8 +51,9 @@ public static function loadAsVeneerPlugin(object $instance): static
/**
* Init with Request
*/
public function __construct(Request $request)
{
public function __construct(
Request $request
) {
$this->setRequest($request);
}

Expand All @@ -61,8 +63,9 @@ public function __construct(Request $request)
*
* @return $this
*/
public function setRequest(Request $request): static
{
public function setRequest(
Request $request
): static {
$this->request = $request;

if (null === ($name = $request->getScript())) {
Expand Down Expand Up @@ -104,8 +107,9 @@ public function addArgument(
*
* @return $this
*/
public function setArgument(Argument $arg): static
{
public function setArgument(
Argument $arg
): static {
$this->values = null;
return parent::setArgument($arg);
}
Expand All @@ -115,8 +119,9 @@ public function setArgument(Argument $arg): static
*
* @return $this
*/
public function removeArgument(string $name): static
{
public function removeArgument(
string $name
): static {
$this->values = null;
return parent::removeArgument($name);
}
Expand Down Expand Up @@ -153,8 +158,9 @@ public function prepare(): array
*
* @return bool|string|array<bool|string>|null
*/
public function get(string $name): bool|string|array|null
{
public function get(
string $name
): bool|string|array|null {
if ($this->values === null) {
$this->prepare();
}
Expand All @@ -165,16 +171,18 @@ public function get(string $name): bool|string|array|null
/**
* Get argument as string
*/
public function getString(string $name): string
{
public function getString(
string $name
): string {
return Coercion::forceString($this->get($name));
}

/**
* Get argument as bool
*/
public function getBool(string $name): bool
{
public function getBool(
string $name
): bool {
return Coercion::toBool($this->get($name));
}

Expand All @@ -183,8 +191,9 @@ public function getBool(string $name): bool
*
* @return array<string|bool>
*/
public function getList(string $name): array
{
public function getList(
string $name
): array {
$value = $this->get($name);

if ($value === null) {
Expand All @@ -201,8 +210,9 @@ public function getList(string $name): array
/**
* Has argument
*/
public function has(string $name): bool
{
public function has(
string $name
): bool {
if ($this->values === null) {
$this->prepare();
}
Expand Down Expand Up @@ -286,8 +296,9 @@ public function offsetSet(
* @param string $name
* @return bool|string|array<bool|string>|null
*/
public function offsetGet(mixed $name): bool|string|array|null
{
public function offsetGet(
mixed $name
): bool|string|array|null {
if ($this->values === null) {
$this->prepare();
}
Expand All @@ -300,8 +311,9 @@ public function offsetGet(mixed $name): bool|string|array|null
*
* @param string $name
*/
public function offsetExists(mixed $name): bool
{
public function offsetExists(
mixed $name
): bool {
if ($this->values === null) {
$this->prepare();
}
Expand All @@ -314,8 +326,9 @@ public function offsetExists(mixed $name): bool
*
* @param string $name
*/
public function offsetUnset(mixed $name): void
{
public function offsetUnset(
mixed $name
): void {
if ($this->values === null) {
$this->prepare();
}
Expand Down
45 changes: 27 additions & 18 deletions src/Terminus/Command/Argument.php → src/Command/Argument.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,9 @@ public function getName(): string
*
* @return $this
*/
public function setDescription(string $description): static
{
public function setDescription(
string $description
): static {
$this->description = $description;
return $this;
}
Expand All @@ -103,8 +104,9 @@ public function getDescription(): string
*
* @return $this
*/
public function setNamed(bool $named): static
{
public function setNamed(
bool $named
): static {
$this->named = $named;
return $this;
}
Expand All @@ -124,8 +126,9 @@ public function isNamed(): bool
*
* @return $this
*/
public function setShortcut(?string $shortcut): static
{
public function setShortcut(
?string $shortcut
): static {
if ($shortcut !== null) {
$shortcut = substr($shortcut, 0, 1);
}
Expand All @@ -149,8 +152,9 @@ public function getShortcut(): ?string
*
* @return $this
*/
public function setBoolean(bool $boolean): static
{
public function setBoolean(
bool $boolean
): static {
if ($boolean) {
$this->defaultValue = null;
$this->optional = true;
Expand All @@ -176,8 +180,9 @@ public function isBoolean(): bool
*
* @return $this
*/
public function setOptional(bool $optional): static
{
public function setOptional(
bool $optional
): static {
$this->optional = $optional;

if (!$optional) {
Expand All @@ -201,8 +206,9 @@ public function isOptional(): bool
*
* @return $this
*/
public function setList(bool $list): static
{
public function setList(
bool $list
): static {
if ($list) {
$this->setBoolean(false);
}
Expand All @@ -225,8 +231,9 @@ public function isList(): bool
*
* @return $this
*/
public function setDefaultValue(?string $value): static
{
public function setDefaultValue(
?string $value
): static {
if (empty($value)) {
$value = null;
}
Expand All @@ -250,8 +257,9 @@ public function getDefaultValue(): ?string
*
* @return $this
*/
public function setPattern(?string $pattern): static
{
public function setPattern(
?string $pattern
): static {
$this->pattern = $pattern;
return $this;
}
Expand All @@ -268,8 +276,9 @@ public function getPattern(): ?string
/**
* Check and normalize input value
*/
public function validate(mixed $value): bool|string|null
{
public function validate(
mixed $value
): bool|string|null {
if ($this->boolean) {
if (is_string($value)) {
$value = Session::stringToBoolean($value);
Expand Down
Loading

0 comments on commit f4f0969

Please sign in to comment.