Skip to content

Commit e653c9b

Browse files
committed
Create wrong_typed_constant_returns.php.inc
1 parent 9a6bf91 commit e653c9b

1 file changed

Lines changed: 55 additions & 0 deletions

File tree

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<?php
2+
3+
namespace Rector\Tests\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictTypedCallRector\Fixture;
4+
5+
final class WrongTypedIntConstant
6+
{
7+
/**
8+
* @var string
9+
*/
10+
const WRONG_TYPED = 0;
11+
12+
public function getData()
13+
{
14+
if (rand(0,1)) {
15+
return self::WRONG_TYPED;
16+
}
17+
18+
return $this->getInt();
19+
}
20+
21+
public function getInt(): int
22+
{
23+
24+
}
25+
}
26+
27+
?>
28+
-----
29+
<?php
30+
31+
namespace Rector\Tests\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictTypedCallRector\Fixture;
32+
33+
final class WrongTypedIntConstant
34+
{
35+
/**
36+
* @var string
37+
*/
38+
const WRONG_TYPED = 0;
39+
40+
public function getData(): int
41+
{
42+
if (rand(0,1)) {
43+
return self::WRONG_TYPED;
44+
}
45+
46+
return $this->getInt();
47+
}
48+
49+
public function getInt(): int
50+
{
51+
52+
}
53+
}
54+
55+
?>

0 commit comments

Comments
 (0)