# IndentHeuristic

> 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.

[API reference](/docs/api/index.md) › [Diff](/docs/extensions/diff/reference/index.md) › IndentHeuristic

| enum | `PHPForge\Diff\IndentHeuristic` |
| --- | --- |
| Source | [`src/IndentHeuristic.php`](https://github.com/php-forge/diff/blob/main/src/IndentHeuristic.php#L15) |

Holds the tuning values of Git's indent heuristic, which [`LineDiffer`](/docs/extensions/diff/reference/linediffer/index.md) 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`.).

## Constants

| Constant | Value | Description | Defined by |
| --- | --- | --- | --- |
| <span id="const-BLANK"></span>`BLANK` | `-1` | Indentation measured for a line that holds only whitespace. | `IndentHeuristic` |
| <span id="const-END_OF_FILE_PENALTY"></span>`END_OF_FILE_PENALTY` | `21` | Penalty for a split at the end of the input. | `IndentHeuristic` |
| <span id="const-INDENT_WEIGHT"></span>`INDENT_WEIGHT` | `60` | Weight of the indent comparison against the penalty difference when two positions are compared. | `IndentHeuristic` |
| <span id="const-MAX_BLANKS"></span>`MAX_BLANKS` | `20` | Maximum number of consecutive blank lines counted on each side of a split. | `IndentHeuristic` |
| <span id="const-MAX_INDENT"></span>`MAX_INDENT` | `200` | Maximum indentation, in columns, that is measured. | `IndentHeuristic` |
| <span id="const-MAX_SLIDING"></span>`MAX_SLIDING` | `100` | Maximum number of positions examined for one group. | `IndentHeuristic` |
| <span id="const-POST_BLANK_WEIGHT"></span>`POST_BLANK_WEIGHT` | `6` | Weight of the blank lines that follow a split. | `IndentHeuristic` |
| <span id="const-RELATIVE_DEDENT_PENALTY"></span>`RELATIVE_DEDENT_PENALTY` | `23` | 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. | `IndentHeuristic` |
| <span id="const-RELATIVE_DEDENT_WITH_BLANK_PENALTY"></span>`RELATIVE_DEDENT_WITH_BLANK_PENALTY` | `17` | 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. | `IndentHeuristic` |
| <span id="const-RELATIVE_INDENT_PENALTY"></span>`RELATIVE_INDENT_PENALTY` | `-4` | 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. | `IndentHeuristic` |
| <span id="const-RELATIVE_INDENT_WITH_BLANK_PENALTY"></span>`RELATIVE_INDENT_WITH_BLANK_PENALTY` | `10` | Penalty for a split before a line indented more than the previous non-blank line, with blank lines around the split. | `IndentHeuristic` |
| <span id="const-RELATIVE_OUTDENT_PENALTY"></span>`RELATIVE_OUTDENT_PENALTY` | `24` | 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. | `IndentHeuristic` |
| <span id="const-RELATIVE_OUTDENT_WITH_BLANK_PENALTY"></span>`RELATIVE_OUTDENT_WITH_BLANK_PENALTY` | `17` | 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. | `IndentHeuristic` |
| <span id="const-START_OF_FILE_PENALTY"></span>`START_OF_FILE_PENALTY` | `1` | Penalty for a split at the start of the input. | `IndentHeuristic` |
| <span id="const-TAB_WIDTH"></span>`TAB_WIDTH` | `8` | Number of columns between two tab stops. | `IndentHeuristic` |
| <span id="const-TOTAL_BLANK_WEIGHT"></span>`TOTAL_BLANK_WEIGHT` | `-30` | Weight of the blank lines around a split; negative values favor blanks. | `IndentHeuristic` |