Skip to content

Commit

Permalink
Default block line numbers to 0 when added outside of the parsing con…
Browse files Browse the repository at this point in the history
…text

See #579 (comment)
  • Loading branch information
colinodell committed Oct 17, 2020
1 parent f585d37 commit a1e83c4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ Updates should follow the [Keep a CHANGELOG](https://keepachangelog.com/) princi

## [Unreleased][unreleased]

### Changed

- Blocks added outside of the parsing context now have their start/end line numbers defaulted to 0 to avoid type errors (#579)

### Fixed

- Fixed replacement blocks not inheriting the start line number of the container they're replacing (#579)
Expand Down
4 changes: 2 additions & 2 deletions src/Block/Element/AbstractBlock.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ abstract class AbstractBlock extends Node
/**
* @var int
*/
protected $startLine;
protected $startLine = 0;

/**
* @var int
*/
protected $endLine;
protected $endLine = 0;

protected function setParent(Node $node = null)
{
Expand Down

0 comments on commit a1e83c4

Please sign in to comment.