Skip to content

Commit 15f02a2

Browse files
committed
Changelog: mention bc break
PHPCS: search comments for annotations Prior to this change, phpcs would not allow imports for classes referenced in annotations only. This change enables that. Also, fix a wrong reference to `\LogicException` where in reality `\Surfnet\SamlBundle\Security\Exception\LogicException` was thrown. Update to samlbundle exception.
1 parent 64925e0 commit 15f02a2

5 files changed

Lines changed: 15 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
- Add SF 7 support
33
- Upgrade dev & qa tooling
44

5+
Backward compatibility breaks:
6+
* Minor: `\Surfnet\SamlBundle\SAML2\BridgeContainer::debugMessage` Will now throw a `\Surfnet\SamlBundle\Exception\InvalidArgumentException` instead of 'Fatal error: Uncaught TypeError' if an invalid `$message` is debugged.
7+
58
# 6.0.0
69
- Add SF 6 support
710
- Require PHP 8.1

ci/qa/phpcs.xml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323
</rule>
2424

2525
<rule ref="SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly"/>
26-
<rule ref="SlevomatCodingStandard.Namespaces.UnusedUses"/>
26+
<rule ref="SlevomatCodingStandard.Namespaces.UnusedUses">
27+
<properties>
28+
<property name="searchAnnotations" type="bool" value="true"/>
29+
</properties>
30+
</rule>
2731
<rule ref="SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses"/>
2832
</ruleset>

src/Http/ReceivedAuthnRequestPost.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
namespace Surfnet\SamlBundle\Http;
2020

21+
use Exception;
2122
use RobRichards\XMLSecLibs\XMLSecurityKey;
2223
use Surfnet\SamlBundle\Http\Exception\InvalidRequestException;
2324
use Surfnet\SamlBundle\SAML2\ReceivedAuthnRequest;
@@ -80,7 +81,7 @@ public function getRelayState(): ?string
8081
}
8182

8283
/**
83-
* @throws \Exception when signature is invalid (@see SAML2\Utils::validateSignature)
84+
* @throws Exception when signature is invalid (@see SAML2\Utils::validateSignature)
8485
*/
8586
public function verify(XMLSecurityKey $key): bool
8687
{

src/SAML2/BridgeContainer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
use BadMethodCallException;
2222
use DOMElement;
2323
use Psr\Log\LoggerInterface;
24-
use RuntimeException;
2524
use SAML2\Compat\AbstractContainer;
25+
use Surfnet\SamlBundle\Exception\InvalidArgumentException;
2626

2727
/**
2828
* Container that is required so that we can make the SAML2 lib work.
@@ -57,7 +57,7 @@ public function debugMessage($message, $type): void
5757
}
5858

5959
if (!is_string($message)) {
60-
throw new RuntimeException("Debug message error: could not convert message to string.");
60+
throw new InvalidArgumentException("Debug message error: could not convert message to string.");
6161
}
6262

6363
$this->logger->debug($message, ['type' => $type]);

src/Security/Authentication/AuthenticatedSessionStateHandler.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,15 @@
1818

1919
namespace Surfnet\SamlBundle\Security\Authentication;
2020

21+
use Surfnet\SamlBundle\Security\Exception\LogicException;
2122
use Surfnet\SamlBundle\Value\DateTime;
2223

2324
interface AuthenticatedSessionStateHandler
2425
{
2526
/**
2627
* Sets the moment at which the user was authenticated
2728
*
28-
* @throws \LogicException when an authentication moment was already logged
29+
* @throws LogicException when an authentication moment was already logged
2930
*/
3031
public function logAuthenticationMoment(): void;
3132

@@ -34,7 +35,7 @@ public function isAuthenticationMomentLogged(): bool;
3435
/**
3536
* Gets the moment at which the user was authenticated
3637
*
37-
* @throws \LogicException when no authentication moment was logged
38+
* @throws LogicException when no authentication moment was logged
3839
*/
3940
public function getAuthenticationMoment(): DateTime;
4041

0 commit comments

Comments
 (0)