Skip to content

Commit 270f38c

Browse files
committed
Coding standards: auto remove unused imports and require use.
1 parent 336945c commit 270f38c

32 files changed

+212
-185
lines changed

ci/qa/phpcbf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
cd $(dirname $0)/../../
44

55
# https://github.com/squizlabs/PHP_CodeSniffer/wiki/Fixing-Errors-Automatically
6-
./vendor/bin/phpcbf --standard=ci/qa/phpcs.xml $1
6+
./vendor/bin/phpcbf --standard=ci/qa/phpcs.xml --extensions=php src $1

ci/qa/phpcs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
cd $(dirname $0)/../../
44

55
# https://github.com/squizlabs/PHP_CodeSniffer/wiki/Usage
6-
./vendor/bin/phpcs --report=full --standard=ci/qa/phpcs.xml --ignore=*/Tests/* --warning-severity=0 --extensions=php src
6+
./vendor/bin/phpcs --report=full --standard=ci/qa/phpcs.xml --warning-severity=0 --extensions=php src

ci/qa/phpcs.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,13 @@
1515
<property name="lineLimit" value="120"/>
1616
<property name="absoluteLineLimit" value="150"/>
1717
</properties>
18+
<exclude-pattern>src/Tests/*</exclude-pattern>
1819
</rule>
20+
21+
<rule ref="PSR1.Methods.CamelCapsMethodName">
22+
<exclude-pattern>src/Tests/*</exclude-pattern>
23+
</rule>
24+
25+
<rule ref="SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly"/>
26+
<rule ref="SlevomatCodingStandard.Namespaces.UnusedUses"/>
1927
</ruleset>

composer.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"phpunit/phpunit": "^11.0.0",
3030
"rector/rector": "^2.2",
3131
"sebastian/exporter": "^6.3",
32+
"slevomat/coding-standard": "^8.24",
3233
"squizlabs/php_codesniffer": "^4.0",
3334
"symfony/phpunit-bridge": "^6.3"
3435
},
@@ -68,6 +69,7 @@
6869
"config": {
6970
"sort-packages": true,
7071
"allow-plugins": {
72+
"dealerdirect/phpcodesniffer-composer-installer": true,
7173
"phpstan/extension-installer": true
7274
}
7375
}

src/Http/Exception/InvalidRequestException.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@
1818

1919
namespace Surfnet\SamlBundle\Http\Exception;
2020

21-
use Surfnet\SamlBundle\Exception\Exception;
2221
use Surfnet\SamlBundle\Exception\RuntimeException;
2322

24-
class InvalidRequestException extends RuntimeException implements Exception
23+
class InvalidRequestException extends RuntimeException
2524
{
2625
}

src/Http/ReceivedAuthnRequestPost.php

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

1919
namespace Surfnet\SamlBundle\Http;
2020

21-
use Exception;
2221
use RobRichards\XMLSecLibs\XMLSecurityKey;
2322
use Surfnet\SamlBundle\Http\Exception\InvalidRequestException;
2423
use Surfnet\SamlBundle\SAML2\ReceivedAuthnRequest;
@@ -81,7 +80,7 @@ public function getRelayState(): ?string
8180
}
8281

8382
/**
84-
* @throws Exception when signature is invalid (@see SAML2\Utils::validateSignature)
83+
* @throws \Exception when signature is invalid (@see SAML2\Utils::validateSignature)
8584
*/
8685
public function verify(XMLSecurityKey $key): bool
8786
{

src/Monolog/SamlAuthenticationLogger.php

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
namespace Surfnet\SamlBundle\Monolog;
2121

2222
use Psr\Log\LoggerInterface;
23+
use Stringable;
2324

2425
/**
2526
* Decorates a PSR logger and adds information pertaining to a SAML request procedure to each message's context.
@@ -45,47 +46,47 @@ public function forAuthentication(string $requestId): self
4546
return $logger;
4647
}
4748

48-
public function emergency(string|\Stringable $message, array $context = []): void
49+
public function emergency(string|Stringable $message, array $context = []): void
4950
{
5051
$this->logger->emergency($message, $this->modifyContext($context));
5152
}
5253

53-
public function alert(string|\Stringable $message, array $context = []): void
54+
public function alert(string|Stringable $message, array $context = []): void
5455
{
5556
$this->logger->alert($message, $this->modifyContext($context));
5657
}
5758

58-
public function critical(string|\Stringable $message, array $context = []): void
59+
public function critical(string|Stringable $message, array $context = []): void
5960
{
6061
$this->logger->critical($message, $this->modifyContext($context));
6162
}
6263

63-
public function error(string|\Stringable $message, array $context = []): void
64+
public function error(string|Stringable $message, array $context = []): void
6465
{
6566
$this->logger->error($message, $this->modifyContext($context));
6667
}
6768

68-
public function warning(string|\Stringable $message, array $context = []): void
69+
public function warning(string|Stringable $message, array $context = []): void
6970
{
7071
$this->logger->warning($message, $this->modifyContext($context));
7172
}
7273

73-
public function notice(string|\Stringable $message, array $context = []): void
74+
public function notice(string|Stringable $message, array $context = []): void
7475
{
7576
$this->logger->notice($message, $this->modifyContext($context));
7677
}
7778

78-
public function info(string|\Stringable $message, array $context = []): void
79+
public function info(string|Stringable $message, array $context = []): void
7980
{
8081
$this->logger->info($message, $this->modifyContext($context));
8182
}
8283

83-
public function debug(string|\Stringable $message, array $context = []): void
84+
public function debug(string|Stringable $message, array $context = []): void
8485
{
8586
$this->logger->debug($message, $this->modifyContext($context));
8687
}
8788

88-
public function log($level, string|\Stringable $message, array $context = []): void
89+
public function log($level, string|Stringable $message, array $context = []): void
8990
{
9091
$this->logger->log($level, $message, $this->modifyContext($context));
9192
}

src/SAML2/AuthnRequestFactory.php

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

1919
namespace Surfnet\SamlBundle\SAML2;
2020

21-
use Exception;
2221
use RobRichards\XMLSecLibs\XMLSecurityKey;
2322
use SAML2\AuthnRequest as SAML2AuthnRequest;
2423
use SAML2\Certificate\PrivateKeyLoader;
@@ -70,7 +69,7 @@ public static function createFromHttpRequest(Request $httpRequest): AuthnRequest
7069
}
7170

7271
/**
73-
* @throws Exception
72+
* @throws \Exception
7473
*/
7574
private static function createAuthnRequestFromHttpRequest(
7675
Request $httpRequest

src/SAML2/Extensions/GsspUserAttributesChunk.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
use DOMDocument;
2121
use DOMElement;
22-
use DOMNode;
2322
use SAML2\Utils;
2423

2524
class GsspUserAttributesChunk extends Chunk

src/SAML2/ReceivedAuthnRequest.php

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

1919
namespace Surfnet\SamlBundle\SAML2;
2020

21-
use Exception;
2221
use RobRichards\XMLSecLibs\XMLSecurityKey;
2322
use SAML2\AuthnRequest as SAML2AuthnRequest;
2423
use SAML2\Constants;
@@ -166,7 +165,7 @@ public function getScopingRequesterIds(): array
166165
}
167166

168167
/**
169-
* @throws Exception when signature is invalid (@see SAML2\Utils::validateSignature)
168+
* @throws \Exception when signature is invalid (@see SAML2\Utils::validateSignature)
170169
*/
171170
public function verify(XMLSecurityKey $key): bool
172171
{

0 commit comments

Comments
 (0)