Skip to content

Commit bfb3bfb

Browse files
committed
Enforce php import codestyle
Prior to this change, a uniform import style was not enforced. This resulted in feedback and manual rework in reviews. This change automatically enforces a consistent standard way of using imports. - no fqn in the code - sorted by alphabet - no unused imports
1 parent 96e3811 commit bfb3bfb

199 files changed

Lines changed: 2065 additions & 1512 deletions

File tree

Some content is hidden

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

ci/qa-config/phpcs.xml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,8 @@
66
</description>
77

88
<exclude-pattern>src/*/*Bundle/Resources</exclude-pattern>
9-
<exclude-pattern>src/*/*Bundle/Tests</exclude-pattern>
109
<exclude-pattern>src/*/Bundle/*Bundle/Resources</exclude-pattern>
11-
<exclude-pattern>src/*/Bundle/*Bundle/Tests</exclude-pattern>
12-
<exclude-pattern>*/Tests/*</exclude-pattern>
10+
<exclude-pattern>tests/library</exclude-pattern>
1311

1412
<!-- This is the rule we inherit from. If you want to exlude some specific rules, see the docs on how to do that -->
1513
<rule ref="PSR2"/>
@@ -20,5 +18,18 @@
2018
<property name="lineLimit" value="120"/>
2119
<property name="absoluteLineLimit" value="150"/>
2220
</properties>
21+
<exclude-pattern>tests/</exclude-pattern>
2322
</rule>
23+
24+
<rule ref="PSR1.Methods.CamelCapsMethodName">
25+
<exclude-pattern>tests/</exclude-pattern>
26+
</rule>
27+
28+
<rule ref="SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly"/>
29+
<rule ref="SlevomatCodingStandard.Namespaces.UnusedUses">
30+
<properties>
31+
<property name="searchAnnotations" type="bool" value="true"/>
32+
</properties>
33+
</rule>
34+
<rule ref="SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses"/>
2435
</ruleset>

ci/qa/phpcbf.sh

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

66
echo -e "\nPHP CodeSniffer\n"
7-
./vendor/bin/phpcbf --standard=ci/qa-config/phpcs.xml src
7+
./vendor/bin/phpcbf --standard=ci/qa-config/phpcs.xml src tests
88

99
echo -e "\nPHP CodeSniffer (legacy code)\n"
1010
./vendor/bin/phpcs --standard=ci/qa-config/phpcs-legacy.xml library

ci/qa/phpcs.sh

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

66
echo -e "\nPHP CodeSniffer\n"
7-
./vendor/bin/phpcs --report=full --standard=ci/qa-config/phpcs.xml --warning-severity=0 --extensions=php src
7+
./vendor/bin/phpcs --report=full --standard=ci/qa-config/phpcs.xml --warning-severity=0 --extensions=php src tests
88

99
echo -e "\nPHP CodeSniffer (legacy code)\n"
1010
./vendor/bin/phpcs --standard=ci/qa-config/phpcs-legacy.xml --warning-severity=0 --extensions=php -s library

composer.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
"phpmd/phpmd": "^2.15",
7272
"phpunit/phpunit": "^11",
7373
"rector/rector": "^2.2.7",
74+
"slevomat/coding-standard": "^8.28",
7475
"squizlabs/php_codesniffer": "^4.0",
7576
"symfony/debug-bundle": "6.4.*",
7677
"symfony/http-client": "6.4.*",
@@ -131,6 +132,7 @@
131132
},
132133
"sort-packages": true,
133134
"allow-plugins": {
135+
"dealerdirect/phpcodesniffer-composer-installer": true,
134136
"endroid/installer": false,
135137
"symfony/flex": true
136138
}

composer.lock

Lines changed: 210 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Kernel.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
use Symfony\Component\DependencyInjection\ContainerBuilder;
2525
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
2626
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
27+
use function dirname;
2728

2829
class Kernel extends BaseKernel
2930
{
@@ -43,7 +44,7 @@ public function registerBundles(): iterable
4344

4445
public function getProjectDir(): string
4546
{
46-
return \dirname(__DIR__);
47+
return dirname(__DIR__);
4748
}
4849

4950
protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader): void

src/OpenConext/EngineBlock/Assert/Assertion.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
namespace OpenConext\EngineBlock\Assert;
2020

2121
use Assert\Assertion as BaseAssertion;
22+
use OpenConext\EngineBlock\Exception\InvalidArgumentException;
2223

2324
/**
2425
* @method static void nullOrNonEmptyString($value, $message = null, $propertyPath = null)
@@ -29,7 +30,7 @@ class Assertion extends BaseAssertion
2930
const INVALID_NON_EMPTY_STRING = 1001;
3031
const INVALID_HASHING_ALGORITHM = 1002;
3132

32-
protected static $exceptionClass = \OpenConext\EngineBlock\Exception\InvalidArgumentException::class;
33+
protected static $exceptionClass = InvalidArgumentException::class;
3334

3435
/**
3536
* @param string $value

src/OpenConext/EngineBlock/Authentication/Dto/Consent.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
namespace OpenConext\EngineBlock\Authentication\Dto;
2020

2121
use DateTime;
22+
use OpenConext\EngineBlock\Authentication\Model\Consent as ConsentEntity;
2223
use OpenConext\EngineBlock\Metadata\ContactPerson;
2324
use OpenConext\EngineBlock\Metadata\Entity\ServiceProvider;
24-
use OpenConext\EngineBlock\Authentication\Model\Consent as ConsentEntity;
2525

2626
final class Consent
2727
{

0 commit comments

Comments
 (0)