-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix segfault using pipe type hint with first item as null (#1102)
- Loading branch information
1 parent
3ce70ae
commit a0a7b38
Showing
2 changed files
with
39 additions
and
4 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
32 changes: 32 additions & 0 deletions
32
tests/phpt/typehints/return_types/16_null_first_in_pipe.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,32 @@ | ||
@ok | ||
<?php | ||
|
||
class BaseClass { | ||
public function call(): void {} | ||
} | ||
|
||
class ChildClass1 extends BaseClass {} | ||
class ChildClass2 extends BaseClass {} | ||
|
||
/** @return null|ChildClass1|ChildClass2 */ | ||
function execute() { | ||
return new ChildClass1(); | ||
} | ||
|
||
/** @return null|ChildClass1|null|ChildClass2 */ | ||
function execute2() { | ||
return new ChildClass2(); | ||
} | ||
|
||
/** @return null|null|null */ | ||
function execute3() { | ||
return null; | ||
} | ||
|
||
function main(): void { | ||
execute()->call(); | ||
execute2()->call(); | ||
var_dump(execute3()); | ||
} | ||
|
||
main(); |