In commit 14f0fee3aaNodeInterface::getSourcePosition() was removed. Originally the SourcePosition object that was returned by this method contained the source filename as well as some other properties such as the line number and column number. All properties apart from the filename are now made part of NodeInterface proper. The filename is now completely handled by Parser.
It makes sense though to keep the filename associated with NodeInterface. After all, the line number and column number are also part of it.
Internally in Pharborist there is no need store the filename on the node, since the Parser is only dealing with a single file at a time, and is always aware to which file a certain node belongs. There might be more advanced use cases however where nodes are being passed to other classes and the filename may be lost. This is a pattern we commonly use in the Drupal Module Upgrader. We were able to retrieve the original filename from the node, but this is no longer possible. We would now have to pass the filename as a string in addition to the NodeInterface object which feels wrong since the filename is closely bound to the node.
In commit 14f0fee3aa
NodeInterface::getSourcePosition()
was removed. Originally theSourcePosition
object that was returned by this method contained the source filename as well as some other properties such as the line number and column number. All properties apart from the filename are now made part ofNodeInterface
proper. The filename is now completely handled byParser
.It makes sense though to keep the filename associated with
NodeInterface
. After all, the line number and column number are also part of it.Internally in Pharborist there is no need store the filename on the node, since the
Parser
is only dealing with a single file at a time, and is always aware to which file a certain node belongs. There might be more advanced use cases however where nodes are being passed to other classes and the filename may be lost. This is a pattern we commonly use in the Drupal Module Upgrader. We were able to retrieve the original filename from the node, but this is no longer possible. We would now have to pass the filename as a string in addition to theNodeInterface
object which feels wrong since the filename is closely bound to the node.