-
Notifications
You must be signed in to change notification settings - Fork 473
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e501091
commit fa5f8ec
Showing
6 changed files
with
209 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
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,74 @@ | ||
<?php | ||
|
||
namespace Bug4500TypeInference; | ||
|
||
use function PHPStan\Analyser\assertType; | ||
|
||
class Foo | ||
{ | ||
|
||
public function doFirst(): void | ||
{ | ||
global $foo; | ||
assertType('mixed', $foo); | ||
} | ||
|
||
public function doFoo(): void | ||
{ | ||
/** @var int */ | ||
global $foo; | ||
assertType('int', $foo); | ||
} | ||
|
||
public function doBar(): void | ||
{ | ||
/** @var int $foo */ | ||
global $foo; | ||
assertType('int', $foo); | ||
} | ||
|
||
public function doBaz(): void | ||
{ | ||
/** @var int */ | ||
global $foo, $bar; | ||
assertType('mixed', $foo); | ||
assertType('mixed', $bar); | ||
} | ||
|
||
public function doLorem(): void | ||
{ | ||
/** @var int $foo */ | ||
global $foo, $bar; | ||
assertType('int', $foo); | ||
assertType('mixed', $bar); | ||
|
||
$baz = 'foo'; | ||
|
||
/** @var int $baz */ | ||
global $lorem; | ||
assertType('mixed', $lorem); | ||
assertType('\'foo\'', $baz); | ||
} | ||
|
||
public function doIpsum(): void | ||
{ | ||
/** | ||
* @var int $foo | ||
* @var string $bar | ||
*/ | ||
global $foo, $bar; | ||
|
||
assertType('int', $foo); | ||
assertType('string', $bar); | ||
} | ||
|
||
public function doDolor(): void | ||
{ | ||
/** @var int $baz */ | ||
global $lorem; | ||
|
||
assertType('mixed', $lorem); | ||
assertType('*ERROR*', $baz); | ||
} | ||
|
||
} |
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,52 @@ | ||
<?php | ||
|
||
namespace Bug4500; | ||
|
||
class Foo | ||
{ | ||
|
||
public function doFoo(): void | ||
{ | ||
/** @var int */ | ||
global $foo; | ||
} | ||
|
||
public function doBar(): void | ||
{ | ||
/** @var int $foo */ | ||
global $foo; | ||
} | ||
|
||
public function doBaz(): void | ||
{ | ||
/** @var int */ | ||
global $foo, $bar; | ||
} | ||
|
||
public function doLorem(): void | ||
{ | ||
/** @var int $foo */ | ||
global $foo, $bar; | ||
} | ||
|
||
public function doIpsum(): void | ||
{ | ||
/** | ||
* @var int $foo | ||
* @var string $bar | ||
*/ | ||
global $foo, $bar; | ||
|
||
$baz = 'foo'; | ||
|
||
/** @var int $baz */ | ||
global $lorem; | ||
} | ||
|
||
public function doDolor(): void | ||
{ | ||
/** @var int $baz */ | ||
global $lorem; | ||
} | ||
|
||
} |