Skip to content

Commit 3eb9b0d

Browse files
committed
chore(deps): update dependencies to latest versions
1 parent 680bcba commit 3eb9b0d

26 files changed

+159
-182
lines changed

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@
1717
}
1818
],
1919
"require": {
20-
"php": "^8.1"
20+
"php": "^8.2"
2121
},
2222
"require-dev": {
2323
"ext-json": "*",
24-
"laravel/pint": "^1.15.1",
25-
"phpstan/phpstan": "^1.10.67",
26-
"phpunit/phpunit": "^9.6.19"
24+
"laravel/pint": "^1.21",
25+
"phpstan/phpstan": "^2.0",
26+
"phpunit/phpunit": "^11.0"
2727
},
2828
"autoload": {
2929
"psr-4": { "Humbug\\SelfUpdate\\": "src/" }

phpstan-baseline.neon

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
parameters:
2+
ignoreErrors:
3+
-
4+
message: '#^Method Humbug\\SelfUpdate\\Strategy\\Sha256Strategy\:\:getCurrentRemoteVersion\(\) never returns bool so it can be removed from the return type\.$#'
5+
identifier: return.unusedType
6+
count: 1
7+
path: src/Strategy/Sha256Strategy.php
8+
9+
-
10+
message: '#^Method Humbug\\SelfUpdate\\Strategy\\Sha512Strategy\:\:getCurrentRemoteVersion\(\) never returns bool so it can be removed from the return type\.$#'
11+
identifier: return.unusedType
12+
count: 1
13+
path: src/Strategy/Sha512Strategy.php
14+
15+
-
16+
message: '#^Call to function is_bool\(\) with bool will always evaluate to true\.$#'
17+
identifier: function.alreadyNarrowedType
18+
count: 1
19+
path: src/Updater.php

phpstan.neon.dist

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1+
includes:
2+
- phpstan-baseline.neon
3+
14
parameters:
25
level: 5
36
paths:
47
- src/
5-
6-
checkMissingIterableValueType: true
7-
checkGenericClassInNonGenericObjectType: false
8-
reportUnmatchedIgnoredErrors: true

phpunit.xml.dist

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,15 @@
33
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
55
colors="true"
6-
verbose="true"
76
bootstrap="tests/bootstrap.php">
87
<testsuites>
98
<testsuite name="Phar-Updater Test Suite">
109
<directory>tests</directory>
1110
</testsuite>
1211
</testsuites>
13-
<coverage processUncoveredFiles="true">
12+
<source>
1413
<include>
1514
<directory suffix=".php">src</directory>
1615
</include>
17-
</coverage>
16+
</source>
1817
</phpunit>

src/Exception/ExceptionInterface.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* Humbug.
45
*
@@ -10,6 +11,4 @@
1011

1112
namespace Humbug\SelfUpdate\Exception;
1213

13-
interface ExceptionInterface
14-
{
15-
}
14+
interface ExceptionInterface {}

src/Exception/FilesystemException.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* Humbug.
45
*
@@ -10,6 +11,4 @@
1011

1112
namespace Humbug\SelfUpdate\Exception;
1213

13-
class FilesystemException extends RuntimeException
14-
{
15-
}
14+
class FilesystemException extends RuntimeException {}

src/Exception/HttpRequestException.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* Humbug.
45
*
@@ -10,6 +11,4 @@
1011

1112
namespace Humbug\SelfUpdate\Exception;
1213

13-
class HttpRequestException extends RuntimeException
14-
{
15-
}
14+
class HttpRequestException extends RuntimeException {}

src/Exception/InvalidArgumentException.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* Humbug.
45
*
@@ -10,6 +11,4 @@
1011

1112
namespace Humbug\SelfUpdate\Exception;
1213

13-
class InvalidArgumentException extends \RuntimeException implements ExceptionInterface
14-
{
15-
}
14+
class InvalidArgumentException extends \RuntimeException implements ExceptionInterface {}

src/Exception/JsonParsingException.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* Humbug.
45
*
@@ -10,6 +11,4 @@
1011

1112
namespace Humbug\SelfUpdate\Exception;
1213

13-
class JsonParsingException extends RuntimeException
14-
{
15-
}
14+
class JsonParsingException extends RuntimeException {}

src/Exception/NoSignatureException.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* Humbug.
45
*
@@ -10,6 +11,4 @@
1011

1112
namespace Humbug\SelfUpdate\Exception;
1213

13-
class NoSignatureException extends RuntimeException
14-
{
15-
}
14+
class NoSignatureException extends RuntimeException {}

src/Exception/RuntimeException.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* Humbug.
45
*
@@ -10,6 +11,4 @@
1011

1112
namespace Humbug\SelfUpdate\Exception;
1213

13-
class RuntimeException extends \RuntimeException implements ExceptionInterface
14-
{
15-
}
14+
class RuntimeException extends \RuntimeException implements ExceptionInterface {}

src/Strategy/DirectDownloadStrategyAbstract.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public function download(Updater $updater)
1818
set_error_handler([$updater, 'throwHttpRequestException']);
1919
$result = file_get_contents($this->getDownloadUrl());
2020
restore_error_handler();
21-
if (false === $result) {
21+
if ($result === false) {
2222
throw new HttpRequestException(sprintf(
2323
'Request to URL failed: %s',
2424
$this->getDownloadUrl()

src/Strategy/GithubStrategy.php

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* Humbug.
45
*
@@ -60,18 +61,14 @@ class GithubStrategy implements StrategyInterface
6061
*/
6162
private $stability = self::STABLE;
6263

63-
/**
64-
* Download the remote Phar file.
65-
*
66-
* @return void
67-
*/
64+
/** {@inheritdoc} */
6865
public function download(Updater $updater)
6966
{
7067
/** Switch remote request errors to HttpRequestExceptions */
7168
set_error_handler([$updater, 'throwHttpRequestException']);
7269
$result = file_get_contents($this->remoteUrl);
7370
restore_error_handler();
74-
if (false === $result) {
71+
if ($result === false) {
7572
throw new HttpRequestException(sprintf(
7673
'Request to URL failed: %s',
7774
$this->remoteUrl
@@ -81,11 +78,7 @@ public function download(Updater $updater)
8178
file_put_contents($updater->getTempPharFile(), $result);
8279
}
8380

84-
/**
85-
* Retrieve the current version available remotely.
86-
*
87-
* @return string|bool
88-
*/
81+
/** {@inheritdoc} */
8982
public function getCurrentRemoteVersion(Updater $updater)
9083
{
9184
/** Switch remote request errors to HttpRequestExceptions */
@@ -94,7 +87,7 @@ public function getCurrentRemoteVersion(Updater $updater)
9487
$package = json_decode(file_get_contents($packageUrl), true);
9588
restore_error_handler();
9689

97-
if (null === $package || json_last_error() !== JSON_ERROR_NONE) {
90+
if ($package === null || json_last_error() !== JSON_ERROR_NONE) {
9891
throw new JsonParsingException(
9992
'Error parsing JSON package data'
10093
.(function_exists('json_last_error_msg') ? ': '.json_last_error_msg() : '')
@@ -126,11 +119,7 @@ public function getCurrentRemoteVersion(Updater $updater)
126119
return $this->remoteVersion;
127120
}
128121

129-
/**
130-
* Retrieve the current version of the local phar file.
131-
*
132-
* @return string
133-
*/
122+
/** {@inheritdoc} */
134123
public function getCurrentLocalVersion(Updater $updater)
135124
{
136125
return $this->localVersion;

src/Strategy/Sha256Strategy.php

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* Humbug.
45
*
@@ -19,18 +20,14 @@
1920

2021
final class Sha256Strategy extends ShaStrategyAbstract
2122
{
22-
/**
23-
* Retrieve the current version available remotely.
24-
*
25-
* @return string|bool
26-
*/
23+
/** {@inheritdoc} */
2724
public function getCurrentRemoteVersion(Updater $updater)
2825
{
2926
/** Switch remote request errors to HttpRequestExceptions */
3027
set_error_handler([$updater, 'throwHttpRequestException']);
3128
$version = file_get_contents($this->getVersionUrl());
3229
restore_error_handler();
33-
if (false === $version) {
30+
if ($version === false) {
3431
throw new HttpRequestException(sprintf(
3532
'Request to URL failed: %s',
3633
$this->getVersionUrl()
@@ -50,11 +47,7 @@ public function getCurrentRemoteVersion(Updater $updater)
5047
return $matches[0];
5148
}
5249

53-
/**
54-
* Retrieve the current version of the local phar file.
55-
*
56-
* @return string
57-
*/
50+
/** {@inheritdoc} */
5851
public function getCurrentLocalVersion(Updater $updater)
5952
{
6053
return hash_file('sha256', $updater->getLocalPharFile());

src/Strategy/Sha512Strategy.php

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,14 @@
99

1010
final class Sha512Strategy extends ShaStrategyAbstract
1111
{
12-
/**
13-
* Retrieve the current version available remotely.
14-
*
15-
* @return string|bool
16-
*/
12+
/** {@inheritdoc} */
1713
public function getCurrentRemoteVersion(Updater $updater)
1814
{
1915
/** Switch remote request errors to HttpRequestExceptions */
2016
set_error_handler([$updater, 'throwHttpRequestException']);
2117
$version = file_get_contents($this->getVersionUrl());
2218
restore_error_handler();
23-
if (false === $version) {
19+
if ($version === false) {
2420
throw new HttpRequestException(sprintf(
2521
'Request to URL failed: %s',
2622
$this->getVersionUrl()
@@ -40,11 +36,7 @@ public function getCurrentRemoteVersion(Updater $updater)
4036
return $matches[0];
4137
}
4238

43-
/**
44-
* Retrieve the current version of the local phar file.
45-
*
46-
* @return string
47-
*/
39+
/** {@inheritdoc} */
4840
public function getCurrentLocalVersion(Updater $updater)
4941
{
5042
return hash_file('sha512', $updater->getLocalPharFile());

src/Strategy/ShaStrategy.php

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* Humbug.
45
*
@@ -22,18 +23,14 @@
2223
*/
2324
class ShaStrategy extends ShaStrategyAbstract
2425
{
25-
/**
26-
* Retrieve the current version available remotely.
27-
*
28-
* @return string|bool
29-
*/
26+
/** {@inheritdoc} */
3027
public function getCurrentRemoteVersion(Updater $updater)
3128
{
3229
/** Switch remote request errors to HttpRequestExceptions */
3330
set_error_handler([$updater, 'throwHttpRequestException']);
3431
$version = file_get_contents($this->getVersionUrl());
3532
restore_error_handler();
36-
if (false === $version) {
33+
if ($version === false) {
3734
throw new HttpRequestException(sprintf(
3835
'Request to URL failed: %s',
3936
$this->getVersionUrl()
@@ -53,11 +50,7 @@ public function getCurrentRemoteVersion(Updater $updater)
5350
return $matches[0];
5451
}
5552

56-
/**
57-
* Retrieve the current version of the local phar file.
58-
*
59-
* @return string
60-
*/
53+
/** {@inheritdoc} */
6154
public function getCurrentLocalVersion(Updater $updater)
6255
{
6356
return sha1_file($updater->getLocalPharFile());

src/Strategy/ShaStrategyAbstract.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* Humbug.
45
*
@@ -37,18 +38,14 @@ abstract class ShaStrategyAbstract implements StrategyInterface
3738
*/
3839
protected $pharUrl;
3940

40-
/**
41-
* Download the remote Phar file.
42-
*
43-
* @return void
44-
*/
41+
/** {@inheritdoc} */
4542
public function download(Updater $updater)
4643
{
4744
/** Switch remote request errors to HttpRequestExceptions */
4845
set_error_handler([$updater, 'throwHttpRequestException']);
4946
$result = file_get_contents($this->getPharUrl());
5047
restore_error_handler();
51-
if (false === $result) {
48+
if ($result === false) {
5249
throw new HttpRequestException(sprintf(
5350
'Request to URL failed: %s',
5451
$this->getPharUrl()

src/Strategy/StrategyInterface.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* Humbug.
45
*

0 commit comments

Comments
 (0)