Skip to content

Commit 1f99e7e

Browse files
committed
fix script __toString
1 parent 0667fc8 commit 1f99e7e

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/Operation.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,11 @@ public function __construct(int $code, $data = null, int $size = 0)
4343
*/
4444
public function __toString(): string
4545
{
46-
return $this->getHumanReadable();
46+
try {
47+
return $this->getHumanReadable();
48+
} catch (\Exception $exception) {
49+
return 'Script parse error.';
50+
}
4751
}
4852

4953
/**

src/Script.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,14 @@ public function __construct(string $data)
3131
$this->setData($data);
3232
}
3333

34+
/**
35+
* @return string
36+
*/
37+
public function __toString()
38+
{
39+
return $this->getHumanReadable();
40+
}
41+
3442
/**
3543
* @return string
3644
*/

0 commit comments

Comments
 (0)