Skip to content

Commit

Permalink
Remove deprecated functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Dec 22, 2023
1 parent f34ddd0 commit 059ddc5
Show file tree
Hide file tree
Showing 8 changed files with 4 additions and 110 deletions.
4 changes: 1 addition & 3 deletions .psalm/baseline.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="5.11.0@c9b192ab8400fdaf04b2b13d110575adc879aa90">
<files psalm-version="5.18.0@b113f3ed0259fd6e212d87c3df80eec95a6abf19">
<file src="src/Chunk.php">
<LessSpecificReturnStatement>
<code><![CDATA[$this->lines]]></code>
<code><![CDATA[$this->lines]]></code>
</LessSpecificReturnStatement>
<MoreSpecificReturnType>
<code><![CDATA[list<Line>]]></code>
<code><![CDATA[list<Line>]]></code>
</MoreSpecificReturnType>
</file>
<file src="src/Differ.php">
Expand Down
3 changes: 3 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ All notable changes are documented in this file using the [Keep a CHANGELOG](htt

### Removed

* `SebastianBergmann\Diff\Chunk::getStart()`, `SebastianBergmann\Diff\Chunk::getStartRange()`, `SebastianBergmann\Diff\Chunk::getEnd()`, `SebastianBergmann\Diff\Chunk::getEndRange()`, and `SebastianBergmann\Diff\Chunk::getLines()`
* `SebastianBergmann\Diff\Diff::getFrom()`, `SebastianBergmann\Diff\Diff::getTo()`, and `SebastianBergmann\Diff\Diff::getChunks()`
* `SebastianBergmann\Diff\Line::getContent()` and `SebastianBergmann\Diff\Diff::getType()`
* Removed support for PHP 8.1

## [5.1.0] - 2023-12-22
Expand Down
42 changes: 0 additions & 42 deletions src/Chunk.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,48 +75,6 @@ public function setLines(array $lines): void
$this->lines = $lines;
}

/**
* @deprecated Use start() instead
*/
public function getStart(): int
{
return $this->start;
}

/**
* @deprecated Use startRange() instead
*/
public function getStartRange(): int
{
return $this->startRange;
}

/**
* @deprecated Use end() instead
*/
public function getEnd(): int
{
return $this->end;
}

/**
* @deprecated Use endRange() instead
*/
public function getEndRange(): int
{
return $this->endRange;
}

/**
* @psalm-return list<Line>
*
* @deprecated Use lines() instead
*/
public function getLines(): array
{
return $this->lines;
}

public function getIterator(): Traversable
{
return new ArrayIterator($this->lines);
Expand Down
30 changes: 0 additions & 30 deletions src/Diff.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,36 +77,6 @@ public function setChunks(array $chunks): void
$this->chunks = $chunks;
}

/**
* @psalm-return non-empty-string
*
* @deprecated
*/
public function getFrom(): string
{
return $this->from;
}

/**
* @psalm-return non-empty-string
*
* @deprecated
*/
public function getTo(): string
{
return $this->to;
}

/**
* @psalm-return list<Chunk>
*
* @deprecated
*/
public function getChunks(): array
{
return $this->chunks;
}

public function getIterator(): Traversable
{
return new ArrayIterator($this->chunks);
Expand Down
16 changes: 0 additions & 16 deletions src/Line.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,4 @@ public function isUnchanged(): bool
{
return $this->type === self::UNCHANGED;
}

/**
* @deprecated
*/
public function getContent(): string
{
return $this->content;
}

/**
* @deprecated
*/
public function getType(): int
{
return $this->type;
}
}
5 changes: 0 additions & 5 deletions tests/ChunkTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,31 +22,26 @@ final class ChunkTest extends TestCase
public function testHasLines(): void
{
$this->assertEquals([$this->line()], $this->chunk()->lines());
$this->assertEquals([$this->line()], $this->chunk()->getLines());
}

