Skip to content

chore(deps): update dependencies to latest versions #14

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

Merged
merged 2 commits into from
Mar 31, 2025
Merged
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
13 changes: 8 additions & 5 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
git config --global core.eol lf

- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand All @@ -26,7 +26,7 @@ jobs:
coverage: none

- name: Install PHP dependencies
uses: ramsey/composer-install@v1
uses: ramsey/composer-install@v3
with:
dependency-versions: highest
composer-options: "--prefer-dist"
Expand All @@ -45,16 +45,19 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
coverage: none

- name: Install Dependencies
run: composer update --prefer-stable --no-interaction --prefer-dist --no-progress --ansi
- name: Install PHP dependencies
uses: ramsey/composer-install@v3
with:
dependency-versions: highest
composer-options: "--prefer-dist"

- name: Run PHPStan
run: vendor/bin/phpstan analyse --no-progress --ansi
11 changes: 7 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
php: ['8.1', '8.2']
dependency-version: [prefer-lowest, prefer-stable]
php: ['8.4', '8.3', '8.2']
dependency-version: [highest, lowest]

name: PHP ${{ matrix.php }} - ${{ matrix.os }} - ${{ matrix.dependency-version }}

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand All @@ -29,7 +29,10 @@ jobs:
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

- name: Install PHP dependencies
run: composer update --${{ matrix.dependency-version }} --no-interaction --no-progress --ansi
uses: ramsey/composer-install@v3
with:
dependency-versions: ${{ matrix.dependency-version }}
composer-options: --prefer-dist

