8000 Remove obsolete PHP version checks by derrabus · Pull Request #52735 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

Remove obsolete PHP version checks #52735

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public function reset(): void
curl_share_setopt($this->share, \CURLSHOPT_SHARE, \CURL_LOCK_DATA_DNS);
curl_share_setopt($this->share, \CURLSHOPT_SHARE, \CURL_LOCK_DATA_SSL_SESSION);

if (\defined('CURL_LOCK_DATA_CONNECT') && \PHP_VERSION_ID >= 80000) {
if (\defined('CURL_LOCK_DATA_CONNECT')) {
curl_share_setopt($this->share, \CURLSHOPT_SHARE, \CURL_LOCK_DATA_CONNECT);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ public function getWriteInfo(string $class, string $property, array $context = [

if ($reflClass->hasProperty($property) && ($reflClass->getProperty($property)->getModifiers() & $this->propertyReflectionFlags)) {
$reflProperty = $reflClass->getProperty($property);
if (\PHP_VERSION_ID < 80100 || !$reflProperty->isReadOnly()) {
if (!$reflProperty->isReadOnly()) {
return new PropertyWriteInfo(PropertyWriteInfo::TYPE_PROPERTY, $property, $this->getWriteVisiblityForProperty($reflProperty), $reflProperty->isStatic());
}

Expand Down Expand Up @@ -578,7 +578,7 @@ private function isAllowedProperty(string $class, string $property, bool $writeA
try {
$reflectionProperty = new \ReflectionProperty($class, $property);

if (\PHP_VERSION_ID >= 80100 && $writeAccessRequired && $reflectionProperty->isReadOnly()) {
if ($writeAccessRequired && $reflectionProperty->isReadOnly()) {
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ class ConstraintValidatorTest extends TestCase
/**
* @dataProvider formatValueProvider
*/
public function testFormatValue($expected, $value, $format = 0)
public function testFormatValue(string $expected, mixed $value, int $format = 0)
{
\Locale::setDefault('en');

$this->assertSame($expected, (new TestFormatValueConstraintValidator())->formatValueProxy($value, $format));
}

public static function formatValueProvider()
public static function formatValueProvider(): array
{
$defaultTimezone = date_default_timezone_get();
date_default_timezone_set('Europe/Moscow'); // GMT+3
Expand All @@ -47,12 +47,9 @@ public static function formatValueProvider()
[class_exists(\IntlDateFormatter::class) ? 'Feb 2, 1971, 8:00 AM' : '1971-02-02 08:00:00', $dateTime, ConstraintValidator::PRETTY_DATE],
[class_exists(\IntlDateFormatter::class) ? 'Jan 1, 1970, 6:00 AM' : '1970-01-01 06:00:00', new \DateTimeImmutable('1970-01-01T06:00:00Z'), ConstraintValidator::PRETTY_DATE],
[class_exists(\IntlDateFormatter::class) ? 'Jan 1, 1970, 3:00 PM' : '1970-01-01 15:00:00', (new \DateTimeImmutable('1970-01-01T23:00:00'))->setTimezone(new \DateTimeZone('America/New_York')), ConstraintValidator::PRETTY_DATE],
['FirstCase', TestEnum::FirstCase],
];

if (\PHP_VERSION_ID >= 80100) {
$data[] = ['FirstCase', TestEnum::FirstCase];
}

date_default_timezone_set($defaultTimezone);

return $data;
Expand Down
0