classAllowedBlocks
final class AllowedBlocks
Checks that a block and its nested blocks are of the kinds the profile allows anywhere.
A selector comment is allowed only as the first block of a quotation.
Methods§
public static function check(Node $node, array<string, mixed> $schema, string $file): voidChecks a block and, for quotations and lists, every block inside it.
Parameters
$node | Node | The block |
$schema | array<string, mixed> | The profile's allBlocks constraint |
$file | string | The definition file |
Throws
InvalidInputException When a block kind is not allowed or a comment is misplacedTest cases 6
AllowedBlocksTest::testCheckAcceptsAllowedBlockscallsAllowedBlocksTest::testCheckRejectsCommentThatIsNotSelectorcallsAllowedBlocksTest::testCheckRejectsForbiddenBlockscallsAllowedBlocksTest::testCheckRejectsKindMissingFromSchemacallsAllowedBlocksTest::testCheckRejectsMalformedSchemacallsAllowedBlocksTest::testCheckRejectsNestedKindMissingFromSchemacalls
Called from 2
Calls 9
- static-call Fields::keys() line 34
- method-call
Node::parent()line 35 - static-call Quotation::annotation() line 36
- function-call
in_arrayline 39 - static-call BlockKind::of() line 39
- static-call Fields::strings() line 39
- new InvalidInputException line 40
- method-call
Node::children()line 43 - static-call AllowedBlocks::check() line 44
Test cases 13§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 6
AllowedBlocksTest::testCheckAcceptsAllowedBlockscallsAllowedBlocksTest::testCheckRejectsCommentThatIsNotSelectorcallsAllowedBlocksTest::testCheckRejectsForbiddenBlockscallsAllowedBlocksTest::testCheckRejectsKindMissingFromSchemacallsAllowedBlocksTest::testCheckRejectsMalformedSchemacallsAllowedBlocksTest::testCheckRejectsNestedKindMissingFromSchemacalls
Other tests reaching this symbol 7
DefinitionReaderTestcallsDocumentReaderTestcallsLoaderTestcallsDocumentSchemaTestcallsReferenceTestcallsMarkdownDocumentTestcallsFormatterTestcalls