From 5d6d3df4cf22067770f594fa6e09d584b613735f Mon Sep 17 00:00:00 2001 From: orklah Date: Sun, 26 Sep 2021 23:20:01 +0200 Subject: [PATCH] unnecessary identical child method --- .../Analyzer/FunctionLikeAnalyzer.php | 20 ----------------- src/Psalm/Type/Atomic/TCallableArray.php | 4 ---- src/Psalm/Type/Atomic/TIntMask.php | 13 ----------- src/Psalm/Type/Atomic/TIntMaskOf.php | 13 ----------- src/Psalm/Type/Atomic/TIntRange.php | 13 ----------- src/Psalm/Type/Atomic/TLiteralFloat.php | 13 ----------- src/Psalm/Type/Atomic/TLiteralInt.php | 13 ----------- src/Psalm/Type/Atomic/TLiteralString.php | 18 --------------- src/Psalm/Type/Atomic/TLowercaseString.php | 5 ----- .../Type/Atomic/TNonEmptyLowercaseString.php | 5 ----- .../TNonEmptyNonspecificLiteralString.php | 5 ----- .../Type/Atomic/TNonspecificLiteralInt.php | 5 ----- .../Type/Atomic/TNonspecificLiteralString.php | 5 ----- .../Type/Atomic/TTemplateIndexedAccess.php | 12 ---------- src/Psalm/Type/Atomic/TTemplateKeyOf.php | 21 ------------------ src/Psalm/Type/Atomic/TTemplateParamClass.php | 22 ------------------- src/Psalm/Type/Atomic/TTypeAlias.php | 13 ----------- 17 files changed, 200 deletions(-) diff --git a/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php b/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php index 524a204ca..0cf5923e0 100644 --- a/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php @@ -1624,16 +1624,6 @@ abstract class FunctionLikeAnalyzer extends SourceAnalyzer return []; } - public function getFQCLN(): ?string - { - return $this->source->getFQCLN(); - } - - public function getClassName(): ?string - { - return $this->source->getClassName(); - } - /** * @return array>|null */ @@ -1647,16 +1637,6 @@ abstract class FunctionLikeAnalyzer extends SourceAnalyzer return $this->storage->template_types; } - public function getParentFQCLN(): ?string - { - return $this->source->getParentFQCLN(); - } - - public function getNodeTypeProvider() : \Psalm\NodeTypeProvider - { - return $this->source->getNodeTypeProvider(); - } - public function isStatic(): bool { return $this->is_static; diff --git a/src/Psalm/Type/Atomic/TCallableArray.php b/src/Psalm/Type/Atomic/TCallableArray.php index aa484aa89..5caffc595 100644 --- a/src/Psalm/Type/Atomic/TCallableArray.php +++ b/src/Psalm/Type/Atomic/TCallableArray.php @@ -11,8 +11,4 @@ class TCallableArray extends TNonEmptyArray */ public $value = 'callable-array'; - public function getKey(bool $include_extra = true): string - { - return 'array'; - } } diff --git a/src/Psalm/Type/Atomic/TIntMask.php b/src/Psalm/Type/Atomic/TIntMask.php index 95a08d444..abb1e0cbf 100644 --- a/src/Psalm/Type/Atomic/TIntMask.php +++ b/src/Psalm/Type/Atomic/TIntMask.php @@ -40,19 +40,6 @@ class TIntMask extends TInt return 'int-mask<' . substr($s, 0, -2) . '>'; } - /** - * @param array $aliased_classes - */ - public function toPhpString( - ?string $namespace, - array $aliased_classes, - ?string $this_class, - int $php_major_version, - int $php_minor_version - ): ?string { - return $php_major_version >= 7 ? 'int' : null; - } - /** * @param array $aliased_classes * diff --git a/src/Psalm/Type/Atomic/TIntMaskOf.php b/src/Psalm/Type/Atomic/TIntMaskOf.php index 27e3f80a5..de4f36c29 100644 --- a/src/Psalm/Type/Atomic/TIntMaskOf.php +++ b/src/Psalm/Type/Atomic/TIntMaskOf.php @@ -29,19 +29,6 @@ class TIntMaskOf extends TInt return $this->getKey(); } - /** - * @param array $aliased_classes - */ - public function toPhpString( - ?string $namespace, - array $aliased_classes, - ?string $this_class, - int $php_major_version, - int $php_minor_version - ): ?string { - return $php_major_version >= 7 ? 'int' : null; - } - /** * @param array $aliased_classes */ diff --git a/src/Psalm/Type/Atomic/TIntRange.php b/src/Psalm/Type/Atomic/TIntRange.php index 002a09925..0f8032e38 100644 --- a/src/Psalm/Type/Atomic/TIntRange.php +++ b/src/Psalm/Type/Atomic/TIntRange.php @@ -42,19 +42,6 @@ class TIntRange extends TInt return false; } - /** - * @param array $aliased_classes - */ - public function toPhpString( - ?string $namespace, - array $aliased_classes, - ?string $this_class, - int $php_major_version, - int $php_minor_version - ): ?string { - return $php_major_version >= 7 ? 'int' : null; - } - /** * @param array $aliased_classes */ diff --git a/src/Psalm/Type/Atomic/TLiteralFloat.php b/src/Psalm/Type/Atomic/TLiteralFloat.php index 062603803..7b2ce34a8 100644 --- a/src/Psalm/Type/Atomic/TLiteralFloat.php +++ b/src/Psalm/Type/Atomic/TLiteralFloat.php @@ -24,19 +24,6 @@ class TLiteralFloat extends TFloat return 'float(' . $this->value . ')'; } - /** - * @param array $aliased_classes - */ - public function toPhpString( - ?string $namespace, - array $aliased_classes, - ?string $this_class, - int $php_major_version, - int $php_minor_version - ): ?string { - return $php_major_version >= 7 ? 'float' : null; - } - /** * @param array $aliased_classes * diff --git a/src/Psalm/Type/Atomic/TLiteralInt.php b/src/Psalm/Type/Atomic/TLiteralInt.php index 1666ca85c..1b0abec1b 100644 --- a/src/Psalm/Type/Atomic/TLiteralInt.php +++ b/src/Psalm/Type/Atomic/TLiteralInt.php @@ -29,19 +29,6 @@ class TLiteralInt extends TInt return 'int(' . $this->value . ')'; } - /** - * @param array $aliased_classes - */ - public function toPhpString( - ?string $namespace, - array $aliased_classes, - ?string $this_class, - int $php_major_version, - int $php_minor_version - ): ?string { - return $php_major_version >= 7 ? 'int' : null; - } - /** * @param array $aliased_classes * diff --git a/src/Psalm/Type/Atomic/TLiteralString.php b/src/Psalm/Type/Atomic/TLiteralString.php index e16aa54c4..e59c92e41 100644 --- a/src/Psalm/Type/Atomic/TLiteralString.php +++ b/src/Psalm/Type/Atomic/TLiteralString.php @@ -23,11 +23,6 @@ class TLiteralString extends TString return 'string(' . $this->value . ')'; } - public function __toString(): string - { - return 'string'; - } - public function getId(bool $nested = false): string { // quote control characters, backslashes and double quote @@ -44,19 +39,6 @@ class TLiteralString extends TString return 'string(' . $this->value . ')'; } - /** - * @param array $aliased_classes - */ - public function toPhpString( - ?string $namespace, - array $aliased_classes, - ?string $this_class, - int $php_major_version, - int $php_minor_version - ): ?string { - return $php_major_version >= 7 ? 'string' : null; - } - /** * @param array $aliased_classes * diff --git a/src/Psalm/Type/Atomic/TLowercaseString.php b/src/Psalm/Type/Atomic/TLowercaseString.php index cb78b5200..b8414be8c 100644 --- a/src/Psalm/Type/Atomic/TLowercaseString.php +++ b/src/Psalm/Type/Atomic/TLowercaseString.php @@ -3,11 +3,6 @@ namespace Psalm\Type\Atomic; class TLowercaseString extends TString { - public function getKey(bool $include_extra = true): string - { - return 'string'; - } - public function getId(bool $nested = false): string { return 'lowercase-string'; diff --git a/src/Psalm/Type/Atomic/TNonEmptyLowercaseString.php b/src/Psalm/Type/Atomic/TNonEmptyLowercaseString.php index d01324013..3ab6ab6bf 100644 --- a/src/Psalm/Type/Atomic/TNonEmptyLowercaseString.php +++ b/src/Psalm/Type/Atomic/TNonEmptyLowercaseString.php @@ -6,11 +6,6 @@ namespace Psalm\Type\Atomic; */ class TNonEmptyLowercaseString extends TNonEmptyString { - public function getKey(bool $include_extra = true): string - { - return 'string'; - } - public function getId(bool $nested = false): string { return 'non-empty-lowercase-string'; diff --git a/src/Psalm/Type/Atomic/TNonEmptyNonspecificLiteralString.php b/src/Psalm/Type/Atomic/TNonEmptyNonspecificLiteralString.php index 4b6f5657a..9eee2fd1f 100644 --- a/src/Psalm/Type/Atomic/TNonEmptyNonspecificLiteralString.php +++ b/src/Psalm/Type/Atomic/TNonEmptyNonspecificLiteralString.php @@ -7,11 +7,6 @@ namespace Psalm\Type\Atomic; */ class TNonEmptyNonspecificLiteralString extends TNonspecificLiteralString { - public function getKey(bool $include_extra = true): string - { - return 'string'; - } - public function getId(bool $nested = false): string { return 'non-empty-literal-string'; diff --git a/src/Psalm/Type/Atomic/TNonspecificLiteralInt.php b/src/Psalm/Type/Atomic/TNonspecificLiteralInt.php index 99e20ef04..09481333a 100644 --- a/src/Psalm/Type/Atomic/TNonspecificLiteralInt.php +++ b/src/Psalm/Type/Atomic/TNonspecificLiteralInt.php @@ -12,11 +12,6 @@ class TNonspecificLiteralInt extends TInt return 'literal-int'; } - public function getKey(bool $include_extra = true) : string - { - return 'int'; - } - public function canBeFullyExpressedInPhp(int $php_major_version, int $php_minor_version): bool { return false; diff --git a/src/Psalm/Type/Atomic/TNonspecificLiteralString.php b/src/Psalm/Type/Atomic/TNonspecificLiteralString.php index 5a688b596..4d57f6378 100644 --- a/src/Psalm/Type/Atomic/TNonspecificLiteralString.php +++ b/src/Psalm/Type/Atomic/TNonspecificLiteralString.php @@ -12,11 +12,6 @@ class TNonspecificLiteralString extends TString return 'literal-string'; } - public function getKey(bool $include_extra = true) : string - { - return 'string'; - } - public function canBeFullyExpressedInPhp(int $php_major_version, int $php_minor_version): bool { return false; diff --git a/src/Psalm/Type/Atomic/TTemplateIndexedAccess.php b/src/Psalm/Type/Atomic/TTemplateIndexedAccess.php index 517e12ff5..c64dec91c 100644 --- a/src/Psalm/Type/Atomic/TTemplateIndexedAccess.php +++ b/src/Psalm/Type/Atomic/TTemplateIndexedAccess.php @@ -61,16 +61,4 @@ class TTemplateIndexedAccess extends \Psalm\Type\Atomic return false; } - /** - * @param array $aliased_classes - * - */ - public function toNamespacedString( - ?string $namespace, - array $aliased_classes, - ?string $this_class, - bool $use_phpdoc_format - ): string { - return $this->getKey(); - } } diff --git a/src/Psalm/Type/Atomic/TTemplateKeyOf.php b/src/Psalm/Type/Atomic/TTemplateKeyOf.php index 09958050b..f0982d039 100644 --- a/src/Psalm/Type/Atomic/TTemplateKeyOf.php +++ b/src/Psalm/Type/Atomic/TTemplateKeyOf.php @@ -48,27 +48,6 @@ class TTemplateKeyOf extends TArrayKey return 'key-of<' . $this->param_name . ':' . $this->defining_class . ' as ' . $this->as->getId() . '>'; } - /** - * @param array $aliased_classes - */ - public function toPhpString( - ?string $namespace, - array $aliased_classes, - ?string $this_class, - int $php_major_version, - int $php_minor_version - ): ?string { - return null; - } - - /** - * @return false - */ - public function canBeFullyExpressedInPhp(int $php_major_version, int $php_minor_version): bool - { - return false; - } - /** * @param array $aliased_classes */ diff --git a/src/Psalm/Type/Atomic/TTemplateParamClass.php b/src/Psalm/Type/Atomic/TTemplateParamClass.php index 6dca3507d..3464dfe6b 100644 --- a/src/Psalm/Type/Atomic/TTemplateParamClass.php +++ b/src/Psalm/Type/Atomic/TTemplateParamClass.php @@ -49,24 +49,6 @@ class TTemplateParamClass extends TClassString return 'class-string<' . $this->param_name . '>'; } - /** - * @param array $aliased_classes - */ - public function toPhpString( - ?string $namespace, - array $aliased_classes, - ?string $this_class, - int $php_major_version, - int $php_minor_version - ): ?string { - return 'string'; - } - - public function canBeFullyExpressedInPhp(int $php_major_version, int $php_minor_version): bool - { - return false; - } - /** * @param array $aliased_classes * @@ -80,8 +62,4 @@ class TTemplateParamClass extends TClassString return $this->param_name . '::class'; } - public function getChildNodes() : array - { - return $this->as_type ? [$this->as_type] : []; - } } diff --git a/src/Psalm/Type/Atomic/TTypeAlias.php b/src/Psalm/Type/Atomic/TTypeAlias.php index 197afd0a1..1003c288c 100644 --- a/src/Psalm/Type/Atomic/TTypeAlias.php +++ b/src/Psalm/Type/Atomic/TTypeAlias.php @@ -78,19 +78,6 @@ class TTypeAlias extends \Psalm\Type\Atomic return false; } - /** - * @param array $aliased_classes - * - */ - public function toNamespacedString( - ?string $namespace, - array $aliased_classes, - ?string $this_class, - bool $use_phpdoc_format - ): string { - return $this->getKey(); - } - public function getAssertionString(bool $exact = false): string { return 'mixed';