diff --git a/src/Psalm/Type/Atomic/TAnonymousClassInstance.php b/src/Psalm/Type/Atomic/TAnonymousClassInstance.php index 4c29dc84c..8b6a264a3 100644 --- a/src/Psalm/Type/Atomic/TAnonymousClassInstance.php +++ b/src/Psalm/Type/Atomic/TAnonymousClassInstance.php @@ -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; } /** diff --git a/src/Psalm/Type/Atomic/TCallableObject.php b/src/Psalm/Type/Atomic/TCallableObject.php index af4cc4287..1272d877c 100644 --- a/src/Psalm/Type/Atomic/TCallableObject.php +++ b/src/Psalm/Type/Atomic/TCallableObject.php @@ -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 diff --git a/src/Psalm/Type/Atomic/TVoid.php b/src/Psalm/Type/Atomic/TVoid.php index d73e19b0d..c8f30eb03 100644 --- a/src/Psalm/Type/Atomic/TVoid.php +++ b/src/Psalm/Type/Atomic/TVoid.php @@ -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 diff --git a/src/Psalm/Type/Union.php b/src/Psalm/Type/Union.php index 8dd4ecaf4..1a46299a1 100644 --- a/src/Psalm/Type/Union.php +++ b/src/Psalm/Type/Union.php @@ -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; }