Skip to content

Commit

Permalink
[BCB] Drop optional reflection interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaud-lb authored and ondrejmirtes committed Jul 18, 2019
1 parent 98362bc commit e13c685
Show file tree
Hide file tree
Showing 30 changed files with 332 additions and 111 deletions.
26 changes: 26 additions & 0 deletions src/Reflection/Annotations/AnnotationMethodReflection.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use PHPStan\Reflection\ClassReflection;
use PHPStan\Reflection\FunctionVariant;
use PHPStan\Reflection\MethodReflection;
use PHPStan\TrinaryLogic;
use PHPStan\Type\Generic\TemplateTypeMap;
use PHPStan\Type\Type;

Expand Down Expand Up @@ -106,4 +107,29 @@ public function getVariants(): array
return $this->variants;
}

public function isDeprecated(): TrinaryLogic
{
return TrinaryLogic::createNo();
}

public function getDeprecatedDescription(): ?string
{
return null;
}

public function isFinal(): TrinaryLogic
{
return TrinaryLogic::createNo();
}

public function isInternal(): TrinaryLogic
{
return TrinaryLogic::createNo();
}

public function getThrowType(): ?Type
{
return null;
}

}
16 changes: 16 additions & 0 deletions src/Reflection/Annotations/AnnotationPropertyReflection.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use PHPStan\Reflection\ClassReflection;
use PHPStan\Reflection\PropertyReflection;
use PHPStan\TrinaryLogic;
use PHPStan\Type\Type;

class AnnotationPropertyReflection implements PropertyReflection
Expand Down Expand Up @@ -69,4 +70,19 @@ public function isWritable(): bool
return $this->writable;
}

public function isDeprecated(): TrinaryLogic
{
return TrinaryLogic::createNo();
}

public function getDeprecatedDescription(): ?string
{
return null;
}

public function isInternal(): TrinaryLogic
{
return TrinaryLogic::createNo();
}

}
2 changes: 1 addition & 1 deletion src/Reflection/ClassConstantReflection.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use PHPStan\TrinaryLogic;

class ClassConstantReflection implements ConstantReflection, DeprecatableReflection, InternableReflection
class ClassConstantReflection implements ConstantReflection
{

/** @var \PHPStan\Reflection\ClassReflection */
Expand Down
8 changes: 8 additions & 0 deletions src/Reflection/ConstantReflection.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace PHPStan\Reflection;

use PHPStan\TrinaryLogic;

interface ConstantReflection extends ClassMemberReflection
{

Expand All @@ -12,4 +14,10 @@ public function getName(): string;
*/
public function getValue();

public function isDeprecated(): TrinaryLogic;

public function getDeprecatedDescription(): ?string;

public function isInternal(): TrinaryLogic;

}
14 changes: 0 additions & 14 deletions src/Reflection/DeprecatableReflection.php

This file was deleted.

16 changes: 16 additions & 0 deletions src/Reflection/Dummy/DummyConstantReflection.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use PHPStan\Broker\Broker;
use PHPStan\Reflection\ClassReflection;
use PHPStan\Reflection\ConstantReflection;
use PHPStan\TrinaryLogic;

class DummyConstantReflection implements ConstantReflection
{
Expand Down Expand Up @@ -53,4 +54,19 @@ public function getValue()
return new \stdClass();
}

public function isDeprecated(): TrinaryLogic
{
return TrinaryLogic::createMaybe();
}

public function getDeprecatedDescription(): ?string
{
return null;
}

public function isInternal(): TrinaryLogic
{
return TrinaryLogic::createMaybe();
}

}
27 changes: 27 additions & 0 deletions src/Reflection/Dummy/DummyConstructorReflection.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
use PHPStan\Reflection\ClassReflection;
use PHPStan\Reflection\FunctionVariant;
use PHPStan\Reflection\MethodReflection;
use PHPStan\TrinaryLogic;
use PHPStan\Type\Generic\TemplateTypeMap;
use PHPStan\Type\Type;
use PHPStan\Type\VoidType;

class DummyConstructorReflection implements MethodReflection
Expand Down Expand Up @@ -62,4 +64,29 @@ public function getVariants(): array
];
}

public function isDeprecated(): TrinaryLogic
{
return TrinaryLogic::createMaybe();
}

public function getDeprecatedDescription(): ?string
{
return null;
}

public function isFinal(): TrinaryLogic
{
return TrinaryLogic::createMaybe();
}

public function isInternal(): TrinaryLogic
{
return TrinaryLogic::createMaybe();
}

public function getThrowType(): ?Type
{
return null;
}

}
27 changes: 27 additions & 0 deletions src/Reflection/Dummy/DummyMethodReflection.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
use PHPStan\Reflection\ClassReflection;
use PHPStan\Reflection\MethodReflection;
use PHPStan\Reflection\TrivialParametersAcceptor;
use PHPStan\TrinaryLogic;
use PHPStan\Type\Type;

class DummyMethodReflection implements MethodReflection
{
Expand Down Expand Up @@ -61,4 +63,29 @@ public function getVariants(): array
];
}

