classUnknownDirectiveReader
final class UnknownDirectiveReader
implements BisonDirectiveReader
Restricted visibility: declared "@visibility root". Code outside that scope must not name this declaration.
Reads any directive no other reader knows.
Consumes arguments through the declaration boundary and preserves their source text in an unknown-declaration node. Later stages can retain directives without interpreting their semantics.
Methods§
public function __construct(BisonDeclarationBoundary|null $boundary = null)Parameters
$boundary | BisonDeclarationBoundary|null | Decides where the declaration ends |
Test cases 4
Calls 1
public function handles(string $directive): boolReports that this reader accepts every directive.
Parameters
$directive | string | Directive name including its percent sign |
Returns
bool Always true, which is why this reader is consulted lastTest cases 1
UnknownDirectiveReaderTest::testHandlesAcceptsAnyDirectivecovers and calls
public function read(BisonTokenStream $stream, string $directive): BisonDeclarationConsumes the arguments as text up to the end of the declaration.
Parameters
$stream | BisonTokenStream | Stream positioned just after the directive name |
$directive | string | Directive name including its percent sign |
Returns
BisonDeclaration The directive and the text that followed itTest cases 3
UnknownDirectiveReaderTest::testReadKeepsTheArgumentsAsTextcovers and callsUnknownDirectiveReaderTest::testReadKeepsTheDirectiveWithoutArgumentscovers and callsUnknownDirectiveReaderTest::testReadLeavesTheStreamOnTheNextDeclarationcovers and calls
Calls 5
- method-call BisonDeclarationBoundary::continuesWith() line 61
- method-call BisonTokenStream::peek() line 61
- method-call BisonTokenStream::nextString() line 62
- new BisonUnknownDeclaration line 65
- function-call
implodeline 65
Private surface 1§
Implementation details, listed for orientation only.
private BisonDeclarationBoundary $boundaryTest cases 7§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 4
UnknownDirectiveReaderTest::testHandlesAcceptsAnyDirectivecovers and callsUnknownDirectiveReaderTest::testReadKeepsTheArgumentsAsTextcovers and callsUnknownDirectiveReaderTest::testReadKeepsTheDirectiveWithoutArgumentscovers and callsUnknownDirectiveReaderTest::testReadLeavesTheStreamOnTheNextDeclarationcovers and calls
Other tests reaching this symbol 3
BisonParserTestcallsBisonPreambleReaderTestcallsBisonDirectiveReaderChainTestcalls