-
-
Notifications
You must be signed in to change notification settings - Fork 336
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Core] Use PropertyFetchAnalyzer::isFilledViaMethodCallInConstructStm…
…ts() in ConstructorAssignDetector::isPropertyAssigned() (#2351) * [Core] Use PropertyFetchAnalyzer::isFilledViaMethodCallInConstructStmts() in ConstructorAssignDetector::isPropertyAssigned() * more * [ci-review] Rector Rectify * [ci-review] Rector Rectify * [ci-review] Rector Rectify * [ci-review] Rector Rectify * add test for self static * more tests * phpstan * [ci-review] Rector Rectify * StaticPropertyFetch detection fix * final touch: clean up: donot create object when not needed * final touch: clean up * final touch: clean up * [ci-review] Rector Rectify * [ci-review] Rector Rectify * [ci-review] Rector Rectify Co-authored-by: GitHub Action <action@github.com>
- Loading branch information
1 parent
f134b61
commit 1691157
Showing
7 changed files
with
139 additions
and
56 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
...ountOnNullRector/Fixture/skip_property_array_filled_by_construct_via_method_call2.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,24 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\Php71\Rector\FuncCall\CountOnNullRector\Fixture; | ||
|
||
final class SkipPropertyArrayFilledByConstructViaMethodCall2 | ||
{ | ||
/** @var array */ | ||
private static $property; | ||
|
||
public function __construct() | ||
{ | ||
self::fill(); | ||
} | ||
|
||
private static function fill() | ||
{ | ||
self::$property = []; | ||
} | ||
|
||
public static function run(): int | ||
{ | ||
return count(self::$property); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
...ountOnNullRector/Fixture/skip_property_array_filled_by_construct_via_method_call3.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,21 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\Php71\Rector\FuncCall\CountOnNullRector\Fixture; | ||
|
||
use Rector\Tests\Php71\Rector\FuncCall\CountOnNullRector\Source\ParentFiller; | ||
|
||
final class SkipPropertyArrayFilledByConstructViaMethodCall3 extends ParentFiller | ||
{ | ||
/** @var array */ | ||
public static $property; | ||
|
||
public function __construct() | ||
{ | ||
parent::fill(); | ||
} | ||
|
||
public static function run(): int | ||
{ | ||
return count(static::$property); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
rules-tests/Php71/Rector/FuncCall/CountOnNullRector/Source/ParentFiller.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,13 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Rector\Tests\Php71\Rector\FuncCall\CountOnNullRector\Source; | ||
|
||
class ParentFiller | ||
{ | ||
public static function fill() | ||
{ | ||
static::$property = []; | ||
} | ||
} |
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
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
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
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