{"$schema":"https://yii2-framework.github.io/docs/reference/reference.schema.json","schemaVersion":1,"package":"diff","title":"Diff","repository":"https://github.com/php-forge/diff","ref":"main","commit":"6bcc6c36bab3b1c86f2197241e723a874074ecd8","generatedAt":"2026-11-20","url":"https://yii2-framework.github.io/docs/extensions/diff/reference/","types":{"PHPForge\\Diff\\DiffLine":{"kind":"class","modifiers":["final","readonly"],"url":"https://yii2-framework.github.io/docs/extensions/diff/reference/diffline/","summary":"Represents a single line of an edit script produced by `PHPForge\\Diff\\DifferInterface`.","properties":{"line":{"type":"string","description":"Line content without its trailing `\"\\n\"`; a `\"\\r\"` left by CRLF input is kept.","readonly":true,"promoted":true},"op":{"type":"PHPForge\\Diff\\DiffOp","description":"Operation applied to the line.","readonly":true,"promoted":true}},"methods":{"__construct":{"signature":"public function __construct(PHPForge\\Diff\\DiffOp $op, string $line)","summary":"Creates a diff line.","params":[{"name":"$op","type":"PHPForge\\Diff\\DiffOp","description":"Operation applied to the line."},{"name":"$line","type":"string","description":"Line content without its trailing `\"\\n\"`; a `\"\\r\"` left by CRLF input is kept."}]}}},"PHPForge\\Diff\\DiffOp":{"kind":"enum","url":"https://yii2-framework.github.io/docs/extensions/diff/reference/diffop/","summary":"Represents the operation applied to a single line of an edit script produced by `PHPForge\\Diff\\DifferInterface`.","cases":{"Add":{"description":"The line is present only in the new input and is added."},"Context":{"description":"The line is present in both inputs and is kept."},"Remove":{"description":"The line is present only in the old input and is removed."}}},"PHPForge\\Diff\\DifferInterface":{"kind":"interface","url":"https://yii2-framework.github.io/docs/extensions/diff/reference/differinterface/","summary":"Computes a line-by-line edit script between two multi-line strings.","methods":{"diff":{"signature":"abstract public function diff(string $old, string $new): list<PHPForge\\Diff\\DiffLine>","summary":"Returns the edit script that transforms `$old` into `$new`.","params":[{"name":"$old","type":"string","description":"Original input, split into lines on `\"\\n\"`."},{"name":"$new","type":"string","description":"Target input, split into lines on `\"\\n\"`."}],"return":{"type":"list<PHPForge\\Diff\\DiffLine>","description":"Edit script; its `Context` and `Remove` lines in order reproduce the lines of `$old`, and its `Context` and `Add` lines in order reproduce the lines of `$new`."},"abstract":true}}},"PHPForge\\Diff\\IndentHeuristic":{"kind":"enum","url":"https://yii2-framework.github.io/docs/extensions/diff/reference/indentheuristic/","summary":"Holds the tuning values of Git's indent heuristic, which `PHPForge\\Diff\\LineDiffer` uses to choose where a slidable group of changed lines is placed.","constants":{"BLANK":{"value":"-1","description":"Indentation measured for a line that holds only whitespace."},"END_OF_FILE_PENALTY":{"value":"21","description":"Penalty for a split at the end of the input."},"INDENT_WEIGHT":{"value":"60","description":"Weight of the indent comparison against the penalty difference when two positions are compared."},"MAX_BLANKS":{"value":"20","description":"Maximum number of consecutive blank lines counted on each side of a split."},"MAX_INDENT":{"value":"200","description":"Maximum indentation, in columns, that is measured."},"MAX_SLIDING":{"value":"100","description":"Maximum number of positions examined for one group."},"POST_BLANK_WEIGHT":{"value":"6","description":"Weight of the blank lines that follow a split."},"RELATIVE_DEDENT_PENALTY":{"value":"23","description":"Penalty for a split before a line indented less than the previous non-blank line and not followed by a more indented line, without blank lines around the split."},"RELATIVE_DEDENT_WITH_BLANK_PENALTY":{"value":"17","description":"Penalty for a split before a line indented less than the previous non-blank line and not followed by a more indented line, with blank lines around the split."},"RELATIVE_INDENT_PENALTY":{"value":"-4","description":"Penalty for a split before a line indented more than the previous non-blank line, without blank lines around the split; negative values favor the split."},"RELATIVE_INDENT_WITH_BLANK_PENALTY":{"value":"10","description":"Penalty for a split before a line indented more than the previous non-blank line, with blank lines around the split."},"RELATIVE_OUTDENT_PENALTY":{"value":"24","description":"Penalty for a split before a line indented less than the previous non-blank line and followed by a more indented line, without blank lines around the split."},"RELATIVE_OUTDENT_WITH_BLANK_PENALTY":{"value":"17","description":"Penalty for a split before a line indented less than the previous non-blank line and followed by a more indented line, with blank lines around the split."},"START_OF_FILE_PENALTY":{"value":"1","description":"Penalty for a split at the start of the input."},"TAB_WIDTH":{"value":"8","description":"Number of columns between two tab stops."},"TOTAL_BLANK_WEIGHT":{"value":"-30","description":"Weight of the blank lines around a split; negative values favor blanks."}}},"PHPForge\\Diff\\LineDiffer":{"kind":"class","modifiers":["final"],"url":"https://yii2-framework.github.io/docs/extensions/diff/reference/linediffer/","summary":"Computes the line edit scripts of `git diff` with default settings, except on inputs that reach Git's cost limit.","implements":["PHPForge\\Diff\\DifferInterface"],"methods":{"diff":{"signature":"public function diff(string $old, string $new): list<PHPForge\\Diff\\DiffLine>","summary":"Returns the edit script that transforms `$old` into `$new`, as `git diff` produces it below Git's cost limit.","params":[{"name":"$old","type":"string","description":"Original input, split into lines on `\"\\n\"`."},{"name":"$new","type":"string","description":"Target input, split into lines on `\"\\n\"`."}],"return":{"type":"list<PHPForge\\Diff\\DiffLine>","description":"Edit script; its `Context` and `Remove` lines in order reproduce the lines of `$old`, and its `Context` and `Add` lines in order reproduce the lines of `$new`."}}}},"PHPForge\\Diff\\LineMatch":{"kind":"enum","url":"https://yii2-framework.github.io/docs/extensions/diff/reference/linematch/","summary":"Represents how often the content of a line occurs in the other input, as Git's `xdl_cleanup_records()` classifies the lines before the alignment of `PHPForge\\Diff\\LineDiffer`.","cases":{"Matched":{"description":"The line occurs in the other input fewer times than the multi-match limit and takes part in the alignment."},"Multimatched":{"description":"The line occurs in the other input at least as many times as the multi-match limit and is discarded when it sits inside a run of unmatched lines."},"Unmatched":{"description":"The line does not occur in the other input and is always changed."}}},"PHPForge\\Diff\\MultimatchCleanup":{"kind":"enum","url":"https://yii2-framework.github.io/docs/extensions/diff/reference/multimatchcleanup/","summary":"Holds the limits of Git's cleanup of multi-matched lines, which `PHPForge\\Diff\\LineDiffer` applies before the alignment so that lines repeated all over the other input do not anchor it.","constants":{"KEEP_RUN":{"value":"4","description":"Multi-matched lines are discarded when they make up less than `1 / KEEP_RUN` of the run of unmatched and multi-matched lines around them."},"MAX_EQUAL_LIMIT":{"value":"1024","description":"Upper bound of the occurrence count from which a line counts as multi-matched; below it the bound is the approximate square root of the line count."},"SCAN_WINDOW":{"value":"100","description":"Number of lines examined on each side of a multi-matched line when deciding whether to discard it."}}},"PHPForge\\Diff\\UnifiedDiffRenderer":{"kind":"class","modifiers":["final","readonly"],"url":"https://yii2-framework.github.io/docs/extensions/diff/reference/unifieddiffrenderer/","summary":"Renders the output of `git diff --unified=<context>`, without its `diff --git` and `index` lines, for two texts compared after normalizing their line endings to `\"\\n\"`.","methods":{"__construct":{"signature":"public function __construct(PHPForge\\Diff\\DifferInterface $differ = new \\PHPForge\\Diff\\LineDiffer())","summary":"Creates a renderer.","params":[{"name":"$differ","type":"PHPForge\\Diff\\DifferInterface","default":"new \\PHPForge\\Diff\\LineDiffer()","optional":true,"description":"Differ that computes the edit scripts."}]},"render":{"signature":"public function render(string $old, string $new, string $fromLabel, string $toLabel, int $context = 3): string","summary":"Renders the unified diff that transforms `$old` into `$new`.","params":[{"name":"$old","type":"string","description":"Original text."},{"name":"$new","type":"string","description":"Target text."},{"name":"$fromLabel","type":"string","description":"Label written after `--- `."},{"name":"$toLabel","type":"string","description":"Label written after `+++ `."},{"name":"$context","type":"int","default":"3","optional":true,"description":"Number of unchanged lines shown around each change; negative values count as `0`."}],"return":{"type":"string","description":"Unified diff without a trailing newline, or an empty string when both texts are identical after line-ending normalization."},"throws":[{"type":"LogicException","description":"when the differ returns a script that does not reproduce its inputs."}]}}}}}
