Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MethodSignatureRuleTest - test conditional return types
- Loading branch information
1 parent
84f64f0
commit 0127e50
Showing
2 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
tests/PHPStan/Rules/Methods/data/overriden-method-with-conditional-return-type.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
namespace OverridenMethodWithConditionalReturnType; | ||
|
||
class Foo | ||
{ | ||
|
||
/** | ||
* @return ($p is int ? int : string) | ||
*/ | ||
public function doFoo($p) | ||
{ | ||
|
||
} | ||
|
||
} | ||
|
||
class Bar extends Foo | ||
{ | ||
|
||
/** | ||
* @return ($p is int ? int : string) | ||
*/ | ||
public function doFoo($p) | ||
{ | ||
|
||
} | ||
|
||
} | ||
|
||
class Bar2 extends Foo | ||
{ | ||
|
||
/** | ||
* @return ($p is int ? \stdClass : string) | ||
*/ | ||
public function doFoo($p) | ||
{ | ||
|
||
} | ||
|
||
} |