Skip to content

Commit

Permalink
Merge pull request #1179 from kukulich/cs
Browse files Browse the repository at this point in the history
Bump doctrine/coding-standard from 9.0.0 to 10.0.0
  • Loading branch information
Ocramius authored Aug 26, 2022
2 parents e9ff3fa + f9dca39 commit cc16e7f
Show file tree
Hide file tree
Showing 229 changed files with 948 additions and 2,291 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

],
"require-dev": {
"doctrine/coding-standard": "^9.0.0",
"doctrine/coding-standard": "^10.0.0",
"phpstan/phpstan": "^1.8.2",
"phpstan/phpstan-phpunit": "^1.1.1",
"phpunit/phpunit": "^9.5.23",
Expand Down
58 changes: 29 additions & 29 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 0 additions & 17 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
<exclude name="SlevomatCodingStandard.Classes.SuperfluousInterfaceNaming.SuperfluousSuffix"/>
</rule>

<rule ref="SlevomatCodingStandard.Classes.RequireConstructorPropertyPromotion"/>
<rule ref="SlevomatCodingStandard.Exceptions.RequireNonCapturingCatch"/>
<rule ref="SlevomatCodingStandard.Functions.ArrowFunctionDeclaration">
<properties>
<property name="allowMultiLine" value="true"/>
Expand All @@ -31,25 +29,10 @@
<property name="allowNested" value="false"/>
</properties>
</rule>
<rule ref="SlevomatCodingStandard.Functions.RequireTrailingCommaInCall"/>
<rule ref="SlevomatCodingStandard.Functions.RequireTrailingCommaInDeclaration"/>
<rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHint"/>
<rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingParameterTypeHint">
<exclude-pattern>src/Reflection/Adapter/*</exclude-pattern>
</rule>
<rule ref="SlevomatCodingStandard.TypeHints.PropertyTypeHint"/>
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint"/>
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingAnyTypeHint">
<exclude-pattern>src/Reflection/Adapter/*</exclude-pattern>
</rule>
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification">
<!-- Useless for data providers -->
<exclude-pattern>test/unit/</exclude-pattern>
</rule>
<rule ref="SlevomatCodingStandard.TypeHints.UnionTypeHintFormat">
<properties>
<property name="shortNullable" value="yes"/>
<property name="nullPosition" value="last"/>
</properties>
</rule>
</ruleset>
12 changes: 6 additions & 6 deletions src/BetterReflection.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@

final class BetterReflection
{
private ?SourceLocator $sourceLocator = null;
private SourceLocator|null $sourceLocator = null;

private ?Reflector $reflector = null;
private Reflector|null $reflector = null;

private ?Parser $phpParser = null;
private Parser|null $phpParser = null;

private ?AstLocator $astLocator = null;
private AstLocator|null $astLocator = null;

private ?FindReflectionOnLine $findReflectionOnLine = null;
private FindReflectionOnLine|null $findReflectionOnLine = null;

private ?SourceStubber $sourceStubber = null;
private SourceStubber|null $sourceStubber = null;

public function sourceLocator(): SourceLocator
{
Expand Down
4 changes: 1 addition & 3 deletions src/Identifier/Identifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ class Identifier

private string $name;

/**
* @throws InvalidIdentifierName
*/
/** @throws InvalidIdentifierName */
public function __construct(string $name, private IdentifierType $type)
{
if (
Expand Down
8 changes: 3 additions & 5 deletions src/NodeCompiler/CompileNodeToValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@
use function in_array;
use function sprintf;

/**
* @internal
*/
/** @internal */
class CompileNodeToValue
{
private const TRUE_FALSE_NULL = ['true', 'false', 'null'];
Expand Down Expand Up @@ -167,7 +165,7 @@ private function constantExists(string $constantName, CompilerContext $context):
}
}

private function getConstantValue(Node\Expr\ConstFetch $node, ?string $constantName, CompilerContext $context): mixed
private function getConstantValue(Node\Expr\ConstFetch $node, string|null $constantName, CompilerContext $context): mixed
{
// It's not resolved when constant value is expression
$constantName ??= $this->resolveConstantName($node, $context);
Expand All @@ -189,7 +187,7 @@ private function resolveClassConstantName(Node\Expr\ClassConstFetch $node, Compi
return sprintf('%s::%s', $this->resolveClassName($className, $context), $constantName);
}

private function getClassConstantValue(Node\Expr\ClassConstFetch $node, ?string $classConstantName, CompilerContext $context): mixed
private function getClassConstantValue(Node\Expr\ClassConstFetch $node, string|null $classConstantName, CompilerContext $context): mixed
{
// It's not resolved when constant value is expression
$classConstantName ??= $this->resolveClassConstantName($node, $context);
Expand Down
6 changes: 2 additions & 4 deletions src/NodeCompiler/CompiledValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@

namespace Roave\BetterReflection\NodeCompiler;

/**
* @internal
*/
/** @internal */
class CompiledValue
{
public function __construct(public mixed $value, public ?string $constantName = null)
public function __construct(public mixed $value, public string|null $constantName = null)
{
}
}
8 changes: 3 additions & 5 deletions src/NodeCompiler/CompilerContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@
use Roave\BetterReflection\Reflection\ReflectionProperty;
use Roave\BetterReflection\Reflector\Reflector;

/**
* @internal
*/
/** @internal */
class CompilerContext
{
public function __construct(
Expand All @@ -30,7 +28,7 @@ public function getReflector(): Reflector
return $this->reflector;
}

public function getFileName(): ?string
public function getFileName(): string|null
{
if ($this->contextReflection instanceof ReflectionConstant) {
return $this->contextReflection->getFileName();
Expand All @@ -48,7 +46,7 @@ public function getNamespace(): string
return $this->getClass()?->getNamespaceName() ?? $this->getFunction()?->getNamespaceName() ?? '';
}

public function getClass(): ?ReflectionClass
public function getClass(): ReflectionClass|null
{
if ($this->contextReflection instanceof ReflectionClass) {
return $this->contextReflection;
Expand Down
8 changes: 3 additions & 5 deletions src/NodeCompiler/Exception/UnableToCompileNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@
use function assert;
use function sprintf;

/**
* @internal
*/
/** @internal */
class UnableToCompileNode extends LogicException
{
private ?string $constantName = null;
private string|null $constantName = null;

public function constantName(): ?string
public function constantName(): string|null
{
return $this->constantName;
}
Expand Down
4 changes: 1 addition & 3 deletions src/Reflection/Adapter/ReflectionAttribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ public function isRepeated(): bool
return $this->betterReflectionAttribute->isRepeated();
}

/**
* @return array<int|string, mixed>
*/
/** @return array<int|string, mixed> */
public function getArguments(): array
{
return $this->betterReflectionAttribute->getArguments();
Expand Down
Loading

0 comments on commit cc16e7f

Please sign in to comment.