Skip to content

Commit

Permalink
Remove calls to is_null in HHVM extension code
Browse files Browse the repository at this point in the history
Summary: I'm removing `is_null()` special handling from the typechecker. Since maybe one day we'd like to typecheck any builtin Hack code, might as well change these to use `is null` instead right now

Reviewed By: ricklavoie

Differential Revision: D57400676

fbshipit-source-id: 19f307084da434fd0487d2ec7e446af7246a5aa3
  • Loading branch information
viratyosin authored and facebook-github-bot committed May 16, 2024
1 parent 65c7988 commit d3f9558
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion hphp/runtime/ext/core/php/filter/filter_var_array.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function _filter_var_array_single($value, $filter, $options = dict[]) {
if ($flags & FILTER_REQUIRE_SCALAR && HH\is_any_array($ret)) {
return false;
}
if ($flags & FILTER_REQUIRE_ARRAY && is_null($ret)) {
if ($flags & FILTER_REQUIRE_ARRAY && $ret is null) {
return vec[];
}

Expand Down
2 changes: 1 addition & 1 deletion hphp/runtime/ext/core/php/spl/iterators/GlobIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class GlobIterator extends FilesystemIterator
implements SeekableIterator, Countable {

public function __construct($path, $flags = null) {
if (is_null($flags)) {
if ($flags is null) {
$flags = FilesystemIterator::KEY_AS_PATHNAME |
FilesystemIterator::CURRENT_AS_FILEINFO;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ protected function _fetch($check) {
if (!$check || $this->iterator->valid()) {
$this->current = $this->iterator->current();
$key = $this->iterator->key();
$this->key = is_null($key) ? $this->position : $key;
$this->key = $key is null ? $this->position : $key;
return true;
} else {
$this->current = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ public function getMaxDepth()
public function getSubIterator($level = null)
{
$currentLevel = count($this->iterators)-1;
if (is_null($level)) {
if ($level is null) {
$level = $currentLevel;
}
if ($level < 0 || $level > $currentLevel) {
Expand Down
2 changes: 1 addition & 1 deletion hphp/runtime/ext/reflection/ext_reflection-classes.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class ReflectionParameter implements Reflector {
* @return mixed No value is returned.
*/
public function __construct($func, $param, $info = null)[] {
if (is_null($func) && is_null($param)) {
if ($func is null && $param is null) {
if ($info !== null) {
$this->info = $info;
$this->name = $info['name'];
Expand Down

0 comments on commit d3f9558

Please sign in to comment.