Skip to content

Commit

Permalink
PR remark
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenvanassche committed Apr 24, 2024
1 parent 20f7918 commit 059ffa5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/Frame.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Frame
public $class;

/** @var string|null */
protected $snippet;
protected $textSnippet;

public function __construct(
string $file,
Expand All @@ -52,10 +52,10 @@ public function __construct(

$this->applicationFrame = $isApplicationFrame;

$this->snippet = $snippet;
$this->textSnippet = $snippet;
}

public function getSnippet(int $lineCount): array
public function getTextSnippet(int $lineCount): array
{
return (new CodeSnippet())
->surroundingLine($this->lineNumber)
Expand All @@ -73,7 +73,7 @@ public function getSnippetAsString(int $lineCount): string

public function getSnippetProperties(int $lineCount): array
{
$snippet = $this->getSnippet($lineCount);
$snippet = $this->getTextSnippet($lineCount);

return array_map(function (int $lineNumber) use ($snippet) {
return [
Expand All @@ -85,8 +85,8 @@ public function getSnippetProperties(int $lineCount): array

protected function getCodeSnippetProvider(): SnippetProvider
{
if($this->snippet) {
return new LaravelSerializableClosureSnippetProvider($this->snippet);
if($this->textSnippet) {
return new LaravelSerializableClosureSnippetProvider($this->textSnippet);
}

if(file_exists($this->file)) {
Expand Down
2 changes: 1 addition & 1 deletion tests/BacktraceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public function it_can_get_the_snippet_around_the_frame()
/** @var \Spatie\Backtrace\Frame $firstFrame */
$firstFrame = Backtrace::create()->frames()[0];

$snippet = $firstFrame->getSnippet(5);
$snippet = $firstFrame->getTextSnippet(5);

$this->assertStringContainsString('$firstFrame =', $snippet[__LINE__ - 4]);
$this->assertCount(5, $snippet);
Expand Down

0 comments on commit 059ffa5

Please sign in to comment.