HomePhabricator

Add an ArgumentParser helper for integers

Description

Add an ArgumentParser helper for integers

Summary:
Ref T13676. With increased PHP8.1 strictness around null, it seems reasonable to add some convenience parsing to "PhutilArgumentParser".

Add a helper function for parsing integers.

Test Plan:
See next change. Tried these arguments:

--count ''
--count asdf
--count 0
--count -3
--count 999999999999999999999999999999999999999999999234
--count 5

Got sensible parsing and appropriate feedback in all cases.

Maniphest Tasks: T13676

Differential Revision: https://secure.phabricator.com/D21799

Details

Provenance
epriestleyAuthored on May 3 2022, 9:06 PM
epriestleyPushed on May 3 2022, 10:57 PM
Differential Revision
D21799: Add an ArgumentParser helper for integers
Parents
rARCe5b92735c6dc: Fix more PHP 8.1 "strlen(null)" callsites in PhutilURI
Branches
Unknown
Tags
Unknown
Tasks
T13676: Drydock may reclaim recently-used resources