Page MenuHomePhorge

Improve passing false|null to some strlen() calls
Needs ReviewPublic

Authored by aklapper on Sat, Jun 14, 23:52.

Details

Reviewers
None
Group Reviewers
O1: Blessed Committers
Summary

https://www.php.net/manual/en/function.getenv.php, https://www.php.net/manual/en/function.fread.php, and https://www.php.net/manual/en/function.file-get-contents.php can return false.
Handle that correctly so PHPStan throws less "Parameter #1 $string of function strlen expects string, string|false given." and "Parameter #1 $string of function strlen expects string, string|null given." output.

Test Plan

Read the code; run static code analysis.

Diff Detail

Repository
rARC Arcanist
Branch
strlenNull (branched from master)
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 2109
Build 2109: arc lint + arc unit

Event Timeline

mainframe98 added inline comments.
src/future/http/HTTPFuture.php
152

Hmm, my IDE (PhpStorm) says $data cannot be false, as it is already checked as part of the assignment. In fact, it says the strlen call is unnecessary as well.

152–153