10000 Remove eval trick · symfony/symfony@fda9212 · GitHub
[go: up one dir, main page]

Skip to content

Commit fda9212

Browse files
committed
Remove eval trick
1 parent 076cd3c commit fda9212

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+102
-127
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ Additionally (see https://symfony.com/releases):
1616
- Never break backward compatibility (see https://symfony.com/bc).
1717
- Bug fixes must be submitted against the lowest maintained branch where they apply
1818
(lowest branches are regularly merged to upper ones so they get the fixes too.)
19-
- Features and deprecations must be submitted against branch 5.4.
19+
- Features and deprecations must be submitted against branch 5.x.
2020
- Changelog entry should follow https://symfony.com/doc/current/contributing/code/conventions.html#writing-a-changelog-entry
2121
-->

src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ public function provideUniquenessConstraints(): iterable
193193
'em' => self::EM_NAME,
194194
])];
195195

196-
yield 'Named arguments' => [eval('return new \Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity(message: "myMessage", fields: ["name"], em: "foo");')];
196+
yield 'Named arguments' => [new UniqueEntity(message: 'myMessage', fields: ['name'], em: 'foo')];
197197
}
198198

199199
/**
@@ -227,7 +227,7 @@ public function provideConstraintsWithCustomErrorPath(): iterable
227227
'errorPath' => 'bar',
228228
])];
229229

230-
yield 'Named arguments' => [eval('return new \Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity(message: "myMessage", fields: ["name"], em: "foo", errorPath: "bar");')];
230+
yield 'Named arguments' => [new UniqueEntity(message: 'myMessage', fields: ['name'], em: 'foo', errorPath: 'bar')];
231231
}
232232

233233
/**
@@ -286,7 +286,7 @@ public function provideConstraintsWithIgnoreNullDisabled(): iterable
286286
'ignoreNull' => false,
287287
])];
288288

289-
yield 'Named arguments' => [eval('return new \Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity(message: "myMessage", fields: ["name", "name2"], em: "foo", ignoreNull: false);')];
289+
yield 'Named arguments' => [new UniqueEntity(message: 'myMessage', fields: ['name', 'name2'], em: 'foo', ignoreNull: false)];
290290
}
291291

292292
/**
@@ -333,7 +333,7 @@ public function provideConstraintsWithIgnoreNullEnabled(): iterable
333333
'ignoreNull' => true,
334334
])];
335335

336-
yield 'Named arguments' => [eval('return new \Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity(message: "myMessage", fields: ["name", "name2"], em: "foo", ignoreNull: true);')];
336+
yield 'Named arguments' => [new UniqueEntity(message: 'myMessage', fields: ['name', 'name2'], em: 'foo', ignoreNull: true)];
337337
}
338338

339339
public function testValidateUniquenessWithValidCustomErrorPath()
@@ -432,7 +432,7 @@ public function provideConstraintsWithCustomRepositoryMethod(): iterable
432432
'repositoryMethod' => 'findByCustom',
433433
])];
434434

435-
yield 'Named arguments' => [eval('return new \Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity(message: "myMessage", fields: ["name"], em: "foo", repositoryMethod: "findByCustom");')];
435+
yield 'Named arguments' => [new UniqueEntity(message: 'myMessage', fields: ['name'], em: 'foo', repositoryMethod: 'findByCustom')];
436436
}
437437

438438
/**

src/Symfony/Component/DependencyInjection/EnvVarProcessor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ public function getEnv(string $prefix, string $name, \Closure $getEnv)
192192
return (string) $env;
193193
}
194194

195-
if (in_array($prefix, ['bool', 'not'], true)) {
195+
if (\in_array($prefix, ['bool', 'not'], true)) {
196196
$env = (bool) (filter_var($env, \FILTER_VALIDATE_BOOLEAN) ?: filter_var($env, \FILTER_VALIDATE_INT) ?: filter_var($env, \FILTER_VALIDATE_FLOAT));
197197

198198
return 'not' === $prefix ? !$env : $env;

src/Symfony/Component/HttpClient/Response/CommonResponseTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public function toArray(bool $throw = true): array
8989
}
9090

9191
try {
92-
$content = json_decode($content, true, 512, \JSON_BIGINT_AS_STRING | \JSON_THROW_ON_ERROR));
92+
$content = json_decode($content, true, 512, \JSON_BIGINT_AS_STRING | \JSON_THROW_ON_ERROR);
9393
} catch (\JsonException $e) {
9494
throw new JsonException($e->getMessage().sprintf(' for "%s".', $this->getInfo('url')), $e->getCode());
9595
}

src/Symfony/Component/HttpFoundation/Tests/Fixtures/response-functional/cookie_max_age.expected

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/Symfony/Component/HttpFoundation/Tests/Fixtures/response-functional/cookie_max_age.php

Lines changed: 0 additions & 10 deletions
This file was deleted.

src/Symfony/Component/HttpFoundation/Tests/ResponseFunctionalTest.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,6 @@ public static function tearDownAfterClass(): void
4242
*/
4343
public function testCookie($fixture)
4444
{
45-
if ('cookie_max_age' === $fixture) {
46-
$this->markTestSkipped('This fixture produces a fatal error on PHP 8.');
47-
}
48-
4945
$result = file_get_contents(sprintf< 179B /span>('http://localhost:8054/%s.php', $fixture));
5046
$this->assertStringMatchesFormatFile(__DIR__.sprintf('/Fixtures/response-functional/%s.expected', $fixture), $result);
5147
}

src/Symfony/Component/Security/Core/Tests/Validator/Constraints/UserPasswordTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function provideServiceValidatedConstraints(): iterable
3737
{
3838
yield 'Doctrine style' => [new UserPassword(['service' => 'my_service'])];
3939

40-
yield 'named arguments' => [eval('return new \Symfony\Component\Security\Core\Validator\Constraints\UserPassword(service: "my_service");')];
40+
yield 'named arguments' => [new UserPassword(service: "my_service")];
4141

4242
$metadata = new ClassMetadata(UserPasswordDummy::class);
4343
self::assertTrue((new AnnotationLoader())->loadClassMetadata($metadata));

src/Symfony/Component/Security/Core/Tests/Validator/Constraints/UserPasswordValidatorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public function provideConstraints(): iterable
9595
{
9696
yield 'Doctrine style' => [new UserPassword(['message' => 'myMessage'])];
9797

98-
yield 'named arguments' => [eval('return new \Symfony\Component\Security\Core\Validator\Constraints\UserPassword(message: "myMessage");')];
98+
yield 'named arguments' => [new UserPassword(message: "myMessage")];
9999
}
100100

101101
/**

src/Symfony/Component/Validator/Tests/Constraints/BicValidatorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ public function testInvalidBics($bic, $code)
223223
*/
224224
public function testInvalidBicsNamed($bic, $code)
225225
{
226-
$constraint = eval('return new \Symfony\Component\Validator\Constraints\Bic(message: "myMessage");');
226+
$constraint = new Bic(message: "myMessage");
227227

228228
$this->validator->validate($bic, $constraint);
229229

0 commit comments

Comments
 (0)
0