Skip to content

[RFC] Union types #1887

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 15 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
replace tests
  • Loading branch information
krakjoe committed Apr 22, 2016
commit f91c7c0c3d2906a7a914a90e7285ef6bd83c46d0
11 changes: 11 additions & 0 deletions Zend/tests/multi/011.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--TEST--
basic union implicit nullability allowed on params
--FILE--
<?php
$foo = function(Foo|Bar $foo = null) {
var_dump($foo);
};
$foo(null);
?>
--EXPECT--
NULL
9 changes: 9 additions & 0 deletions Zend/tests/multi/012.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
--TEST--
basic union disallow void
--FILE--
<?php
function(Foo | void $throw) {};
?>
--EXPECTF--
Fatal error: Scalar type void is not allowed in union in %s on line 2

9 changes: 9 additions & 0 deletions Zend/tests/multi/018.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
--TEST--
basic union disallow void
--FILE--
<?php
function() : Foo | void {};
?>
--EXPECTF--
Fatal error: Scalar type void is not allowed in union in %s on line 2