Skip to content

Commit 931b9e7

Browse files
authored
Merge pull request #124 from jrfnl/feature/cs-update
CS update after upstream changes
2 parents 274f578 + a2f7275 commit 931b9e7

Some content is hidden

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

56 files changed

+233
-199
lines changed

phpcs.xml.dist

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,35 @@
11
<?xml version="1.0"?>
2-
<ruleset name="phpDocumentor">
3-
<description>The coding standard for phpDocumentor.</description>
2+
<ruleset name="TypeResolver">
3+
<description>The coding standard for this library.</description>
44

55
<file>src</file>
66
<file>tests/unit</file>
7-
<exclude-pattern>*/tests/unit/Types/ContextFactoryTest.php</exclude-pattern>
7+
<exclude-pattern>*/tests/unit/Types/ContextFactoryTest\.php</exclude-pattern>
88
<arg value="p"/>
99

10+
<!-- Set the minimum PHP version for PHPCompatibility.
11+
This should be kept in sync with the requirements in the composer.json file. -->
12+
<config name="testVersion" value="7.2-"/>
13+
1014
<rule ref="phpDocumentor">
15+
<!-- Property type declarations are a PHP 7.4 feature. -->
16+
<exclude name="SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingNativeTypeHint"/>
1117
</rule>
1218

1319
<rule ref="SlevomatCodingStandard.Classes.SuperfluousAbstractClassNaming.SuperfluousPrefix">
14-
<exclude-pattern>*/src/*/Abstract*.php</exclude-pattern>
20+
<exclude-pattern>*/src/*/Abstract*\.php</exclude-pattern>
1521
</rule>
1622

1723
<rule ref="PSR1.Files.SideEffects.FoundWithSymbols">
18-
<exclude-pattern>*/src/PseudoTypes/False_.php</exclude-pattern>
19-
<exclude-pattern>*/src/PseudoTypes/True_.php</exclude-pattern>
24+
<exclude-pattern>*/src/PseudoTypes/False_\.php</exclude-pattern>
25+
<exclude-pattern>*/src/PseudoTypes/True_\.php</exclude-pattern>
26+
</rule>
27+
28+
<!-- Ignore two PHP 8.0 constants which are being polyfilled in the file using them. -->
29+
<rule ref="PHPCompatibility.Constants.NewConstants.t_name_qualifiedFound">
30+
<exclude-pattern>*/src/Types/ContextFactory\.php</exclude-pattern>
31+
</rule>
32+
<rule ref="PHPCompatibility.Constants.NewConstants.t_name_fully_qualifiedFound">
33+
<exclude-pattern>*/src/Types/ContextFactory\.php</exclude-pattern>
2034
</rule>
2135
</ruleset>

src/FqsenResolver.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
use InvalidArgumentException;
1717
use phpDocumentor\Reflection\Types\Context;
18+
1819
use function explode;
1920
use function implode;
2021
use function strpos;
@@ -29,7 +30,7 @@ class FqsenResolver
2930
/** @var string Definition of the NAMESPACE operator in PHP */
3031
private const OPERATOR_NAMESPACE = '\\';
3132

