Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 634bab3

Browse files
committed
Merge branch '6.1' into 6.2
* 6.1: Add Github token permissions for workflows ci: Add GitHub token permissions for workflows add missing basque translations Fix typographical error in exception message in InputBag class [DoctrineBridge] Fix comment for type on Query::setValue (middlewares)
2 parents 4675b31 + 289bc03 commit 634bab3

File tree

11 files changed

+60
-10
lines changed

11 files changed

+60
-10
lines changed

.github/workflows/integration-tests.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ concurrency:
1212
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
1313
cancel-in-progress: true
1414

15+
permissions:
16+
contents: read
17+
1518
jobs:
1619

1720
tests:

.github/workflows/intl-data-tests.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ concurrency:
1616
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
1717
cancel-in-progress: true
1818

19+
permissions:
20+
contents: read
21+
1922
jobs:
2023
tests:
2124
name: Tests

.github/workflows/package-tests.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
paths:
66
- src/**
77

8+
permissions:
9+
contents: read
10+
811
jobs:
912
verify:
1013
name: Verify

.github/workflows/phpunit-bridge.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ concurrency:
1616
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
1717
cancel-in-progress: true
1818

19+
permissions:
20+
contents: read
21+
1922
jobs:
2023
lint:
2124
name: Lint

.github/workflows/psalm.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ concurrency:
1111
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
1212
cancel-in-progress: true
1313

14+
permissions:
15+
contents: read
16+
1417
jobs:
1518
psalm:
1619
name: Psalm

.github/workflows/unit-tests.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ concurrency:
1212
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
1313
cancel-in-progress: true
1414

15+
permissions:
16+
contents: read
17+
1518
jobs:
1619

1720
tests:

src/Symfony/Bridge/Doctrine/Middleware/Debug/Query.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function setParam(string|int $param, null|string|int|float|bool &$variabl
5252
$this->types[$idx] = $type;
5353
}
5454

55-
public function setValue(string|int $param, null|string|int|float|bool $value, int $type): void
55+
public function setValue(string|int $param, mixed $value, int $type): void
5656
{
5757
// Numeric indexes start at 0 in profiler
5858
$idx = \is_int($param) ? $param - 1 : $param;

src/Symfony/Bridge/Doctrine/Tests/Middleware/Debug/MiddlewareTest.php

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Doctrine\DBAL\DriverManager;
1818
use Doctrine\DBAL\ParameterType;
1919
use Doctrine\DBAL\Statement;
20+
use Doctrine\DBAL\Types\Types;
2021
use PHPUnit\Framework\TestCase;
2122
use Symfony\Bridge\Doctrine\Middleware\Debug\DebugDataHolder;
2223
use Symfony\Bridge\Doctrine\Middleware\Debug\Middleware;
@@ -61,11 +62,22 @@ private function init(bool $withStopwatch = true): void
6162
id INTEGER PRIMARY KEY,
6263
name TEXT NOT NULL,
6364
price REAL NOT NULL,
64-
stock INTEGER NOT NULL
65+
stock INTEGER NOT NULL,
66+
picture BLOB NULL,
67+
tags TEXT NULL,
68+
created_at TEXT NULL
6569
);
6670
EOT);
6771
}
6872

73+
private function getResourceFromString(string $str)
74+
{
75+
$res = fopen('php://temp', 'r+');
76+
fwrite($res, $str);
77+
78+
return $res;
79+
}
80+
6981
public function provideExecuteMethod(): array
7082
{
7183
return [
@@ -102,18 +114,26 @@ public function testWithValueBound(callable $executeMethod)
102114
{
103115
$this->init();
104116

105-
$stmt = $this->conn->prepare('INSERT INTO products(name, price, stock) VALUES (?, ?, ?)');
117+
$sql = <<<EOT
118+
INSERT INTO products(name, price, stock, picture, tags, created_at)
119+
VALUES (?, ?, ?, ?, ?, ?)
120+
EOT;
121+
122+
$stmt = $this->conn->prepare($sql);
106123
$stmt->bindValue(1, 'product1');
107124
$stmt->bindValue(2, 12.5);
108125
$stmt->bindValue(3, 5, ParameterType::INTEGER);
126+
$stmt->bindValue(4, $res = $this->getResourceFromString('mydata'), ParameterType::BINARY);
127+
$stmt->bindValue(5, ['foo', 'bar'], Types::SIMPLE_ARRAY);
128+
$stmt->bindValue(6, new \DateTime('2022-06-12 11:00:00'), Types::DATETIME_MUTABLE);
109129

110130
$executeMethod($stmt);
111131

112132
$debug = $this->debugDataHolder->getData()['default'] ?? [];
113133
$this->assertCount(2, $debug);
114-
$this->assertSame('INSERT INTO products(name, price, stock) VALUES (?, ?, ?)', $debug[1]['sql']);
115-
$this->assertSame(['product1', 12.5, 5], $debug[1]['params']);
116-
$this->assertSame([ParameterType::STRING, ParameterType::STRING, ParameterType::INTEGER], $debug[1]['types']);
134+
$this->assertSame($sql, $debug[1]['sql']);
135+
$this->assertSame(['product1', 12.5, 5, $res, 'foo,bar', '2022-06-12 11:00:00'], $debug[1]['params']);
136+
$this->assertSame([ParameterType::STRING, ParameterType::STRING, ParameterType::INTEGER, ParameterType::BINARY, ParameterType::STRING, ParameterType::STRING], $debug[1]['types']);
117137
$this->assertGreaterThan(0, $debug[1]['executionMS']);
118138
}
119139

src/Symfony/Component/HttpFoundation/InputBag.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ final class InputBag extends ParameterBag
2828
public function get(string $key, mixed $default = null): string|int|float|bool|null
2929
{
3030
if (null !== $default && !\is_scalar($default) && !$default instanceof \Stringable) {
31-
throw new \InvalidArgumentException(sprintf('Excepted a scalar value as a 2nd argument to "%s()", "%s" given.', __METHOD__, get_debug_type($default)));
31+
throw new \InvalidArgumentException(sprintf('Expected a scalar value as a 2nd argument to "%s()", "%s" given.', __METHOD__, get_debug_type($default)));
3232
}
3333

3434
$value = parent::get($key, $this);
@@ -67,7 +67,7 @@ public function add(array $inputs = [])
6767
public function set(string $key, mixed $value)
6868
{
6969
if (null !== $value && !\is_scalar($value) && !\is_array($value) && !$value instanceof \Stringable) {
70-
throw new \InvalidArgumentException(sprintf('Excepted a scalar, or an array as a 2nd argument to "%s()", "%s" given.', __METHOD__, get_debug_type($value)));
70+
throw new \InvalidArgumentException(sprintf('Expected a scalar, or an array as a 2nd argument to "%s()", "%s" given.', __METHOD__, get_debug_type($value)));
7171
}
7272

7373
$this->parameters[$key] = $value;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function testFilterClosure()
6868
public function testSetWithNonScalarOrArray()
6969
{
7070
$this->expectException(\InvalidArgumentException::class);
71-
$this->expectExceptionMessage('Excepted a scalar, or an array as a 2nd argument to "Symfony\Component\HttpFoundation\InputBag::set()", "Symfony\Component\HttpFoundation\InputBag" given.');
71+
$this->expectExceptionMessage('Expected a scalar, or an array as a 2nd argument to "Symfony\Component\HttpFoundation\InputBag::set()", "Symfony\Component\HttpFoundation\InputBag" given.');
7272

7373
$bag = new InputBag();
7474
$bag->set('foo', new InputBag());
@@ -86,7 +86,7 @@ public function testGettingANonStringValue()
8686
public function testGetWithNonStringDefaultValue()
8787
{
8888
$this->expectException(\InvalidArgumentException::class);
89-
$this->expectExceptionMessage('Excepted a scalar value as a 2nd argument to "Symfony\Component\HttpFoundation\InputBag::get()", "array" given.');
89+
$this->expectExceptionMessage('Expected a scalar value as a 2nd argument to "Symfony\Component\HttpFoundation\InputBag::get()", "array" given.');
9090

9191
$bag = new InputBag(['foo' => 'bar']);
9292
$bag->get('foo', ['a', 'b']);

src/Symfony/Component/Validator/Resources/translations/validators.eu.xlf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,18 @@
390390
<source>This value should be a valid expression.</source>
391391
<target>Balio hori baliozko adierazpena izan beharko litzateke.</target>
392392
</trans-unit>
393+
<trans-unit id="101">
394+
<source>This value is not a valid CSS color.</source>
395+
<target>Balio hori ez da baliozko CSS kolorea.</target>
396+
</trans-unit>
397+
<trans-unit id="102">
398+
<source>This value is not a valid CIDR notation.</source>
399+
<target>Balio hori ez da baliozko CIDR notazioa.</target>
400+
</trans-unit>
401+
<trans-unit id="103">
402+
<source>The value of the netmask should be between {{ min }} and {{ max }}.</source>
403+
<target>Maskararen balioa {{ min }} eta {{ max }} artekoa izan beharko litzateke.</target>
404+
</trans-unit>
393405
</body>
394406
</file>
395407
</xliff>

0 commit comments

Comments
 (0)