Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix getter method property substitution when the readable types don't…
… match.
- Loading branch information
Brad Miller
committed
Jul 15, 2022
1 parent
db7012e
commit 3aa4ff0
Showing
2 changed files
with
50 additions
and
2 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
...ch/ExplicitMethodCallOverMagicGetSetRector/Fixture/skip_no_method_matching_return.php.inc
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,37 @@ | ||
<?php | ||
|
||
namespace Carbon; | ||
|
||
/** | ||
* @property-read int $dayOfWeek | ||
*/ | ||
final class Carbon { | ||
/** | ||
* @param int $day | ||
* | ||
* @return bool | ||
*/ | ||
public function isDayOfWeek($day) | ||
{ | ||
return $day === 1; | ||
} | ||
|
||
public function __get() | ||
{ | ||
|
||
} | ||
} | ||
|
||
final class DemoFile | ||
{ | ||
public $weekday; | ||
public function run() | ||
{ | ||
$carbon = new Carbon(); | ||
if ($this->weekday === $carbon->dayOfWeek) { | ||
return 1; | ||
} | ||
|
||
return 0; | ||
} | ||
} |
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