Fixed the registration of commands with invalid JSON file

When the JSON file in the current folder is invalid, the registration of custom commands should be ignored rather than breaking the usage of Composer entirely.
Closes #3165
Merge pull request #3238 from stof/patch-6

Fixed the registration of commands with invalid JSON file
Fix unset order to avoid a warning
Update jsonlint dep, fixes #3151
Disallow overriding commands with scripts
Add toran to docs besides satis
Adds warning when the version field is set, fixes composer/packagist#438
[#2492] Removing an unused variable and use statement, fixing phpdoc
[#2492] Automatically using the latest version when requiring a package

This applies to the init and require commands.

Previously:

If you ommitted the version of a library, it prompted you to enter a version.

New Behavior:

If you omit the version, it automatically selects the latest version that is consistent
with your minimum-stability flag.

Is Jordi mentions, this is consistent with how npm works.
[#2492] Prefixed real versions with ~ when guessing the latest version

2.1.0 > ~2.1.0
v2.1.0 -> ~2.1.0
dev-master -> dev-master
Extracting logic into a new class related to selecting the latest version

Also refactored InitCommand slightly so that you can use this "latest version"
functionality when searching for a package as well.
Refactoring selection of the "recommended" version (e.g ~1.2) and adding some tests

This also modifies the behavior slightly (from a recommendation by seldaek) to always
propose the minor version of the recommendation (e.g. ~1.2 instead of ~1.2.1).