public function testHasStart(): void
{
$this->assertSame(1, $this->chunk()->start());
$this->assertSame(1, $this->chunk()->getStart());
}

public function testHasStartRange(): void
{
$this->assertSame(2, $this->chunk()->startRange());
$this->assertSame(2, $this->chunk()->getStartRange());
}

public function testHasEnd(): void
{
$this->assertSame(3, $this->chunk()->end());
$this->assertSame(3, $this->chunk()->getEnd());
}

public function testHasEndRange(): void
{
$this->assertSame(4, $this->chunk()->endRange());
$this->assertSame(4, $this->chunk()->getEndRange());
}

public function testLinesCanBeSet(): void
Expand Down
10 changes: 0 additions & 10 deletions tests/DiffTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ public function testGettersAfterConstructionWithDefault(): void
$this->assertSame($from, $diff->from());
$this->assertSame($to, $diff->to());
$this->assertSame([], $diff->chunks(), 'Expect chunks to be default value "array()".');

$this->assertSame($from, $diff->getFrom());
$this->assertSame($to, $diff->getTo());
$this->assertSame([], $diff->getChunks(), 'Expect chunks to be default value "array()".');
}

public function testGettersAfterConstructionWithChunks(): void
Expand All @@ -45,24 +41,18 @@ public function testGettersAfterConstructionWithChunks(): void
$this->assertSame($from, $diff->from());
$this->assertSame($to, $diff->to());
$this->assertSame($chunks, $diff->chunks(), 'Expect chunks to be passed value.');

$this->assertSame($from, $diff->getFrom());
$this->assertSame($to, $diff->getTo());
$this->assertSame($chunks, $diff->getChunks(), 'Expect chunks to be passed value.');
}

public function testSetChunksAfterConstruction(): void
{
$diff = new Diff('line1c', 'line2c');

$this->assertSame([], $diff->chunks(), 'Expect chunks to be default value "array()".');
$this->assertSame([], $diff->getChunks(), 'Expect chunks to be default value "array()".');

$chunks = [new Chunk, new Chunk(2, 3)];
$diff->setChunks($chunks);

$this->assertSame($chunks, $diff->chunks(), 'Expect chunks to be passed value.');
$this->assertSame($chunks, $diff->getChunks(), 'Expect chunks to be passed value.');
}

public function testCanBeIterated(): void
Expand Down
4 changes: 0 additions & 4 deletions tests/LineTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ final class LineTest extends TestCase
public function testCanBeOfTypeAdded(): void
{
$this->assertSame(Line::ADDED, $this->added()->type());
$this->assertSame(Line::ADDED, $this->added()->getType());

$this->assertTrue($this->added()->isAdded());
$this->assertFalse($this->added()->isRemoved());
Expand All @@ -30,7 +29,6 @@ public function testCanBeOfTypeAdded(): void
public function testCanBeOfTypeRemoved(): void
{
$this->assertSame(Line::REMOVED, $this->removed()->type());
$this->assertSame(Line::REMOVED, $this->removed()->getType());

$this->assertTrue($this->removed()->isRemoved());
$this->assertFalse($this->removed()->isAdded());
Expand All @@ -40,7 +38,6 @@ public function testCanBeOfTypeRemoved(): void
public function testCanBeOfTypeUnchanged(): void
{
$this->assertSame(Line::UNCHANGED, $this->unchanged()->type());
$this->assertSame(Line::UNCHANGED, $this->unchanged()->getType());

$this->assertTrue($this->unchanged()->isUnchanged());
$this->assertFalse($this->unchanged()->isAdded());
Expand All @@ -50,7 +47,6 @@ public function testCanBeOfTypeUnchanged(): void
public function testHasContent(): void
{
$this->assertSame('content', $this->added()->content());
$this->assertSame('content', $this->added()->getContent());
}

private function added(): Line
Expand Down

0 comments on commit 059ddc5

Please sign in to comment.