Skip to content

Commit 8dfe66d

Browse files
authored
Drop PHP 7.4 support (#39)
1 parent 3b01cb8 commit 8dfe66d

19 files changed

+40
-100
lines changed

.github/workflows/ci.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
runs-on: ubuntu-20.04
1111
strategy:
1212
matrix:
13-
php-version: [7.4]
13+
php-version: [8.0]
1414
steps:
1515
- uses: actions/checkout@v2
1616
- uses: shivammathur/setup-php@v2
@@ -40,7 +40,7 @@ jobs:
4040
runs-on: ubuntu-20.04
4141
strategy:
4242
matrix:
43-
php-version: [7.4]
43+
php-version: [8.0]
4444
steps:
4545
- uses: actions/checkout@v2
4646
- uses: shivammathur/setup-php@v2
@@ -70,7 +70,7 @@ jobs:
7070
runs-on: ubuntu-20.04
7171
strategy:
7272
matrix:
73-
php-version: [7.4, 8.0]
73+
php-version: [8.0]
7474
dependencies: ["", --prefer-lowest]
7575

7676
steps:
@@ -105,7 +105,7 @@ jobs:
105105
runs-on: ubuntu-20.04
106106
strategy:
107107
matrix:
108-
php-version: [7.4]
108+
php-version: [8.0]
109109

110110
steps:
111111
- uses: actions/checkout@v2

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"sort-packages": true
1717
},
1818
"require": {
19-
"php": "^7.4 || ^8.0",
19+
"php": "^8.0",
2020
"psr/log": "^1.1 || ^2 || ^3"
2121
},
2222
"suggest": {
@@ -43,7 +43,7 @@
4343
"psr/http-message": "^1.0",
4444
"simpod/php-coveralls-mirror": "^3.0",
4545
"squizlabs/php_codesniffer": "^3.5",
46-
"symfony/process": "^5.0 || ^6.0",
46+
"symfony/process": "^6.0",
4747
"thecodingmachine/phpstan-safe-rule": "^1.0"
4848
},
4949
"autoload": {

phpcs.xml.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<!-- Ignore warnings, show progress of the run and show sniff names -->
1010
<arg value="nps" />
1111

12-
<config name="php_version" value="70400" />
12+
<config name="php_version" value="80000" />
1313

1414
<file>src</file>
1515
<file>tests</file>

src/Exception/EndOfMibReached.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
final class EndOfMibReached extends RequestException
1212
{
13-
public static function new(?Throwable $previous = null): self
13+
public static function new(Throwable|null $previous = null): self
1414
{
1515
return new self('No more variables left in this MIB View (It is past the end of the MIB tree)', 0, $previous);
1616
}

src/Exception/GeneralException.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@
1212
// phpcs:ignore SlevomatCodingStandard.Classes.SuperfluousExceptionNaming.SuperfluousSuffix
1313
final class GeneralException extends RuntimeException implements SnmpException
1414
{
15-
public ?string $host = null;
15+
public string|null $host = null;
1616

17-
public ?string $oids = null;
17+
public string|null $oids = null;
1818

1919
/** @param list<string> $oids */
2020
public static function new(
2121
string $error,
22-
?Throwable $previous = null,
23-
?string $host = null,
24-
?array $oids = null
22+
Throwable|null $previous = null,
23+
string|null $host = null,
24+
array|null $oids = null,
2525
): self {
2626
$self = new self($error, 0, $previous);
2727
$self->host = $host;
@@ -33,7 +33,7 @@ public static function new(
3333
}
3434

3535
/** @param list<string> $oids */
36-
public static function fromThrowable(Throwable $throwable, ?string $host = null, ?array $oids = null): self
36+
public static function fromThrowable(Throwable $throwable, string|null $host = null, array|null $oids = null): self
3737
{
3838
return self::new($throwable->getMessage(), $throwable, $host, $oids);
3939
}

src/Exception/NoSuchInstanceExists.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public static function fromThrowable(string $host, Throwable $throwable): self
3333
return $self;
3434
}
3535

36-
private static function new(?Throwable $previous = null): self
36+
private static function new(Throwable|null $previous = null): self
3737
{
3838
return new self('No Such Instance currently exists at this OID', 0, $previous);
3939
}

src/Exception/NoSuchObjectExists.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public static function fromThrowable(string $host, Throwable $throwable): self
3333
return $self;
3434
}
3535

36-
private static function new(?Throwable $previous = null): self
36+
private static function new(Throwable|null $previous = null): self
3737
{
3838
return new self('No Such Object available on this agent at this OID', 0, $previous);
3939
}

src/Exception/RequestException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ abstract class RequestException extends RuntimeException implements SnmpExceptio
1010
{
1111
public string $host;
1212

13-
public ?string $oids = null;
13+
public string|null $oids = null;
1414
}

src/Helpers/ValueGetter.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,11 @@ final class ValueGetter
1818
* @param array<int|string, mixed> $response
1919
* @psalm-param array<int|string, T> $response
2020
*
21-
* @return mixed
2221
* @psalm-return T
2322
*
2423
* @psalm-template T
2524
*/
26-
public static function first(array $response)
25+
public static function first(array $response): mixed
2726
{
2827
$result = array_shift($response);
2928
if ($result === null) {
@@ -33,8 +32,7 @@ public static function first(array $response)
3332
return $result;
3433
}
3534

36-
/** @return mixed */
37-
public static function firstFromSameTree(SnmpClient $snmpClient, string $oid)
35+
public static function firstFromSameTree(SnmpClient $snmpClient, string $oid): mixed
3836
{
3937
return self::firstFromSameTrees($snmpClient, [$oid])[0];
4038
}

src/Transport/ApiSnmpClient.php

Lines changed: 9 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -32,44 +32,17 @@ final class ApiSnmpClient implements SnmpClient
3232
{
3333
private const API_PATH = '/snmp-proxy';
3434

35-
private ClientInterface $client;
36-
37-
private RequestFactoryInterface $requestFactory;
38-
39-
private StreamFactoryInterface $streamFactory;
40-
41-
private string $apiHostUrl;
42-
43-
private string $host;
44-
45-
private string $community;
46-
47-
private int $timeout;
48-
49-
private int $retries;
50-
51-
private string $version;
52-
5335
public function __construct(
54-
ClientInterface $client,
55-
RequestFactoryInterface $requestFactory,
56-
StreamFactoryInterface $streamFactory,
57-
string $apiHostUrl,
58-
string $host = '127.0.0.1',
59-
string $community = 'public',
60-
int $timeout = 1,
61-
int $retries = 3,
62-
string $version = '2c'
36+
private ClientInterface $client,
37+
private RequestFactoryInterface $requestFactory,
38+
private StreamFactoryInterface $streamFactory,
39+
private string $apiHostUrl,
40+
private string $host = '127.0.0.1',
41+
private string $community = 'public',
42+
private int $timeout = 1,
43+
private int $retries = 3,
44+
private string $version = '2c',
6345
) {
64-
$this->client = $client;
65-
$this->requestFactory = $requestFactory;
66-
$this->streamFactory = $streamFactory;
67-
$this->apiHostUrl = $apiHostUrl;
68-
$this->host = $host;
69-
$this->community = $community;
70-
$this->timeout = $timeout;
71-
$this->retries = $retries;
72-
$this->version = $version;
7346
}
7447

7548
/** @inheritDoc */

0 commit comments

Comments
 (0)