Skip to content

Commit e2d456f

Browse files
committed
Apply codestyles regarding imports
Prior to this change, consistent import style was not enforced. This change applies the phpcs rules for clean imports (no fqn, sorted, no unused).
1 parent e24ad9f commit e2d456f

6 files changed

Lines changed: 17 additions & 22 deletions

File tree

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 ./src $1
6+
./vendor/bin/phpcbf --standard=ci/qa/phpcs.xml ./src ./tests $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 --standard=./ci/qa/phpcs.xml --report=full --warning-severity=0 ./src
6+
./vendor/bin/phpcs --standard=./ci/qa/phpcs.xml --report=full --warning-severity=0 ./src ./tests

ci/qa/phpcs.xml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@
55
By default it is less stringent about long lines than other coding standards
66
</description>
77

8-
<exclude-pattern>src/*/*Bundle/Resources</exclude-pattern>
9-
<exclude-pattern>src/*/Bundle/*Bundle/Resources</exclude-pattern>
10-
118
<!-- This is the rule we inherit from. If you want to exclude some specific rules, see the docs on how to do that -->
129
<rule ref="PSR2"/>
1310

@@ -19,5 +16,13 @@
1916
</properties>
2017
</rule>
2118

19+
<rule ref="SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly"/>
20+
<rule ref="SlevomatCodingStandard.Namespaces.UnusedUses">
21+
<properties>
22+
<property name="searchAnnotations" type="bool" value="true"/>
23+
</properties>
24+
</rule>
25+
<rule ref="SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses"/>
26+
2227
<rule ref="vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/TypeHints/DeclareStrictTypesSniff.php" />
2328
</ruleset>

config/reference.php

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1279,18 +1279,6 @@
12791279
* surfnet_gssp?: SurfnetGsspConfig,
12801280
* webpack_encore?: WebpackEncoreConfig,
12811281
* },
1282-
* "when@smoketest"?: array{
1283-
* imports?: ImportsConfig,
1284-
* parameters?: ParametersConfig,
1285-
* services?: ServicesConfig,
1286-
* framework?: FrameworkConfig,
1287-
* monolog?: MonologConfig,
1288-
* twig?: TwigConfig,
1289-
* security?: SecurityConfig,
1290-
* surfnet_saml?: SurfnetSamlConfig,
1291-
* surfnet_gssp?: SurfnetGsspConfig,
1292-
* webpack_encore?: WebpackEncoreConfig,
1293-
* },
12941282
* "when@test"?: array{
12951283
* imports?: ImportsConfig,
12961284
* parameters?: ParametersConfig,
@@ -1385,7 +1373,6 @@ public static function config(array $config): array
13851373
* @psalm-type RoutesConfig = array{
13861374
* "when@dev"?: array<string, RouteConfig|ImportConfig|AliasConfig>,
13871375
* "when@prod"?: array<string, RouteConfig|ImportConfig|AliasConfig>,
1388-
* "when@smoketest"?: array<string, RouteConfig|ImportConfig|AliasConfig>,
13891376
* "when@test"?: array<string, RouteConfig|ImportConfig|AliasConfig>,
13901377
* ...<string, RouteConfig|ImportConfig|AliasConfig>
13911378
* }

tests/Functional/Features/Context/ErrorReportContext.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
use Behat\Behat\Hook\Scope\StepScope;
2727
use Behat\Gherkin\Node\NodeInterface;
2828
use Behat\Gherkin\Node\ScenarioInterface;
29+
use Behat\Hook\AfterStep;
30+
use Behat\Hook\BeforeScenario;
2931
use Behat\Mink\Driver\Selenium2Driver;
3032
use Behat\Mink\Exception\DriverException;
3133
use Behat\MinkExtension\Context\MinkContext;
@@ -38,14 +40,14 @@ final class ErrorReportContext implements Context
3840
{
3941
private MinkContext $minkContext;
4042

41-
#[\Behat\Hook\BeforeScenario]
43+
#[BeforeScenario]
4244
public function gatherContexts(BeforeScenarioScope $scope): void
4345
{
4446
$environment = $scope->getEnvironment();
4547
$this->minkContext = $environment->getContext(MinkContext::class);
4648
}
4749

48-
#[\Behat\Hook\AfterStep]
50+
#[AfterStep]
4951
public function dumpInfoAfterFailedStep(AfterStepScope $scope): void
5052
{
5153
if ($this->stepIsSuccessful($scope)) {

tests/Functional/Features/Context/WebContext.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020

2121
namespace Surfnet\Gssp\Test\Features\Context;
2222

23+
use Behat\Behat\Context\Context;
2324
use Behat\Behat\Hook\Scope\BeforeScenarioScope;
2425
use Behat\Hook\BeforeScenario;
2526
use Behat\MinkExtension\Context\MinkContext;
26-
use Behat\Behat\Context\Context;
2727
use Behat\Step\Given;
2828
use Behat\Step\When;
2929
use Exception;
@@ -36,6 +36,7 @@
3636
use Surfnet\SamlBundle\Entity\IdentityProvider;
3737
use Surfnet\SamlBundle\Entity\ServiceProvider;
3838
use Surfnet\SamlBundle\Exception\NotFound;
39+
use Surfnet\SamlBundle\SAML2\AuthnRequest as SamlBundleAuthnRequest;
3940
use Symfony\Component\HttpFoundation\Request;
4041
use Symfony\Component\HttpFoundation\RequestStack;
4142
use Symfony\Component\HttpKernel\KernelInterface;
@@ -116,7 +117,7 @@ public function aNormalSAMLAuthnRequestFormAUnknownServiceProvider(): void
116117
self::loadPrivateKey($this->getIdentityProvider()->getPrivateKey(PrivateKey::NAME_DEFAULT))
117118
);
118119

119-
$request = \Surfnet\SamlBundle\SAML2\AuthnRequest::createNew($authnRequest);
120+
$request = SamlBundleAuthnRequest::createNew($authnRequest);
120121
$query = $request->buildRequestQuery();
121122
$this->minkContext->visitPath('/saml/sso?' . $query);
122123
}

0 commit comments

Comments
 (0)