Skip to content

Parser does not distinguish between annotated arrays and repeated annotations #64

@rwilczek

Description

@rwilczek

The current version of the annotation-parser does not tell between a single JSON-array and multiple simple annotations. But it should!

$parser = new \Minime\Annotations\Parser;
$this->assertNotSame(
    $parser->parse('@foo 1 @foo 2 @foo 3'),
    $parser->parse('@foo [1, 2, 3]')
); // FAIL. Parser errorneously gives the same result for both strings

$this->assertSame(
    ['foo' => [1, 2, 3]],
    $parser->parse('@foo 1 @foo 2 @foo 3') 
); // PASS. Parser works correctly on this

$this->assertSame(
    ['foo' => [[1, 2, 3]]],
    $parser->parse('@foo [1, 2, 3]') 
); // FAIL. Parser fails to preserve the array annotated with @foo

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions