public function assertCannotParse(string $element) { if ($this->parser instanceof ChainableFlagParserInterface) { $actual = $this->parser->canParse($element); $this->assertFalse($actual); return; } try { $this->parser->parse($element); $this->fail('Expected exception to be thrown.'); } catch (\LogicException $exception) { // expected } }