Fixing so that on windows local paths to binaries can be used

Summary: On windows, using something like "vendor/bin/phpcs" does not work because the code tries to run "where vendor/bin/phpcs" which fails badly. So instead, when we try to test for a binary on windows, we first check if a file exists locally with that name. If it does, just use that. If someone has a file in their project with the same name as a linter, but that is not the actual linter, this could fail, but I can't imagine a case where that would happen.

Test Plan: On windows, run `arc lint` with a linter configured that is local e.g. "vendor/bin/phpcs"

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9493
Pass additional arguments to the `PhabricatorDaemonEventListener`.

Summary: Include non-standard command line arguments in the `daemon.didLaunch` event.

Test Plan: See D9607.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9613
Fix failing unit test.

Summary: On PHP versions earlier than 5.4.0, `\e` is not a valid PHP escape character. Consequently, `PhutilUTF8TestCase::testUTF8ConsoleStrlen` will fail. Replace `\e` by its hexadecimal equivalent.

Test Plan: Ran unit tests.

Reviewers: hach-que, epriestley, #blessed_reviewers

Reviewed By: hach-que, epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9615
Rename `interestingArgv` to `explicitArgv`.

Summary: `interestingArgv` isn't a very useful name, see D9607#45.

Test Plan: N/A

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9617
Fix `PhutilReadableSerializer` to quote strings.

Summary: See D9622#inline-37279 for explanation.

Test Plan: Modified and ran unit tests.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9632
Add a native JSON parser.

Summary: Ref T5297. Add [[https://github.com/Seldaek/jsonlint | JsonLint]] as an external library and provide `PhutilJSONParser` as a wrapper around the library's functionality.

Test Plan: Wrote some basic unit tests and ran `arc unit`.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Maniphest Tasks: T5297

Differential Revision: https://secure.phabricator.com/D9622
Modify the JsonLint library to return `array` instead of `stdClass`.

Summary:
Summary :Ref T5297. Make `PhutilJSONParser::parse($json)` roughly approximate to `json_decode($json, true)`. Generally when we parse JSON, we want the result to be an `arrray`, not a `stdClass` object.

Depends on D9622.

Test Plan: Wrote a few additional test cases.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Maniphest Tasks: T5297

Differential Revision: https://secure.phabricator.com/D9623
Fix the handling of empty keys in `PhutilJSONParser`.

Summary:
Because the empty string is not a valid property of `stdClass`, the original [[https://github.com/Seldaek/jsonlint | JsonLint]] library replaced empty keys with `'_empty_'`. After D9623, all instances of `stdClass` have been replaced by arrays, so we can remove this nonsense.

Depends on D9623.

Test Plan: Added a test case and ran `arc unit`.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9633
Throw better exceptions from `PhutilJSONParser`.

Summary:
Ref T5297. Retrieve error context from `JsonLintParsingException` to provide a better exception message.

Depends on D9623.

Test Plan: Wrote and executed unit tests.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Maniphest Tasks: T5297

Differential Revision: https://secure.phabricator.com/D9624
Add an optional mode for `PhutilJSONParser` to detect duplicate keys

Summary:
Ref T5297. Change `PhutilJSONParser` to disallow duplicate keys by default. In addition, add an optional mode to //allow// duplicate keys. One important caveat here is that `PhutilJSONParser` will return the //first// value in the case of a duplicate, whereas `json_decode` will return the last value.

Depends on D9624.

Test Plan: Wrote and executed unit tests.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Maniphest Tasks: T5297

Differential Revision: https://secure.phabricator.com/D9627
Minor fix for `JsonLintJsonLinter` class.

Summary: Remove a `\` character, which will probably cause issues on PHP versions earlier than 5.3.

Test Plan: Thought long and hard.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9636
Add more unit tests for `PhutilJSONParser`.

Summary: Added some additional unit tests taken from the [[https://github.com/Seldaek/jsonlint | original source]].

Test Plan: Ran `arc unit`.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9638
Modify `phutil_json_decode` to use `PhutilJSONParser`.

Summary: Ref T5297. Modify `phutil_json_decode` to use `PhutilJSONParser` instead of the native `json_decode`.

Test Plan: Ran `arc unit`.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Maniphest Tasks: T5297

Differential Revision: https://secure.phabricator.com/D9634
Update callsites of `phutil_json_decode`.

Summary: Depends on D9634. `phutil_json_decode` now throws an exception on invalid JSON.

Test Plan: Not really sure how to test this?

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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