public function isDeprecated(): TrinaryLogic
{
return TrinaryLogic::createMaybe();
}

public function getDeprecatedDescription(): ?string
{
return null;
}

public function isFinal(): TrinaryLogic
{
return TrinaryLogic::createMaybe();
}

public function isInternal(): TrinaryLogic
{
return TrinaryLogic::createMaybe();
}

public function getThrowType(): ?Type
{
return null;
}

}
16 changes: 16 additions & 0 deletions src/Reflection/Dummy/DummyPropertyReflection.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use PHPStan\Broker\Broker;
use PHPStan\Reflection\ClassReflection;
use PHPStan\Reflection\PropertyReflection;
use PHPStan\TrinaryLogic;
use PHPStan\Type\MixedType;
use PHPStan\Type\Type;

Expand Down Expand Up @@ -48,4 +49,19 @@ public function isWritable(): bool
return true;
}

public function isDeprecated(): TrinaryLogic
{
return TrinaryLogic::createMaybe();
}

public function getDeprecatedDescription(): ?string
{
return null;
}

public function isInternal(): TrinaryLogic
{
return TrinaryLogic::createMaybe();
}

}
12 changes: 0 additions & 12 deletions src/Reflection/FinalizableReflection.php

This file was deleted.

15 changes: 14 additions & 1 deletion src/Reflection/FunctionReflection.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

namespace PHPStan\Reflection;

interface FunctionReflection extends DeprecatableReflection, InternableReflection, FinalizableReflection, ThrowableReflection
use PHPStan\TrinaryLogic;
use PHPStan\Type\Type;

interface FunctionReflection
{

public function getName(): string;
Expand All @@ -12,4 +15,14 @@ public function getName(): string;
*/
public function getVariants(): array;

public function isDeprecated(): TrinaryLogic;

public function getDeprecatedDescription(): ?string;

public function isFinal(): TrinaryLogic;

public function isInternal(): TrinaryLogic;

public function getThrowType(): ?Type;

}
12 changes: 0 additions & 12 deletions src/Reflection/InternableReflection.php

This file was deleted.

13 changes: 13 additions & 0 deletions src/Reflection/MethodReflection.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

namespace PHPStan\Reflection;

use PHPStan\TrinaryLogic;
use PHPStan\Type\Type;

interface MethodReflection extends ClassMemberReflection
{

Expand All @@ -14,4 +17,14 @@ public function getPrototype(): ClassMemberReflection;
*/
public function getVariants(): array;

public function isDeprecated(): TrinaryLogic;

public function getDeprecatedDescription(): ?string;

public function isFinal(): TrinaryLogic;

public function isInternal(): TrinaryLogic;

public function getThrowType(): ?Type;

}
5 changes: 0 additions & 5 deletions src/Reflection/Native/NativeFunctionReflection.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,6 @@ public function getVariants(): array
return $this->variants;
}

public function hasThrowType(): TrinaryLogic
{
return TrinaryLogic::createYes();
}

public function getThrowType(): ?Type
{
return $this->throwType;
Expand Down
11 changes: 7 additions & 4 deletions src/Reflection/Native/NativeMethodReflection.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@
use PHPStan\Broker\Broker;
use PHPStan\Reflection\ClassMemberReflection;
use PHPStan\Reflection\ClassReflection;
use PHPStan\Reflection\DeprecatableReflection;
use PHPStan\Reflection\FinalizableReflection;
use PHPStan\Reflection\InternableReflection;
use PHPStan\Reflection\MethodPrototypeReflection;
use PHPStan\Reflection\MethodReflection;
use PHPStan\Reflection\Php\BuiltinMethodReflection;
use PHPStan\TrinaryLogic;
use PHPStan\Type\Type;

class NativeMethodReflection implements MethodReflection, DeprecatableReflection, InternableReflection, FinalizableReflection
class NativeMethodReflection implements MethodReflection
{

/** @var \PHPStan\Broker\Broker */
Expand Down Expand Up @@ -117,4 +115,9 @@ public function isFinal(): TrinaryLogic
return TrinaryLogic::createNo();
}

public function getThrowType(): ?Type
{
return null;
}

}
5 changes: 0 additions & 5 deletions src/Reflection/Php/PhpFunctionFromParserNodeReflection.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,11 +221,6 @@ public function isFinal(): TrinaryLogic
return TrinaryLogic::createFromBoolean($this->isFinal);
}

public function hasThrowType(): TrinaryLogic
{
return TrinaryLogic::createYes();
}

public function getThrowType(): ?Type
{
return $this->throwType;
Expand Down
5 changes: 0 additions & 5 deletions src/Reflection/Php/PhpFunctionReflection.php
Original file line number Diff line number Diff line change
Expand Up @@ -271,11 +271,6 @@ public function isFinal(): TrinaryLogic
return TrinaryLogic::createFromBoolean($this->isFinal);
}

public function hasThrowType(): TrinaryLogic
{
return TrinaryLogic::createYes();
}

public function getThrowType(): ?Type
{
return $this->phpDocThrowType;
Expand Down
Loading

0 comments on commit e13c685

Please sign in to comment.