Skip to content

Add support for Laravel 10 #31

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 7 commits into from
May 8, 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
11 changes: 8 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,24 @@ on:

jobs:
run-tests:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04

strategy:
fail-fast: false
matrix:
php: [ 8.0, 8.1 ]
laravel: [ 8.*, 9.* ]
php: [ 8.0, 8.1, 8.2 ]
laravel: [ 8.*, 9.*, 10.* ]
stability: [ prefer-stable ]
include:
- laravel: 8.*
testbench: ^6.23
- laravel: 9.*
testbench: 7.*
- laravel: 10.*
testbench: 8.*
exclude:
- php: 8.0
laravel: 10.*

name: PHP ${{ matrix.php }} - L${{ matrix.laravel }}
env:
Expand Down
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@
}
],
"require": {
"php": "^8.0||^8.1||^8.2",
"laravel/framework": "^8.0||^9.0"
"php": "^8.0||^8.1||^8.2||^8.3",
"laravel/framework": "^8.0||^9.0||^10.0"
},
"require-dev": {
"orchestra/testbench": "^6.0",
"phpunit/phpunit": "^9.5",
"orchestra/testbench": "^6.0||^7.0||^8.0",
"phpunit/phpunit": "^9.5||^10.0",
"vimeo/psalm": "^4.4 || ^5.0",
"phpstan/phpstan": "^1.4",
"phpstan/phpstan": "^1.4||^2.0",
"squizlabs/php_codesniffer": "^3.6",
"mockery/mockery": "^1.4.3"
},
Expand Down
2 changes: 1 addition & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ parameters:
- src
level: 8
inferPrivatePropertyTypeFromConstructor: true
checkMissingIterableValueType: false
bootstrapFiles:
- openssl_constants.php
reportUnmatchedIgnoredErrors: false
ignoreErrors:
- identifier: missingType.iterableValue
- '#Function openssl_cms_sign not found.#'
- '#Function openssl_cms_verify not found.#'

8 changes: 8 additions & 0 deletions src/Exceptions/FileException.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,12 @@ public static function cannotReadFile(string $path): FileException
{
return new self(sprintf("Error while reading %s: file is not readable by user (try chmod 644)", $path));
}

/**
* @return FileException
*/
public static function cannotGetTempFilePath(): FileException
{
return new self("cannot get the temp file path");
}
}
5 changes: 3 additions & 2 deletions src/Service/Cms/ProcessSpawnService.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,9 @@ public function decrypt(string $cipherText): string
}

$args = [
'openssl', 'cms', '-decrypt', '-inform', 'PEM', '-inkey',
$this->decryptionCertKeyPath, $this->decryptionCertPath
'openssl', 'cms', '-decrypt', '-inform', 'PEM',
'-inkey', $this->decryptionCertKeyPath,
'-recip', $this->decryptionCertPath
];
$process = new Process($args);
$process->setInput($cipherText);
Expand Down
4 changes: 2 additions & 2 deletions src/Service/Sealbox/SealboxService.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ public function encrypt(string $plainText): string
public function decrypt(string $cipherText): string
{
if (! $this->recipientPubKey) {
CryptoException::encrypt("no recipient public key provided");
throw CryptoException::encrypt("no recipient public key provided");
}
if (! $this->privKey) {
CryptoException::encrypt("no private key provided");
throw CryptoException::encrypt("no private key provided");
}

try {
Expand Down
7 changes: 6 additions & 1 deletion src/Service/TempFileService.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@ public function getTempFilePath($resource): string
throw FileException::variableIsNotAResource();
}

return stream_get_meta_data($resource)['uri'];
$metadata = stream_get_meta_data($resource);
if (!isset($metadata['uri'])) {
throw FileException::cannotGetTempFilePath();
}

return $metadata['uri'];
}

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/FactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class FactoryTest extends TestCase
protected const TEST_PRIVKEY = '/BmJGKHzacb8/aZYl5d1dwjJd7kcv6SLxux7A8Ld5Hk=';
protected const TEST_PUBKEY = 'iUDWI5RkuUVQQAaC4BoYFdZXP7Lod6RTL9orQeuRzxE=';

public function boolProvider()
public function boolProvider(): array
{
return array(
array(true),
Expand Down