Skip to content

Commit 7a0a987

Browse files
committed
Add some sad path tests
1 parent b5a9ede commit 7a0a987

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/FileParser.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22
namespace exussum12\CoverageChecker;
33

4+
use PhpParser\Error;
45
use PhpParser\Node;
56
use PhpParser\Node\FunctionLike;
67
use PhpParser\Node\Stmt\ClassLike;
@@ -39,8 +40,9 @@ public function getFunctionLimits()
3940

4041
protected function parse(Parser $parser)
4142
{
42-
$ast = $parser->parse($this->sourceCode);
43-
if (!is_array($ast)) {
43+
try {
44+
$ast = $parser->parse($this->sourceCode);
45+
} catch (Error $exception) {
4446
return;
4547
}
4648

0 commit comments

Comments
 (0)