Skip to content

Commit a8a68f1

Browse files
VincentLangletondrejmirtes
authored andcommitted
Add non regression test
1 parent c28bd50 commit a8a68f1

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

tests/PHPStan/Rules/Methods/ReturnTypeRuleTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,6 +1239,11 @@ public function testBug4443(): void
12391239
]);
12401240
}
12411241

1242+
public function testBug13043(): void
1243+
{
1244+
$this->analyse([__DIR__ . '/data/bug-13043.php'], []);
1245+
}
1246+
12421247
public function testBug12928(): void
12431248
{
12441249
$this->analyse([__DIR__ . '/data/bug-12928.php'], [
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php declare(strict_types = 1);
2+
3+
namespace Bug13043;
4+
5+
class HelloWorld
6+
{
7+
private string $prefix = '';
8+
9+
/** @var non-empty-string $name */
10+
private string $name = 'identifier';
11+
12+
/** @return non-empty-string */
13+
public function getPrefixedName(): string
14+
{
15+
$name = $this->prefix;
16+
17+
$search = str_split('()<>@');
18+
$replace = array_map(rawurlencode(...), $search);
19+
20+
$name .= str_replace($search, $replace, $this->name);
21+
22+
return $name;
23+
}
24+
}

0 commit comments

Comments
 (0)