Skip to content

Commit

Permalink
Add deprecation warning to fb_autoload_map
Browse files Browse the repository at this point in the history
Summary: Been documented as deprecated for a while, but new callers come in.

Reviewed By: @jdelong

Differential Revision: D1720790
  • Loading branch information
fredemmott authored and hhvm-bot committed Dec 15, 2014
1 parent 735f05d commit 166222c
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 5 deletions.
7 changes: 4 additions & 3 deletions hphp/system/php/misc/fb_autoload_map.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php

/**
* Deprecated - use HH\autoload_set_paths instead.
*/
function fb_autoload_map(mixed $map, string $root): bool {
trigger_error(
__FUNCTION__.'(): Use HH\autoload_set_paths() instead.',
E_DEPRECATED
);
return HH\autoload_set_paths($map, $root);
}
17 changes: 17 additions & 0 deletions hphp/test/slow/autoload/autoload-enum-hint-deprecated.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?hh
function autoload_miss($str1, $str2) {
echo "Failure handler called: $str1 $str2\n";
}
fb_autoload_map(
array(
'class' => array('foo' => 'autoload-enum-hint-2.inc',
'bar' => 'autoload-enum-hint-3.inc',
'baz' => 'autoload-enum-hint-4.inc'),
'constant' => array(),
'function' => array(),
'failure' => 'autoload_miss',
'type' => array(),
),
__DIR__.'/'
);
include 'autoload-enum-hint-1.inc';
10 changes: 10 additions & 0 deletions hphp/test/slow/autoload/autoload-enum-hint-deprecated.php.expectf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Deprecated: fb_autoload_map(): Use HH\autoload_set_paths() instead. in %s/test/slow/autoload/autoload-enum-hint-deprecated.php on line 16
int(12)

Warning: Argument 1 to foo() must be of type @Foo, string given in %s/test/slow/autoload/autoload-enum-hint-1.inc on line 6
string(2) "hi"
string(3) "bar"
int(100)

Warning: Argument 1 to quux() must be of type @Quux, string given in %s/test/slow/autoload/autoload-enum-hint-1.inc on line 19
string(2) "hi"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--ffile=hphp/test/slow/autoload/autoload-enum-hint-1.inc --ffile=test/slow/autoload/autoload-enum-hint-1.inc --ffile=hphp/test/slow/autoload/autoload-enum-hint-2.inc --ffile=test/slow/autoload/autoload-enum-hint-2.inc --ffile=hphp/test/slow/autoload/autoload-enum-hint-3.inc --ffile=test/slow/autoload/autoload-enum-hint-3.inc --ffile=hphp/test/slow/autoload/autoload-enum-hint-4.inc --ffile=test/slow/autoload/autoload-enum-hint-4.inc
2 changes: 1 addition & 1 deletion hphp/test/slow/autoload/autoload-enum-hint.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
function autoload_miss($str1, $str2) {
echo "Failure handler called: $str1 $str2\n";
}
fb_autoload_map(
HH\autoload_set_paths(
array(
'class' => array('foo' => 'autoload-enum-hint-2.inc',
'bar' => 'autoload-enum-hint-3.inc',
Expand Down
2 changes: 1 addition & 1 deletion hphp/test/slow/autoload/autoload-type-alias-bug.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
function autoload_miss($str1, $str2) {
echo "Failure handler called: $str1 $str2\n";
}
fb_autoload_map(
HH\autoload_set_paths(
array(
'class' => array(),
'constant' => array(),
Expand Down

0 comments on commit 166222c

Please sign in to comment.