-
-
Notifications
You must be signed in to change notification settings - Fork 337
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix StrictArrayParamDimFetchRector for string access
- Loading branch information
1 parent
3cef752
commit eef1826
Showing
4 changed files
with
67 additions
and
1 deletion.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
...assMethod/ReturnTypeFromStrictTypedCallRector/Fixture/return_self_different_namespace.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,18 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictTypedCallRector\Fixture; | ||
|
||
use Rector\Tests\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictTypedCallRector\Source\ReturnSelfFromSource; | ||
|
||
final class ReturnSelfDifferentNamespace | ||
{ | ||
public function run() | ||
{ | ||
return | ||
array_map(function () { | ||
return ReturnSelfFromSource::fromEvent(); | ||
}, ['event']); | ||
} | ||
} | ||
|
||
?> |
22 changes: 22 additions & 0 deletions
22
...ration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/twice_same_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,22 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictTypedCallRector\Fixture; | ||
|
||
final class TwiceSameType | ||
{ | ||
public function getData() | ||
{ | ||
if (mt_rand(0, 100)) { | ||
return $this->getNumber(100); | ||
} | ||
|
||
return $this->getNumber(10); | ||
} | ||
|
||
private function getNumber(int $value): int | ||
{ | ||
return $value; | ||
} | ||
} | ||
|
||
?> |
17 changes: 17 additions & 0 deletions
17
...tor/ClassMethod/StrictArrayParamDimFetchRector/Fixture/skip_array_possible_string.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,17 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\TypeDeclaration\Rector\ClassMethod\StrictArrayParamDimFetchRector\Fixture; | ||
|
||
final class SkipArrayPossibleString | ||
{ | ||
public function resolve($number) | ||
{ | ||
$check = 0; | ||
|
||
for ($i = 0; $i < strlen($number); $i++) { | ||
$check = $number[$i]; | ||
} | ||
|
||
return $check; | ||
} | ||
} |
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