- name: Unit Tests
run: ./vendor/bin/phpunit --colors=always
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
}
],
"require": {
"php": "^8.1"
"php": "^8.2"
},
"require-dev": {
"ext-json": "*",
"laravel/pint": "^1.15.1",
"phpstan/phpstan": "^1.10.67",
"phpunit/phpunit": "^9.6.19"
"laravel/pint": "^1.21",
"phpstan/phpstan": "^2.0",
"phpunit/phpunit": "^11.0"
},
"autoload": {
"psr-4": { "Humbug\\SelfUpdate\\": "src/" }
Expand Down
19 changes: 19 additions & 0 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
parameters:
ignoreErrors:
-
message: '#^Method Humbug\\SelfUpdate\\Strategy\\Sha256Strategy\:\:getCurrentRemoteVersion\(\) never returns bool so it can be removed from the return type\.$#'
identifier: return.unusedType
count: 1
path: src/Strategy/Sha256Strategy.php

-
message: '#^Method Humbug\\SelfUpdate\\Strategy\\Sha512Strategy\:\:getCurrentRemoteVersion\(\) never returns bool so it can be removed from the return type\.$#'
identifier: return.unusedType
count: 1
path: src/Strategy/Sha512Strategy.php

-
message: '#^Call to function is_bool\(\) with bool will always evaluate to true\.$#'
identifier: function.alreadyNarrowedType
count: 1
path: src/Updater.php
7 changes: 3 additions & 4 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
includes:
- phpstan-baseline.neon

parameters:
level: 5
paths:
- src/

checkMissingIterableValueType: true
checkGenericClassInNonGenericObjectType: false
reportUnmatchedIgnoredErrors: true
5 changes: 2 additions & 3 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
colors="true"
verbose="true"
bootstrap="tests/bootstrap.php">
<testsuites>
<testsuite name="Phar-Updater Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<coverage processUncoveredFiles="true">
<source>
<include>
<directory suffix=".php">src</directory>
</include>
</coverage>
</source>
</phpunit>
5 changes: 2 additions & 3 deletions src/Exception/ExceptionInterface.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* Humbug.
*
Expand All @@ -10,6 +11,4 @@

namespace Humbug\SelfUpdate\Exception;

interface ExceptionInterface
{
}
interface ExceptionInterface {}
5 changes: 2 additions & 3 deletions src/Exception/FilesystemException.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* Humbug.
*
Expand All @@ -10,6 +11,4 @@

namespace Humbug\SelfUpdate\Exception;

class FilesystemException extends RuntimeException
{
}
class FilesystemException extends RuntimeException {}
5 changes: 2 additions & 3 deletions src/Exception/HttpRequestException.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* Humbug.
*
Expand All @@ -10,6 +11,4 @@

namespace Humbug\SelfUpdate\Exception;

class HttpRequestException extends RuntimeException
{
}
class HttpRequestException extends RuntimeException {}
5 changes: 2 additions & 3 deletions src/Exception/InvalidArgumentException.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* Humbug.
*
Expand All @@ -10,6 +11,4 @@

namespace Humbug\SelfUpdate\Exception;

class InvalidArgumentException extends \RuntimeException implements ExceptionInterface
{
}
class InvalidArgumentException extends \RuntimeException implements ExceptionInterface {}
5 changes: 2 additions & 3 deletions src/Exception/JsonParsingException.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* Humbug.
*
Expand All @@ -10,6 +11,4 @@

namespace Humbug\SelfUpdate\Exception;

class JsonParsingException extends RuntimeException
{
}
class JsonParsingException extends RuntimeException {}
5 changes: 2 additions & 3 deletions src/Exception/NoSignatureException.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* Humbug.
*
Expand All @@ -10,6 +11,4 @@

namespace Humbug\SelfUpdate\Exception;

class NoSignatureException extends RuntimeException
{
}
class NoSignatureException extends RuntimeException {}
5 changes: 2 additions & 3 deletions src/Exception/RuntimeException.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* Humbug.
*
Expand All @@ -10,6 +11,4 @@

namespace Humbug\SelfUpdate\Exception;

class RuntimeException extends \RuntimeException implements ExceptionInterface
{
}
class RuntimeException extends \RuntimeException implements ExceptionInterface {}
2 changes: 1 addition & 1 deletion src/Strategy/DirectDownloadStrategyAbstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public function download(Updater $updater)
set_error_handler([$updater, 'throwHttpRequestException']);
$result = file_get_contents($this->getDownloadUrl());
restore_error_handler();
if (false === $result) {
if ($result === false) {
throw new HttpRequestException(sprintf(
'Request to URL failed: %s',
$this->getDownloadUrl()
Expand Down
23 changes: 6 additions & 17 deletions src/Strategy/GithubStrategy.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* Humbug.
*
Expand Down Expand Up @@ -60,18 +61,14 @@ class GithubStrategy implements StrategyInterface
*/
private $stability = self::STABLE;

/**
* Download the remote Phar file.
*
* @return void
*/
/** {@inheritdoc} */
public function download(Updater $updater)
{
/** Switch remote request errors to HttpRequestExceptions */
set_error_handler([$updater, 'throwHttpRequestException']);
$result = file_get_contents($this->remoteUrl);
restore_error_handler();
if (false === $result) {
if ($result === false) {
throw new HttpRequestException(sprintf(
'Request to URL failed: %s',
$this->remoteUrl
Expand All @@ -81,11 +78,7 @@ public function download(Updater $updater)
file_put_contents($updater->getTempPharFile(), $result);
}

/**
* Retrieve the current version available remotely.
*
* @return string|bool
*/
/** {@inheritdoc} */
public function getCurrentRemoteVersion(Updater $updater)
{
/** Switch remote request errors to HttpRequestExceptions */
Expand All @@ -94,7 +87,7 @@ public function getCurrentRemoteVersion(Updater $updater)
$package = json_decode(file_get_contents($packageUrl), true);
restore_error_handler();

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

/**
* Retrieve the current version of the local phar file.
*
* @return string
*/
/** {@inheritdoc} */
public function getCurrentLocalVersion(Updater $updater)
{
return $this->localVersion;
Expand Down
15 changes: 4 additions & 11 deletions src/Strategy/Sha256Strategy.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* Humbug.
*
Expand All @@ -19,18 +20,14 @@

final class Sha256Strategy extends ShaStrategyAbstract
{
/**
* Retrieve the current version available remotely.
*
* @return string|bool
*/
/** {@inheritdoc} */
public function getCurrentRemoteVersion(Updater $updater)
{
/** Switch remote request errors to HttpRequestExceptions */
set_error_handler([$updater, 'throwHttpRequestException']);
$version = file_get_contents($this->getVersionUrl());
restore_error_handler();
if (false === $version) {
if ($version === false) {
throw new HttpRequestException(sprintf(
'Request to URL failed: %s',
$this->getVersionUrl()
Expand All @@ -50,11 +47,7 @@ public function getCurrentRemoteVersion(Updater $updater)
return $matches[0];
}

/**
* Retrieve the current version of the local phar file.
*
* @return string
*/
/** {@inheritdoc} */
public function getCurrentLocalVersion(Updater $updater)
{
return hash_file('sha256', $updater->getLocalPharFile());
Expand Down
14 changes: 3 additions & 11 deletions src/Strategy/Sha512Strategy.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,14 @@

final class Sha512Strategy extends ShaStrategyAbstract
{
/**
* Retrieve the current version available remotely.
*
* @return string|bool
*/
/** {@inheritdoc} */
public function getCurrentRemoteVersion(Updater $updater)
{
/** Switch remote request errors to HttpRequestExceptions */
set_error_handler([$updater, 'throwHttpRequestException']);
$version = file_get_contents($this->getVersionUrl());
restore_error_handler();
if (false === $version) {
if ($version === false) {
throw new HttpRequestException(sprintf(
'Request to URL failed: %s',
$this->getVersionUrl()
Expand All @@ -40,11 +36,7 @@ public function getCurrentRemoteVersion(Updater $updater)
return $matches[0];
}

/**
* Retrieve the current version of the local phar file.
*
* @return string
*/
/** {@inheritdoc} */
public function getCurrentLocalVersion(Updater $updater)
{
return hash_file('sha512', $updater->getLocalPharFile());
Expand Down
Loading
Loading