mirror of
https://github.com/danog/psalm.git
synced 2024-11-26 20:34:47 +01:00
ambiguous php version checks (#4331)
This commit is contained in:
parent
91e8e26937
commit
3ed70e3ca0
@ -10,7 +10,9 @@ class TAnonymousClassInstance extends TNamedObject
|
||||
int $php_major_version,
|
||||
int $php_minor_version
|
||||
): ?string {
|
||||
return $php_major_version >= 7 && $php_minor_version >= 2 ? 'object' : null;
|
||||
return $php_major_version > 7
|
||||
|| ($php_major_version === 7 && $php_minor_version >= 2)
|
||||
? 'object' : null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -23,7 +23,9 @@ class TCallableObject extends TObject
|
||||
int $php_major_version,
|
||||
int $php_minor_version
|
||||
): ?string {
|
||||
return $php_major_version >= 7 && $php_minor_version >= 2 ? 'object' : null;
|
||||
return $php_major_version > 7
|
||||
|| ($php_major_version === 7 && $php_minor_version >= 2)
|
||||
? 'object' : null;
|
||||
}
|
||||
|
||||
public function canBeFullyExpressedInPhp(): bool
|
||||
|
@ -23,7 +23,9 @@ class TVoid extends \Psalm\Type\Atomic
|
||||
int $php_major_version,
|
||||
int $php_minor_version
|
||||
): ?string {
|
||||
return $php_major_version >= 7 && $php_minor_version >= 1 ? $this->getKey() : null;
|
||||
return $php_major_version > 7
|
||||
|| ($php_major_version === 7 && $php_minor_version >= 1)
|
||||
? $this->getKey() : null;
|
||||
}
|
||||
|
||||
public function canBeFullyExpressedInPhp(): bool
|
||||
|
@ -452,7 +452,7 @@ class Union implements TypeNode
|
||||
|
||||
if (!$this->isSingleAndMaybeNullable()
|
||||
|| $php_major_version < 7
|
||||
|| (isset($this->types['null']) && $php_minor_version < 1)
|
||||
|| (isset($this->types['null']) && $php_major_version === 7 && $php_minor_version < 1)
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user