-
Notifications
You must be signed in to change notification settings - Fork 430
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes phpstan/phpstan#2268 Closes phpstan/phpstan#2298 Closes phpstan/phpstan#1903
- Loading branch information
1 parent
9b1c0c8
commit 63bc2b2
Showing
6 changed files
with
107 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
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 Bug2268; | ||
|
||
abstract class Message implements \ArrayAccess | ||
{ | ||
/** | ||
* @param string $value | ||
*/ | ||
abstract public function offsetSet($key, $value); | ||
} | ||
|
||
|
||
function test(Message $data) | ||
{ | ||
if (isset($data['name'])) { | ||
$data['name'] = 1; | ||
} | ||
|
||
test($data); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
namespace Bug1903; | ||
|
||
class Test | ||
{ | ||
|
||
private $answersOrder = []; | ||
|
||
public function doFoo(string $qId): array | ||
{ | ||
if (null !== $this->answersOrder[$qId]) { | ||
return $this->answersOrder[$qId]; | ||
} | ||
|
||
|
||
$this->answersOrder[$qId] = 5; | ||
|
||
return $this->answersOrder[$qId]; | ||
} | ||
|
||
} |
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,40 @@ | ||
<?php | ||
|
||
namespace Bug2298; | ||
|
||
abstract class BitbucketDriver | ||
{ | ||
|
||
/** | ||
* @var VcsDriver | ||
*/ | ||
protected $fallbackDriver; | ||
|
||
protected $rootIdentifier; | ||
|
||
} | ||
|
||
class HgBitbucketDriver extends BitbucketDriver | ||
{ | ||
|
||
public function getRootIdentifier(): string | ||
{ | ||
if ($this->fallbackDriver) { | ||
return $this->fallbackDriver->getRootIdentifier(); | ||
} | ||
|
||
if (null === $this->rootIdentifier) { | ||
return $this->fallbackDriver->getRootIdentifier(); | ||
} | ||
|
||
return 'foo'; | ||
} | ||
|
||
} | ||
|
||
interface VcsDriver | ||
{ | ||
|
||
public function getRootIdentifier(): string; | ||
|
||
} |