Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use static as return type and remove unsupported php 7.4 #92

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
strategy:
fail-fast: true
matrix:
php: [8.2, 8.1, 8.0, 7.4]
php: [8.2, 8.1, 8.0]
dependency-version: [prefer-lowest, prefer-stable]

name: P${{ matrix.php }} - ${{ matrix.dependency-version }}
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
}
],
"require": {
"php": "^7.4|^8.0",
"php": "^8.0",
"symfony/process": "^4.4|^5.3|^6.0"
},
"require-dev": {
Expand Down
32 changes: 16 additions & 16 deletions src/Ssh.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,26 +39,26 @@ public function __construct(string $user, string $host, int $port = null)
$this->onOutput = fn ($type, $line) => null;
}

public static function create(...$args): self
public static function create(...$args): static
{
return new static(...$args);
}

public function usePrivateKey(string $pathToPrivateKey): self
public function usePrivateKey(string $pathToPrivateKey): static
{
$this->extraOptions['private_key'] = '-i ' . $pathToPrivateKey;

return $this;
}

public function useJumpHost(string $jumpHost): self
public function useJumpHost(string $jumpHost): static
{
$this->extraOptions['jump_host'] = '-J ' . $jumpHost;

return $this;
}

public function usePort(int $port): self
public function usePort(int $port): static
{
if ($port < 0) {
throw new Exception('Port must be a positive integer.');
Expand All @@ -68,84 +68,84 @@ public function usePort(int $port): self
return $this;
}

public function useMultiplexing(string $controlPath, string $controlPersist = '10m'): self
public function useMultiplexing(string $controlPath, string $controlPersist = '10m'): static
{
$this->extraOptions['control_master'] = '-o ControlMaster=auto -o ControlPath=' . $controlPath . ' -o ControlPersist=' . $controlPersist;

return $this;
}

public function configureProcess(Closure $processConfigurationClosure): self
public function configureProcess(Closure $processConfigurationClosure): static
{
$this->processConfigurationClosure = $processConfigurationClosure;

return $this;
}

public function onOutput(Closure $onOutput): self
public function onOutput(Closure $onOutput): static
{
$this->onOutput = $onOutput;

return $this;
}

public function enableStrictHostKeyChecking(): self
public function enableStrictHostKeyChecking(): static
{
unset($this->extraOptions['enable_strict_check']);

return $this;
}

public function setTimeout(int $timeout): self
public function setTimeout(int $timeout): static
{
$this->timeout = $timeout;

return $this;
}

public function disableStrictHostKeyChecking(): self
public function disableStrictHostKeyChecking(): static
{
$this->extraOptions['enable_strict_check'] = '-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null';

return $this;
}

public function enableQuietMode(): self
public function enableQuietMode(): static
{
$this->extraOptions['quiet'] = '-q';

return $this;
}

public function disableQuietMode(): self
public function disableQuietMode(): static
{
unset($this->extraOptions['quiet']);

return $this;
}

public function disablePasswordAuthentication(): self
public function disablePasswordAuthentication(): static
{
$this->extraOptions['password_authentication'] = '-o PasswordAuthentication=no';

return $this;
}

public function enablePasswordAuthentication(): self
public function enablePasswordAuthentication(): static
{
unset($this->extraOptions['password_authentication']);

return $this;
}

public function addExtraOption(string $option): self
public function addExtraOption(string $option): static
{
$this->extraOptions[] = $option;

return $this;
}

public function removeBash(): self
public function removeBash(): static
{
$this->addBash = false;

Expand Down