Skip to content

Commit

Permalink
Allow void return types in PHP7 code
Browse files Browse the repository at this point in the history
Summary:
Added in 7.1

fixes #7740

Reviewed By: mofarrell

Differential Revision: D5338511

fbshipit-source-id: dc6d24a6e831a356a04d125f859847cca5c19e07
  • Loading branch information
fredemmott authored and hhvm-bot committed Jun 29, 2017
1 parent bf612cd commit a5d6bc3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions hphp/compiler/parser/parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2606,14 +2606,14 @@ Parser::AutoAliasMap getAutoAliasedClassesHelper() {
SCALAR_TYPE(int),
SCALAR_TYPE(float),
SCALAR_TYPE(string),
SCALAR_TYPE(void),

// Hack-only primatives
// Hack-only primitives
HH_ONLY_TYPE(num),
HH_ONLY_TYPE(arraykey),
HH_ONLY_TYPE(resource),
HH_ONLY_TYPE(mixed),
HH_ONLY_TYPE(noreturn),
HH_ONLY_TYPE(void),
HH_ONLY_TYPE(this),
HH_ONLY_TYPE(varray_or_darray),
HH_ALIAS(classname, string),
Expand Down
6 changes: 6 additions & 0 deletions hphp/test/slow/php7_backported/scalar-types/return_void.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php

// PHP 7.1+
function foo(): void {}

var_dump(foo());
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
NULL

0 comments on commit a5d6bc3

Please sign in to comment.