Skip to content

Commit

Permalink
Merge pull request #1413 from staabm/dep-fix
Browse files Browse the repository at this point in the history
Fix non-version dependent deprecations
  • Loading branch information
Ocramius authored Mar 23, 2024
2 parents 1926b26 + 3fb2a1c commit 37e990f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -692,12 +692,10 @@ private function isDeprecatedByPhpDocInPhpVersion(Node\Expr\FuncCall $node): boo
$patch = $matches[3] ?? 0;
$versionId = sprintf('%d%02d%02d', $major, $minor, $patch);

if ($this->phpVersion >= $versionId) {
return true;
}
return $this->phpVersion >= $versionId;
}

return false;
return true;
}

private function isDeprecatedInPhpVersion(Node\Stmt\ClassLike|Node\Stmt\ClassConst|Node\Stmt\Property|Node\Stmt\ClassMethod|Node\Stmt\Function_ $node): bool
Expand Down
9 changes: 9 additions & 0 deletions test/unit/Reflection/ReflectionConstantTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -338,4 +338,13 @@ public function testIsDeprecated(string $docComment, bool $isDeprecated): void

self::assertSame($isDeprecated, $constantReflection->isDeprecated());
}

public function testIsCurloptFtpSslConstantDeprecated(): void
{
$betterReflection = BetterReflectionSingleton::instance();
$reflector = new DefaultReflector($betterReflection->sourceLocator());
$constantReflection = $reflector->reflectConstant('CURLOPT_FTP_SSL');

self::assertTrue($constantReflection->isDeprecated());
}
}

0 comments on commit 37e990f

Please sign in to comment.