Skip to content

Commit 7c05908

Browse files
authored
Feature/php83 (#400)
* Restrict allowed attributes for scd * Bump minimum PHP-version * Add ext-intl + ext-sodium for composer-require-checker * Migrate code to PHP 8.3
1 parent a3fda04 commit 7c05908

File tree

232 files changed

+837
-1322
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

232 files changed

+837
-1322
lines changed

.github/workflows/php.yml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ jobs:
1919
strategy:
2020
fail-fast: false
2121
matrix:
22-
php-version: ['8.2', '8.3', '8.4']
22+
php-version: ['8.3', '8.4', '8.5']
2323

24-
uses: simplesamlphp/simplesamlphp-test-framework/.github/workflows/reusable_phplinter.yml@v1.10.6
24+
uses: simplesamlphp/simplesamlphp-test-framework/.github/workflows/reusable_phplinter.yml@v1.11.0
2525
with:
2626
php-version: ${{ matrix.php-version }}
2727

@@ -30,7 +30,7 @@ jobs:
3030
strategy:
3131
fail-fast: false
3232

33-
uses: simplesamlphp/simplesamlphp-test-framework/.github/workflows/reusable_linter.yml@v1.10.6
33+
uses: simplesamlphp/simplesamlphp-test-framework/.github/workflows/reusable_linter.yml@v1.11.0
3434
with:
3535
enable_eslinter: false
3636
enable_jsonlinter: true
@@ -45,15 +45,15 @@ jobs:
4545
fail-fast: false
4646
matrix:
4747
operating-system: [ubuntu-latest]
48-
php-versions: ['8.2', '8.3', '8.4']
48+
php-versions: ['8.3', '8.4', '8.5']
4949

5050
steps:
5151
- name: Setup PHP, with composer and extensions
5252
# https://github.com/shivammathur/setup-php
5353
uses: shivammathur/setup-php@v2
5454
with:
5555
php-version: ${{ matrix.php-versions }}
56-
extensions: ctype, date, dom, filter, hash, intl, mbstring, openssl, pcre, soap, spl, xml
56+
extensions: ctype, date, dom, filter, hash, intl, mbstring, openssl, pcre, soap, spl, sodium, xml
5757
tools: composer
5858
ini-values: error_reporting=E_ALL
5959
coverage: pcov
@@ -85,15 +85,15 @@ jobs:
8585
run: composer install --no-progress --prefer-dist --optimize-autoloader
8686

8787
- name: Run unit tests with coverage
88-
if: ${{ matrix.php-versions == '8.4' }}
88+
if: ${{ matrix.php-versions == '8.5' }}
8989
run: vendor/bin/phpunit
9090

9191
- name: Run unit tests (no coverage)
92-
if: ${{ matrix.php-versions != '8.4' }}
92+
if: ${{ matrix.php-versions != '8.5' }}
9393
run: vendor/bin/phpunit --no-coverage
9494

9595
- name: Save coverage data
96-
if: ${{ matrix.php-versions == '8.4' }}
96+
if: ${{ matrix.php-versions == '8.5' }}
9797
uses: actions/upload-artifact@v6
9898
with:
9999
name: coverage-data
@@ -107,15 +107,15 @@ jobs:
107107
fail-fast: true
108108
matrix:
109109
operating-system: [windows-latest]
110-
php-versions: ['8.2', '8.3', '8.4']
110+
php-versions: ['8.3', '8.4', '8.5']
111111

112112
steps:
113113
- name: Setup PHP, with composer and extensions
114114
# https://github.com/shivammathur/setup-php
115115
uses: shivammathur/setup-php@v2
116116
with:
117117
php-version: ${{ matrix.php-versions }}
118-
extensions: ctype, date, dom, filter, hash, intl, mbstring, openssl, pcre, soap, spl, xml
118+
extensions: ctype, date, dom, filter, hash, intl, mbstring, openssl, pcre, soap, sodium, spl, xml
119119
tools: composer
120120
ini-values: error_reporting=E_ALL
121121
coverage: none
@@ -161,9 +161,9 @@ jobs:
161161
uses: shivammathur/setup-php@v2
162162
with:
163163
# Should be the higest supported version, so we can use the newest tools
164-
php-version: '8.4'
164+
php-version: '8.5'
165165
tools: composer, composer-require-checker, composer-unused
166-
extensions: ctype, date, dom, filter, hash, mbstring, openssl, pcre, soap, spl, xml
166+
extensions: ctype, date, dom, filter, hash, intl, mbstring, openssl, pcre, soap, sodium, spl, xml
167167
coverage: none
168168

169169
- name: Setup problem matchers for PHP
@@ -215,8 +215,8 @@ jobs:
215215
uses: shivammathur/setup-php@v2
216216
with:
217217
# Should be the lowest supported version
218-
php-version: '8.2'
219-
extensions: ctype, date, dom, filter, hash, mbstring, openssl, pcre, soap, spl, xml
218+
php-version: '8.3'
219+
extensions: ctype, date, dom, filter, hash, intl, mbstring, openssl, pcre, soap, sodium, spl, xml
220220
tools: composer
221221
coverage: none
222222

composer.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
}
1919
],
2020
"require": {
21-
"php": "^8.2",
21+
"php": "^8.3",
2222
"ext-date": "*",
2323
"ext-dom": "*",
2424
"ext-filter": "*",
@@ -29,18 +29,18 @@
2929
"nyholm/psr7": "~1.8",
3030
"psr/clock": "~1.0",
3131
"psr/http-message": "~2.0",
32-
"psr/log": "~2.3 || ~3.0",
32+
"psr/log": "~3.0",
3333
"simplesamlphp/assert": "~1.9",
34-
"simplesamlphp/xml-common": "~2.4",
35-
"simplesamlphp/xml-security": "~2.0",
36-
"simplesamlphp/xml-soap": "~2.0"
34+
"simplesamlphp/xml-common": "~2.5",
35+
"simplesamlphp/xml-security": "~2.1",
36+
"simplesamlphp/xml-soap": "~2.1"
3737
},
3838
"require-dev": {
3939
"ext-intl": "*",
4040

4141
"beste/clock": "~3.0",
4242
"mockery/mockery": "~1.6",
43-
"simplesamlphp/simplesamlphp-test-framework": "~1.10"
43+
"simplesamlphp/simplesamlphp-test-framework": "~1.11"
4444
},
4545
"suggest": {
4646
"ext-soap": "*"
@@ -58,7 +58,7 @@
5858
},
5959
"extra": {
6060
"branch-alias": {
61-
"dev-master": "v5.1.x-dev"
61+
"dev-master": "v6.1.x-dev"
6262
}
6363
},
6464
"config": {

src/Binding/HTTPArtifact.php

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@ class HTTPArtifact extends Binding implements AsynchronousBindingInterface, Rela
4848

4949

5050
/**
51-
* @psalm-suppress UndefinedDocblockClass
52-
* @psalm-suppress UndefinedClass
5351
* @var \SimpleSAML\Configuration
5452
*/
5553
private Configuration $spMetadata;
@@ -58,16 +56,15 @@ class HTTPArtifact extends Binding implements AsynchronousBindingInterface, Rela
5856
/**
5957
* Create the redirect URL for a message.
6058
*
61-
* @param \SimpleSAML\SAML2\XML\samlp\AbstractMessage $message The message.
59+
* @param \SimpleSAML\SAML2\XML\samlp\AbstractMessage $message The message.
60+
* @return string The URL the user should be redirected to in order to send a message.
61+
*
6262
* @throws \Exception
63-
* @return string The URL the user should be redirected to in order to send a message.
6463
*/
6564
public function getRedirectURL(AbstractMessage $message): string
6665
{
67-
/** @psalm-suppress UndefinedClass */
6866
$config = Configuration::getInstance();
6967

70-
/** @psalm-suppress UndefinedClass */
7168
$store = StoreFactory::getInstance($config->getString('store.type'));
7269
if ($store === false) {
7370
throw new Exception('Unable to send artifact without a datastore configured.');
@@ -97,7 +94,6 @@ public function getRedirectURL(AbstractMessage $message): string
9794
$params['RelayState'] = $relayState;
9895
}
9996

100-
/** @psalm-suppress UndefinedClass */
10197
$httpUtils = new HTTP();
10298
return $httpUtils->addURLparameters($destination, $params);
10399
}
@@ -211,8 +207,6 @@ public function receive(ServerRequestInterface $request): AbstractMessage
211207

212208
/**
213209
* @param \SimpleSAML\Configuration $sp
214-
*
215-
* @psalm-suppress UndefinedClass
216210
*/
217211
public function setSPMetadata(Configuration $sp): void
218212
{
@@ -225,7 +219,6 @@ public function setSPMetadata(Configuration $sp): void
225219
*
226220
* @param \SimpleSAML\SAML2\XML\samlp\ArtifactResponse $message
227221
* @param \SimpleSAML\XMLSecurity\XMLSecurityKey $key
228-
* @return bool
229222
*/
230223
public static function validateSignature(ArtifactResponse $message, XMLSecurityKey $key): bool
231224
{

src/Binding/HTTPPost.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ public function send(AbstractMessage $message): ResponseInterface
8282
*
8383
* @param \Psr\Http\Message\ServerRequestInterface $request
8484
* @return \SimpleSAML\SAML2\XML\samlp\AbstractMessage The received message.
85+
*
8586
* @throws \Exception
8687
*/
8788
public function receive(ServerRequestInterface $request): AbstractMessage

src/Binding/HTTPRedirect.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ public function send(AbstractMessage $message): ResponseInterface
126126
*
127127
* @param \Psr\Http\Message\ServerRequestInterface $request
128128
* @return \SimpleSAML\SAML2\XML\samlp\AbstractMessage The received message.
129+
*
129130
* @throws \Exception
130131
*
131132
* NPath is currently too high but solving that just moves code around.

src/Binding/RelayStateInterface.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,12 @@ interface RelayStateInterface
1313
{
1414
/**
1515
* Set the RelayState associated with he message.
16-
*
17-
* @param string|null $relayState The RelayState.
1816
*/
1917
public function setRelayState(?string $relayState = null): void;
2018

2119

2220
/**
2321
* Get the RelayState associated with the message.
24-
*
25-
* @return string|null The RelayState.
2622
*/
2723
public function getRelayState(): ?string;
2824
}

src/Binding/RelayStateTrait.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,12 @@ trait RelayStateTrait
1515
{
1616
/**
1717
* The relay state.
18-
*
19-
* @var string|null
2018
*/
2119
protected ?string $relayState = null;
2220

2321

2422
/**
2523
* Set the RelayState associated with he message.
26-
*
27-
* @param string|null $relayState The RelayState.
2824
*/
2925
public function setRelayState(?string $relayState = null): void
3026
{
@@ -35,8 +31,6 @@ public function setRelayState(?string $relayState = null): void
3531

3632
/**
3733
* Get the RelayState associated with the message.
38-
*
39-
* @return string|null The RelayState.
4034
*/
4135
public function getRelayState(): ?string
4236
{

src/Binding/SOAP.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,11 @@ class SOAP extends Binding implements SynchronousBindingInterface
3535
{
3636
/**
3737
* @param \SimpleSAML\SAML2\XML\samlp\AbstractMessage $message
38-
* @throws \Exception
3938
* @return string|false The XML or false on error
39+
*
40+
* @throws \Exception
4041
*/
41-
public function getOutputToSend(AbstractMessage $message)
42+
public function getOutputToSend(AbstractMessage $message): string|false
4243
{
4344
$header = new Header();
4445

@@ -113,7 +114,7 @@ public function receive(/** @scrutinizer ignore-unused */ServerRequestInterface
113114
/**
114115
* @return string|false
115116
*/
116-
protected function getInputStream()
117+
protected function getInputStream(): string|false
117118
{
118119
return file_get_contents('php://input');
119120
}

src/Certificate/Key.php

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
class Key implements ArrayAccess
2020
{
2121
// Possible key usages
22-
public const USAGE_SIGNING = 'signing';
22+
public const string USAGE_SIGNING = 'signing';
2323

24-
public const USAGE_ENCRYPTION = 'encryption';
24+
public const string USAGE_ENCRYPTION = 'encryption';
2525

2626

2727
/** @var array */
@@ -43,8 +43,6 @@ public function __construct(array $keyData)
4343
/**
4444
* Whether or not the key is configured to be used for usage given
4545
*
46-
* @param string $usage
47-
* @return bool
4846
* @throws \SimpleSAML\SAML2\Exception\InvalidArgumentException
4947
*/
5048
public function canBeUsedFor(string $usage): bool
@@ -62,8 +60,8 @@ public function canBeUsedFor(string $usage): bool
6260

6361
/**
6462
* @param mixed $offset
63+
*
6564
* @throws \SimpleSAML\SAML2\Exception\InvalidArgumentException
66-
* @return bool
6765
*/
6866
public function offsetExists(mixed $offset): bool
6967
{
@@ -75,9 +73,7 @@ public function offsetExists(mixed $offset): bool
7573

7674

7775
/**
78-
* @param mixed $offset
7976
* @throws \SimpleSAML\SAML2\Exception\InvalidArgumentException
80-
* @return mixed
8177
*/
8278
public function offsetGet($offset): mixed
8379
{
@@ -89,8 +85,6 @@ public function offsetGet($offset): mixed
8985

9086

9187
/**
92-
* @param mixed $offset
93-
* @param mixed $value
9488
* @throws \SimpleSAML\SAML2\Exception\InvalidArgumentException
9589
*/
9690
public function offsetSet(mixed $offset, mixed $value): void
@@ -103,7 +97,6 @@ public function offsetSet(mixed $offset, mixed $value): void
10397

10498

10599
/**
106-
* @param mixed $offset
107100
* @throws \SimpleSAML\SAML2\Exception\InvalidArgumentException
108101
*/
109102
public function offsetUnset(mixed $offset): void

src/Certificate/KeyCollection.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,11 @@ class KeyCollection extends ArrayCollection
1616
* Add a key to the collection
1717
*
1818
* @param \SimpleSAML\SAML2\Certificate\Key $element
19-
* @throws \SimpleSAML\Assert\AssertionFailedException if assertions are false
2019
*
21-
* Type hint not possible due to upstream method signature
22-
* @psalm-suppress MoreSpecificImplementedParamType
20+
* @throws \SimpleSAML\Assert\AssertionFailedException if assertions are false
2321
*/
2422
public function add($element): void
2523
{
26-
/** @psalm-suppress RedundantConditionGivenDocblockType */
2724
Assert::isInstanceOf($element, Key::class);
2825
parent::add($element);
2926
}

0 commit comments

Comments
 (0)