mirror of
https://github.com/danog/psalm.git
synced 2025-01-21 21:31:13 +01:00
Fix #4350 - numeric-string should not get replaced
This commit is contained in:
parent
234eae6ad0
commit
76986eb003
@ -3,19 +3,6 @@ namespace Psalm\Type\Atomic;
|
||||
|
||||
abstract class Scalar extends \Psalm\Type\Atomic
|
||||
{
|
||||
/**
|
||||
* @param array<string> $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 ? $this->getKey() : null;
|
||||
}
|
||||
|
||||
public function canBeFullyExpressedInPhp(): bool
|
||||
{
|
||||
return true;
|
||||
|
@ -12,4 +12,17 @@ class TFloat extends Scalar
|
||||
{
|
||||
return 'float';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string> $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;
|
||||
}
|
||||
}
|
||||
|
@ -12,4 +12,17 @@ class TInt extends Scalar
|
||||
{
|
||||
return 'int';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string> $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;
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,19 @@ namespace Psalm\Type\Atomic;
|
||||
|
||||
class TString extends Scalar
|
||||
{
|
||||
/**
|
||||
* @param array<string> $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;
|
||||
}
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return 'string';
|
||||
|
Loading…
x
Reference in New Issue
Block a user