Skip to content

Commit 8846124

Browse files
Andreas Frömericanhazstring
authored andcommitted
Upgrade all the stuff
1 parent aa1e684 commit 8846124

27 files changed

+142
-105
lines changed

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Changelog
2+
3+
## [0.7.0] - 2020-02-16
4+
### Changed
5+
- Moved classes to different namespace (`SystemCtl` to `icanhazstring\Systemctl`)
6+
- Dropped support for PHP7.1
7+
- Dropped support for `symfony/process:^3.x`
8+
9+
### Added
10+
- Added `CHANGELOG.md` and `MIGRATION.md`
11+
- Added support for `symfony/process:^4.4 || ^5.0`
12+
- Added code quality tools
13+
14+
## Previous releases
15+
- No changelog available

MIGRATION.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Migration
2+
3+
## v0.6.x to 0.7.0
4+
The namespace `SystemCtl\` was moved to `icanhazstring\SystemCtl`.
5+
You can do a search/replace to move you implementation.

composer.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@
33
"description": "PHP wrapper for systemctl",
44
"type": "library",
55
"require": {
6-
"php": "^7.3",
6+
"php": "^7.2",
77
"symfony/process": "^4.4 || ^5.0"
88
},
99
"require-dev": {
1010
"phpunit/phpunit": "^9.0",
1111
"squizlabs/php_codesniffer": "^3.5",
1212
"codeclimate/php-test-reporter": "dev-master",
13-
"slevomat/coding-standard": "^6.1"
13+
"slevomat/coding-standard": "^6.1",
14+
"phpstan/phpstan": "^0.12.10"
1415
},
1516
"autoload": {
1617
"psr-4": {
@@ -30,6 +31,7 @@
3031
}
3132
],
3233
"scripts": {
34+
"analyse": "vendor/bin/phpstan --no-progress",
3335
"test": "vendor/bin/phpunit",
3436
"cs": "vendor/bin/phpcs"
3537
}

phpstan.neon

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
parameters:
2+
inferPrivatePropertyTypeFromConstructor: true
3+
4+
level: max
5+
paths:
6+
- src/

src/Command/CommandDispatcherInterface.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
<?php
22

3-
namespace SystemCtl\Command;
3+
namespace icanhazstring\SystemCtl\Command;
44

5-
use SystemCtl\Exception\CommandFailedException;
5+
use icanhazstring\SystemCtl\Exception\CommandFailedException;
66

77
/**
88
* Interface CommandDispatcherInterface
99
*
10-
* @package SystemCtl\Command
10+
* @package icanhazstring\SystemCtl\Command
1111
*/
1212
interface CommandDispatcherInterface
1313
{
1414
/**
15-
* Timeout after which the dispatcher failes the execution
15+
* Timeout after which the dispatcher fails the execution
1616
*
1717
* @param int $timeout
1818
*
@@ -33,7 +33,7 @@ public function setBinary(string $binary): CommandDispatcherInterface;
3333
* Dispatch given commands against implementers logic and creating a new command
3434
* to read results
3535
*
36-
* @param array $commands
36+
* @param array<int, string> $commands
3737
*
3838
* @return CommandInterface
3939
* @throws CommandFailedException

src/Command/CommandInterface.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<?php
22

3-
namespace SystemCtl\Command;
3+
namespace icanhazstring\SystemCtl\Command;
44

5-
use SystemCtl\Exception\CommandFailedException;
5+
use icanhazstring\SystemCtl\Exception\CommandFailedException;
66

77
/**
88
* Interface CommandInterface
99
*
10-
* @package SystemCtl\Command
10+
* @package icanhazstring\SystemCtl\Command
1111
* @author icanhazstring <[email protected]>
1212
*/
1313
interface CommandInterface

src/Command/SymfonyCommand.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
11
<?php
22

3-
namespace SystemCtl\Command;
3+
namespace icanhazstring\SystemCtl\Command;
44

55
use Symfony\Component\Process\Process;
6-
use SystemCtl\Exception\CommandFailedException;
6+
use icanhazstring\SystemCtl\Exception\CommandFailedException;
77

88
/**
99
* Class SymfonyCommand
1010
*
11-
* @package SystemCtl\Command
11+
* @package icanhazstring\SystemCtl\Command
1212
* @author icanhazstring <[email protected]>
1313
*/
1414
class SymfonyCommand implements CommandInterface
1515
{
16-
/** @var Process */
16+
/** @var Process<mixed> */
1717
private $process;
1818

19+
/**
20+
* @param Process<mixed> $process
21+
*/
1922
public function __construct(Process $process)
2023
{
2124
$this->process = $process;

src/Command/SymfonyCommandDispatcher.php

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
11
<?php
22

3-
namespace SystemCtl\Command;
3+
namespace icanhazstring\SystemCtl\Command;
44

5+
use Symfony\Component\Process\Process;
56
use Symfony\Component\Process\ProcessBuilder;
67

78
/**
89
* Class SymfonyCommandDispatcher
910
*
10-
* @package SystemCtl\Command
11+
* @package icanhazstring\SystemCtl\Command
1112
* @author icanhazstring <[email protected]>
1213
*/
1314
class SymfonyCommandDispatcher implements CommandDispatcherInterface
1415
{
16+
/** @var string */
1517
private $binary;
16-
private $timetout;
18+
/** @var int */
19+
private $timeout;
1720

1821
/**
1922
* @inheritdoc
@@ -30,7 +33,7 @@ public function setBinary(string $binary): CommandDispatcherInterface
3033
*/
3134
public function setTimeout(int $timeout): CommandDispatcherInterface
3235
{
33-
$this->timetout = $timeout;
36+
$this->timeout = $timeout;
3437

3538
return $this;
3639
}
@@ -40,12 +43,10 @@ public function setTimeout(int $timeout): CommandDispatcherInterface
4043
*/
4144
public function dispatch(...$commands): CommandInterface
4245
{
43-
$processBuilder = new ProcessBuilder();
44-
$processBuilder->setPrefix($this->binary);
45-
$processBuilder->setTimeout($this->timetout);
46-
$processBuilder->setArguments($commands);
46+
$process = new Process(array_merge([$this->binary], $commands));
47+
$process->setTimeout($this->timeout);
4748

48-
$process = new SymfonyCommand($processBuilder->getProcess());
49+
$process = new SymfonyCommand($process);
4950

5051
return $process->run();
5152
}

src/Exception/CommandFailedException.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<?php
22

3-
namespace SystemCtl\Exception;
3+
namespace icanhazstring\SystemCtl\Exception;
44

55
/**
66
* Class CommandFailedException
77
*
8-
* @package SystemCtl\Exception
8+
* @package icanhazstring\SystemCtl\Exception
99
*/
1010
class CommandFailedException extends \Exception
1111
{

src/Exception/ExceptionInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<?php
22

3-
namespace SystemCtl\Exception;
3+
namespace icanhazstring\SystemCtl\Exception;
44

55
use Throwable;
66

77
/**
88
* Interface ExceptionInterface
99
*
10-
* @package SystemCtl\Exception
10+
* @package icanhazstring\SystemCtl\Exception
1111
*/
1212
interface ExceptionInterface extends Throwable
1313
{

0 commit comments

Comments
 (0)