32-
public function resolve(string $fqsen, ?Context $context = null) : Fqsen
33+
public function resolve(string $fqsen, ?Context $context = null): Fqsen
3334
{
3435
if ($context === null) {
3536
$context = new Context('');
@@ -45,7 +46,7 @@ public function resolve(string $fqsen, ?Context $context = null) : Fqsen
4546
/**
4647
* Tests whether the given type is a Fully Qualified Structural Element Name.
4748
*/
48-
private function isFqsen(string $type) : bool
49+
private function isFqsen(string $type): bool
4950
{
5051
return strpos($type, self::OPERATOR_NAMESPACE) === 0;
5152
}
@@ -56,7 +57,7 @@ private function isFqsen(string $type) : bool
5657
*
5758
* @throws InvalidArgumentException When type is not a valid FQSEN.
5859
*/
59-
private function resolvePartialStructuralElementName(string $type, Context $context) : Fqsen
60+
private function resolvePartialStructuralElementName(string $type, Context $context): Fqsen
6061
{
6162
$typeParts = explode(self::OPERATOR_NAMESPACE, $type, 2);
6263

src/PseudoType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@
1515

1616
interface PseudoType extends Type
1717
{
18-
public function underlyingType() : Type;
18+
public function underlyingType(): Type;
1919
}

src/PseudoTypes/CallableString.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@
2424
*/
2525
final class CallableString extends String_ implements PseudoType
2626
{
27-
public function underlyingType() : Type
27+
public function underlyingType(): Type
2828
{
2929
return new String_();
3030
}
3131

3232
/**
3333
* Returns a rendered output of the Type as it would be used in a DocBlock.
3434
*/
35-
public function __toString() : string
35+
public function __toString(): string
3636
{
3737
return 'callable-string';
3838
}

src/PseudoTypes/False_.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use phpDocumentor\Reflection\PseudoType;
1717
use phpDocumentor\Reflection\Type;
1818
use phpDocumentor\Reflection\Types\Boolean;
19+
1920
use function class_alias;
2021

2122
/**
@@ -25,12 +26,12 @@
2526
*/
2627
final class False_ extends Boolean implements PseudoType
2728
{
28-
public function underlyingType() : Type
29+
public function underlyingType(): Type
2930
{
3031
return new Boolean();
3132
}
3233

33-
public function __toString() : string
34+
public function __toString(): string
3435
{
3536
return 'false';
3637
}

src/PseudoTypes/HtmlEscapedString.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@
2424
*/
2525
final class HtmlEscapedString extends String_ implements PseudoType
2626
{
27-
public function underlyingType() : Type
27+
public function underlyingType(): Type
2828
{
2929
return new String_();
3030
}
3131

3232
/**
3333
* Returns a rendered output of the Type as it would be used in a DocBlock.
3434
*/
35-
public function __toString() : string
35+
public function __toString(): string
3636
{
3737
return 'html-escaped-string';
3838
}

src/PseudoTypes/LowercaseString.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@
2424
*/
2525
final class LowercaseString extends String_ implements PseudoType
2626
{
27-
public function underlyingType() : Type
27+
public function underlyingType(): Type
2828
{
2929
return new String_();
3030
}
3131

3232
/**
3333
* Returns a rendered output of the Type as it would be used in a DocBlock.
3434
*/
35-
public function __toString() : string
35+
public function __toString(): string
3636
{
3737
return 'lowercase-string';
3838
}

src/PseudoTypes/NonEmptyLowercaseString.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@
2424
*/
2525
final class NonEmptyLowercaseString extends String_ implements PseudoType
2626
{
27-
public function underlyingType() : Type
27+
public function underlyingType(): Type
2828
{
2929
return new String_();
3030
}
3131

3232
/**
3333
* Returns a rendered output of the Type as it would be used in a DocBlock.
3434
*/
35-
public function __toString() : string
35+
public function __toString(): string
3636
{
3737
return 'non-empty-lowercase-string';
3838
}

src/PseudoTypes/NonEmptyString.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@
2424
*/
2525
final class NonEmptyString extends String_ implements PseudoType
2626
{
27-
public function underlyingType() : Type
27+
public function underlyingType(): Type
2828
{
2929
return new String_();
3030
}
3131

3232
/**
3333
* Returns a rendered output of the Type as it would be used in a DocBlock.
3434
*/
35-
public function __toString() : string
35+
public function __toString(): string
3636
{
3737
return 'non-empty-string';
3838
}

src/PseudoTypes/NumericString.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@
2424
*/
2525
final class NumericString extends String_ implements PseudoType
2626
{
27-
public function underlyingType() : Type
27+
public function underlyingType(): Type
2828
{
2929
return new String_();
3030
}
3131

3232
/**
3333
* Returns a rendered output of the Type as it would be used in a DocBlock.
3434
*/
35-
public function __toString() : string
35+
public function __toString(): string
3636
{
3737
return 'numeric-string';
3838
}

0 commit comments

Comments
 (0)