Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 28662cd

Browse filesBrowse files
committed
[PropertyInfo] Support for the never return type
Signed-off-by: Alexander M. Turek <me@derrabus.de>
1 parent 83357b1 commit 28662cd
Copy full SHA for 28662cd

File tree

Expand file treeCollapse file tree

4 files changed

+22
-2
lines changed
Filter options
Expand file treeCollapse file tree

4 files changed

+22
-2
lines changed

‎.github/patch-types.php

Copy file name to clipboardExpand all lines: .github/patch-types.php
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
case false !== strpos($file, '/src/Symfony/Component/ErrorHandler/Tests/Fixtures/'):
4343
case false !== strpos($file, '/src/Symfony/Component/PropertyInfo/Tests/Fixtures/Dummy.php'):
4444
case false !== strpos($file, '/src/Symfony/Component/PropertyInfo/Tests/Fixtures/ParentDummy.php'):
45+
case false !== strpos($file, '/src/Symfony/Component/PropertyInfo/Tests/Fixtures/Php81Dummy.php'):
4546
case false !== strpos($file, '/src/Symfony/Component/Serializer/Tests/Normalizer/Features/ObjectOuter.php'):
4647
case false !== strpos($file, '/src/Symfony/Component/VarDumper/Tests/Fixtures/NotLoadableClass.php'):
4748
case false !== strpos($file, '/src/Symfony/Component/VarDumper/Tests/Fixtures/ReflectionIntersectionTypeFixture.php'):

‎src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ private function extractFromReflectionType(\ReflectionType $reflectionType, \Ref
335335

336336
foreach ($reflectionType instanceof \ReflectionUnionType ? $reflectionType->getTypes() : [$reflectionType] as $type) {
337337
$phpTypeOrClass = $reflectionType instanceof \ReflectionNamedType ? $reflectionType->getName() : (string) $type;
338-
if ('null' === $phpTypeOrClass || 'mixed' === $phpTypeOrClass) {
338+
if ('null' === $phpTypeOrClass || 'mixed' === $phpTypeOrClass || 'never' === $phpTypeOrClass) {
339339
continue;
340340
}
341341

‎src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php
+9-1Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ public function php71TypesProvider()
233233
}
234234

235235
/**
236-
* * @dataProvider php80TypesProvider
236+
* @dataProvider php80TypesProvider
237237
* @requires PHP 8
238238
*/
239239
public function testExtractPhp80Type($property, array $type = null)
@@ -255,6 +255,14 @@ public function php80TypesProvider()
255255
];
256256
}
257257

258+
/**
259+
* @requires PHP 8.1
260+
*/
261+
public function testExtractPhp81Type()
262+
{
263+
$this->assertEquals(null, $this->extractor->getTypes('Symfony\Component\PropertyInfo\Tests\Fixtures\Php81Dummy', 'nothing', []));
264+
}
265+
258266
/**
259267
* @dataProvider defaultValueProvider
260268
*/
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
namespace Symfony\Component\PropertyInfo\Tests\Fixtures;
4+
5+
class Php81Dummy
6+
{
7+
public function getNothing(): never
8+
{
9+
throw new \Exception('Oops');
10+
}
11+
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.