Skip to content
PHP Ecosystem
Explore

IndentHeuristic

API reference › Diff › IndentHeuristic

enumPHPForge\Diff\IndentHeuristic
Sourcesrc/IndentHeuristic.php

Holds the tuning values of Git’s indent heuristic, which LineDiffer uses to choose where a slidable group of changed lines is placed.

Each candidate position is scored by the two splits around the group; the values match those of Git’s xdiffi.c.

See also: https://github.com/git/git/blob/master/xdiff/xdiffi.c (Git’s xdiffi.c.).

ConstantValueDescriptionDefined by
BLANK-1Indentation measured for a line that holds only whitespace.IndentHeuristic
END_OF_FILE_PENALTY21Penalty for a split at the end of the input.IndentHeuristic
INDENT_WEIGHT60Weight of the indent comparison against the penalty difference when two positions are compared.IndentHeuristic
MAX_BLANKS20Maximum number of consecutive blank lines counted on each side of a split.IndentHeuristic
MAX_INDENT200Maximum indentation, in columns, that is measured.IndentHeuristic
MAX_SLIDING100Maximum number of positions examined for one group.IndentHeuristic
POST_BLANK_WEIGHT6Weight of the blank lines that follow a split.IndentHeuristic
RELATIVE_DEDENT_PENALTY23Penalty 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.IndentHeuristic
RELATIVE_DEDENT_WITH_BLANK_PENALTY17Penalty 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.IndentHeuristic
RELATIVE_INDENT_PENALTY-4Penalty 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.IndentHeuristic
RELATIVE_INDENT_WITH_BLANK_PENALTY10Penalty for a split before a line indented more than the previous non-blank line, with blank lines around the split.IndentHeuristic
RELATIVE_OUTDENT_PENALTY24Penalty 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.IndentHeuristic
RELATIVE_OUTDENT_WITH_BLANK_PENALTY17Penalty 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.IndentHeuristic
START_OF_FILE_PENALTY1Penalty for a split at the start of the input.IndentHeuristic
TAB_WIDTH8Number of columns between two tab stops.IndentHeuristic
TOTAL_BLANK_WEIGHT-30Weight of the blank lines around a split; negative values favor blanks.IndentHeuristic