Skip to content

Commit 24e4974

Browse files
authored
Merge pull request #1017 from doctrine/3.4.x-merge-up-into-3.5.x_ERxP2qhI
Merge release 3.4.5 into 3.5.x
2 parents 6b266d6 + 6c8fef9 commit 24e4974

8 files changed

+31
-11
lines changed

.github/dependabot.yml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
labels:
8+
- "CI"

.github/workflows/coding-standards.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ on:
1212
jobs:
1313
coding-standards:
1414
name: "Coding Standards"
15-
uses: "doctrine/.github/.github/workflows/coding-standards.yml@1.4.0"
15+
uses: "doctrine/.github/.github/workflows/coding-standards.yml@5.1.0"
1616
with:
1717
php-version: "7.4"

.github/workflows/continuous-integration.yml

+4-2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ env:
1515
jobs:
1616
phpunit:
1717
name: "PHPUnit"
18-
uses: "doctrine/.github/.github/workflows/continuous-integration.yml@1.1.1"
18+
uses: "doctrine/.github/.github/workflows/continuous-integration.yml@5.1.0"
1919
with:
20-
php-versions: '["7.1", "7.2", "7.3", "7.4", "8.0", "8.1", "8.2"]'
20+
php-versions: '["7.1", "7.2", "7.3", "7.4", "8.0", "8.1", "8.2", "8.3", "8.4"]'
21+
secrets:
22+
CODECOV_TOKEN: "${{ secrets.CODECOV_TOKEN }}"

.github/workflows/release-on-milestone-closed.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
jobs:
99
release:
1010
name: "Git tag, release & create merge-up PR"
11-
uses: "doctrine/.github/.github/workflows/release-on-milestone-closed.yml@1.4.1"
11+
uses: "doctrine/.github/.github/workflows/release-on-milestone-closed.yml@5.1.0"
1212
secrets:
1313
GIT_AUTHOR_EMAIL: ${{ secrets.GIT_AUTHOR_EMAIL }}
1414
GIT_AUTHOR_NAME: ${{ secrets.GIT_AUTHOR_NAME }}

.github/workflows/static-analysis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ on:
1212
jobs:
1313
static-analysis:
1414
name: "Static Analysis"
15-
uses: "doctrine/.github/.github/workflows/static-analysis.yml@1.4.0"
15+
uses: "doctrine/.github/.github/workflows/static-analysis.yml@5.1.0"
1616
with:
1717
php-version: "8.1"

src/Proxy/ProxyGenerator.php

-1
Original file line numberDiff line numberDiff line change
@@ -1284,7 +1284,6 @@ function (ReflectionType $intersectedType) use ($method, $parameter) {
12841284
if (
12851285
$type->allowsNull()
12861286
&& ! in_array($name, ['mixed', 'null'], true)
1287-
&& ($parameter === null || ! $parameter->isDefaultValueAvailable() || $parameter->getDefaultValue() !== null)
12881287
) {
12891288
$name = '?' . $name;
12901289
}

tests/Common/Proxy/Php8UnionTypes.php

+6
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,16 @@ class Php8UnionTypes
1212

1313
public function setValue(stdClass|array $value) : bool|float
1414
{
15+
return true;
1516
}
1617

1718
public function setNullableValue(stdClass|array|null $value) : bool|float|null
1819
{
20+
return true;
1921
}
2022

23+
public function setNullableValueDefaultNull(stdClass|array|null $value = null) : bool|float|null
24+
{
25+
return true;
26+
}
2127
}

tests/Common/Proxy/ProxyGeneratorTest.php

+10-5
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ public function testClassWithScalarTypeHintsOnProxiedMethods()
180180
self::assertEquals(1, substr_count($classCode, 'function combinationOfTypeHintsAndNormal(\stdClass $a, \Countable $b, $c, int $d)'));
181181
self::assertEquals(1, substr_count($classCode, 'function typeHintsWithVariadic(int ...$foo)'));
182182
self::assertEquals(1, substr_count($classCode, 'function withDefaultValue(int $foo = 123)'));
183-
self::assertEquals(1, substr_count($classCode, 'function withDefaultValueNull(int $foo = NULL)'));
183+
self::assertEquals(1, substr_count($classCode, 'function withDefaultValueNull(?int $foo = NULL)'));
184184
}
185185

186186
public function testClassWithReturnTypesOnProxiedMethods()
@@ -220,8 +220,8 @@ public function testClassWithNullableTypeHintsOnProxiedMethods()
220220
self::assertEquals(1, substr_count($classCode, 'function nullableTypeHintObject(?\stdClass $param)'));
221221
self::assertEquals(1, substr_count($classCode, 'function nullableTypeHintSelf(?\\' . $className . ' $param)'));
222222
self::assertEquals(1, substr_count($classCode, 'function nullableTypeHintWithDefault(?int $param = 123)'));
223-
self::assertEquals(1, substr_count($classCode, 'function nullableTypeHintWithDefaultNull(int $param = NULL)'));
224-
self::assertEquals(1, substr_count($classCode, 'function notNullableTypeHintWithDefaultNull(int $param = NULL)'));
223+
self::assertEquals(1, substr_count($classCode, 'function nullableTypeHintWithDefaultNull(?int $param = NULL)'));
224+
self::assertEquals(1, substr_count($classCode, 'function notNullableTypeHintWithDefaultNull(?int $param = NULL)'));
225225
}
226226

227227
public function testClassWithNullableReturnTypesOnProxiedMethods()
@@ -259,7 +259,7 @@ public function testClassWithNullableOptionalNonLastParameterOnProxiedMethods()
259259
}
260260

261261
self::assertStringContainsString(
262-
'public function midSignatureNullableParameter(\stdClass $param = NULL, $secondParam)',
262+
'public function midSignatureNullableParameter(?\stdClass $param = NULL, $secondParam)',
263263
file_get_contents(__DIR__ . '/generated/__CG__DoctrineTestsCommonProxyNullableNonOptionalHintClass.php')
264264
);
265265

@@ -287,7 +287,7 @@ public function testClassWithPhp71NullableOptionalNonLastParameterOnProxiedMetho
287287
}
288288

289289
self::assertStringContainsString(
290-
'public function midSignatureNullableParameter(string $param = NULL, $secondParam)',
290+
'public function midSignatureNullableParameter(?string $param = NULL, $secondParam)',
291291
file_get_contents(__DIR__ . '/generated/__CG__DoctrineTestsCommonProxyPhp71NullableDefaultedNonOptionalHintClass.php'),
292292
'Signature allows nullable type, although explicit "?" marker isn\'t used in the proxy'
293293
);
@@ -460,6 +460,11 @@ public function testPhp8UnionTypes()
460460
'setNullableValue(\stdClass|array|null $value): float|bool|null',
461461
file_get_contents(__DIR__ . '/generated/__CG__DoctrineTestsCommonProxyPhp8UnionTypes.php')
462462
);
463+
464+
self::assertStringContainsString(
465+
'setNullableValueDefaultNull(\stdClass|array|null $value = NULL): float|bool|null',
466+
file_get_contents(__DIR__ . '/generated/__CG__DoctrineTestsCommonProxyPhp8UnionTypes.php')
467+
);
463468
}
464469

465470
/**

0 commit comments

Comments
 (0)