Skip to main content

Module config_source

Module config_source 

Source
Expand description

Port of Composer\Config\JsonConfigSource for composer.json (not auth.json): every edit goes through JsonManipulator on the file text; if the manipulator gives up (false), Composer re-reads the file, applies the same modification to the decoded array and rewrites everything with JsonFile::write (detected indentation, empty arrays rendered as {} for keys that are objects in the schema).

Not ported: the LAX_SCHEMA validation after each write. Composer restores the file and fails if the result violates the schema, which amounts to refusing to edit an already invalid manifest (uppercase "name", non-string constraint…); here the edit goes through. A valid manifest gives the same result on both sides.

Structs§

JsonConfigSource
A project’s composer.json, edited in place.

Enums§

ConfigSourceError

Functions§

composer_file
Path of a project’s manifest (Factory::getComposerFile).
reindent
JsonFile::encode with an indentation other than 4 spaces: every line start of 4n spaces becomes n indents.