Skip to content

Commit b556e3b

Browse files
committed
Updated coding standard
1 parent bdbf78e commit b556e3b

9 files changed

+50
-36
lines changed

build.xml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,9 @@
4141
passthru="true"
4242
checkreturn="true"
4343
>
44-
<arg value="--standard=ruleset.xml"/>
4544
<arg value="--extensions=php"/>
4645
<arg value="--encoding=utf-8"/>
4746
<arg value="--tab-width=4"/>
48-
<arg value="--ignore=tests/*/data"/>
4947
<arg value="-sp"/>
5048
<arg path="src"/>
5149
<arg path="tests"/>
@@ -59,11 +57,9 @@
5957
passthru="true"
6058
checkreturn="true"
6159
>
62-
<arg value="--standard=ruleset.xml"/>
6360
<arg value="--extensions=php"/>
6461
<arg value="--encoding=utf-8"/>
6562
<arg value="--tab-width=4"/>
66-
<arg value="--ignore=tests/*/data"/>
6763
<arg value="-sp"/>
6864
<arg path="src"/>
6965
<arg path="tests"/>

composer.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,14 @@
1616
"doctrine/orm": "^2.5"
1717
},
1818
"require-dev": {
19-
"consistence/coding-standard": "~0.13.0",
20-
"jakub-onderka/php-parallel-lint": "^0.9.2",
19+
"consistence/coding-standard": "^3.0.1",
20+
"dealerdirect/phpcodesniffer-composer-installer": "^0.4.4",
21+
"jakub-onderka/php-parallel-lint": "^1.0",
2122
"phing/phing": "^2.16.0",
2223
"phpstan/phpstan-phpunit": "^0.10",
2324
"phpstan/phpstan-strict-rules": "^0.10",
2425
"phpunit/phpunit": "^7.0",
25-
"slevomat/coding-standard": "^2.0"
26+
"slevomat/coding-standard": "^4.5.2"
2627
},
2728
"autoload": {
2829
"psr-4": {

phpcs.xml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="PHPStan Doctrine">
3+
<rule ref="vendor/consistence/coding-standard/Consistence/ruleset.xml">
4+
<exclude name="Squiz.Functions.GlobalFunction.Found"/>
5+
<exclude name="SlevomatCodingStandard.Namespaces.FullyQualifiedClassNameAfterKeyword"/>
6+
<exclude name="SlevomatCodingStandard.Namespaces.FullyQualifiedClassNameInAnnotation"/>
7+
<exclude name="SlevomatCodingStandard.Namespaces.FullyQualifiedExceptions"/>
8+
<exclude name="SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly"/>
9+
</rule>
10+
<rule ref="SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses">
11+
<properties>
12+
<property name="caseSensitive" value="false"/>
13+
</properties>
14+
</rule>
15+
<rule ref="SlevomatCodingStandard.TypeHints.DeclareStrictTypes">
16+
<properties>
17+
<property name="newlinesCountBetweenOpenTagAndDeclare" value="0"/>
18+
</properties>
19+
</rule>
20+
<rule ref="SlevomatCodingStandard.TypeHints.TypeHintDeclaration">
21+
<properties>
22+
<property name="usefulAnnotations" type="array" value="
23+
@dataProvider,
24+
@requires
25+
"/>
26+
</properties>
27+
</rule>
28+
<rule ref="SlevomatCodingStandard.ControlStructures.AssignmentInCondition"/>
29+
<rule ref="SlevomatCodingStandard.ControlStructures.DisallowEqualOperators"/>
30+
<rule ref="SlevomatCodingStandard.ControlStructures.EarlyExit"/>
31+
<rule ref="SlevomatCodingStandard.Classes.SuperfluousAbstractClassNaming"/>
32+
<rule ref="SlevomatCodingStandard.Classes.SuperfluousInterfaceNaming"/>
33+
<!-- <rule ref="SlevomatCodingStandard.ControlStructures.DisallowShortTernaryOperator"/>-->
34+
<!-- <rule ref="SlevomatCodingStandard.Namespaces.RequireOneNamespaceInFile"/> -->
35+
<!-- <rule ref="SlevomatCodingStandard.PHP.ShortList"/> -->
36+
<rule ref="SlevomatCodingStandard.Files.TypeNameMatchesFileName">
37+
<properties>
38+
<property name="rootNamespaces" type="array" value="src=>PHPStan,tests=>PHPStan"/>
39+
</properties>
40+
</rule>
41+
<exclude-pattern>tests/*/data</exclude-pattern>
42+
</ruleset>

phpstan.neon

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,3 @@ includes:
22
- vendor/phpstan/phpstan-strict-rules/rules.neon
33
- vendor/phpstan/phpstan-phpunit/extension.neon
44
- vendor/phpstan/phpstan-phpunit/rules.neon
5-
- vendor/phpstan/phpstan-phpunit/strictRules.neon

ruleset.xml

Lines changed: 0 additions & 17 deletions
This file was deleted.

src/Type/Doctrine/EntityManagerGetRepositoryDynamicReturnTypeExtension.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@
1212
class EntityManagerGetRepositoryDynamicReturnTypeExtension implements \PHPStan\Type\DynamicMethodReturnTypeExtension
1313
{
1414

15-
/**
16-
* @var string
17-
*/
15+
/** @var string */
1816
private $repositoryClass;
1917

2018
public function __construct(string $repositoryClass)

src/Type/Doctrine/EntityRepositoryType.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@
77
class EntityRepositoryType extends ObjectType
88
{
99

10-
/**
11-
* @var string
12-
*/
10+
/** @var string */
1311
private $entityClass;
1412

1513
public function __construct(string $entityClass, string $repositoryClass)

tests/PHPStan/Reflection/Doctrine/DoctrineSelectableClassReflectionExtensionTest.php renamed to tests/Reflection/Doctrine/DoctrineSelectableClassReflectionExtensionTest.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
<?php declare(strict_types = 1);
22

3-
namespace Tests\PHPStan\Reflection\Doctrine;
4-
5-
use PHPStan\Reflection\Doctrine\DoctrineSelectableClassReflectionExtension;
3+
namespace PHPStan\Reflection\Doctrine;
64

75
final class DoctrineSelectableClassReflectionExtensionTest extends \PHPStan\Testing\TestCase
86
{

tests/PHPStan/Type/Doctrine/DoctrineSelectableDynamicReturnTypeExtensionTest.php renamed to tests/Type/Doctrine/DoctrineSelectableDynamicReturnTypeExtensionTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
<?php declare(strict_types = 1);
22

3-
namespace Tests\PHPStan\Type\Doctrine;
3+
namespace PHPStan\Type\Doctrine;
44

55
use PhpParser\Node\Expr;
66
use PhpParser\Node\Expr\MethodCall;
77
use PHPStan\Analyser\Scope;
88
use PHPStan\Reflection\MethodReflection;
9-
use PHPStan\Type\Doctrine\DoctrineSelectableDynamicReturnTypeExtension;
109
use PHPStan\Type\ObjectType;
1110
use PHPStan\Type\Type;
1211
use PHPUnit\Framework\TestCase;

0 commit comments

Comments
 (0)