Skip to content

Commit

Permalink
Refactor ReaderInterface::read($node) signature
Browse files Browse the repository at this point in the history
  • Loading branch information
Chemaclass committed Feb 11, 2023
1 parent 3ee0f18 commit a6273d6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/php/Compiler/Domain/Reader/Reader.php
Expand Up @@ -38,19 +38,19 @@ public function __construct(
*
* If the token stream reaches the end, null is returned.
*
* @param NodeInterface $tokenStream The token stream to read
* @param NodeInterface $node The token stream to read
*
* @throws ReaderException
*/
public function read(NodeInterface $parseTree): ReaderResult
public function read(NodeInterface $node): ReaderResult
{
if ($parseTree instanceof TriviaNodeInterface) {
throw ReaderException::forNode($parseTree, $parseTree, 'Cannot read from whitespace or comments');
if ($node instanceof TriviaNodeInterface) {
throw ReaderException::forNode($node, $node, 'Cannot read from whitespace or comments');
}

return new ReaderResult(
$this->readExpression($parseTree, $parseTree),
CodeSnippet::fromNode($parseTree),
$this->readExpression($node, $node),
CodeSnippet::fromNode($node),
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/php/Compiler/Domain/Reader/ReaderInterface.php
Expand Up @@ -13,5 +13,5 @@ interface ReaderInterface
/**
* @throws ReaderException
*/
public function read(NodeInterface $parseTree): ReaderResult;
public function read(NodeInterface $node): ReaderResult;
}

0 comments on commit a6273d6

Please sign in to comment.