Skip to content
This repository

Allow empty arrays in annotations #270

Closed
wants to merge 1 commit into from

5 participants

Christian Müller doctrinebot Marco Pivetta Benjamin Eberlei Fabio B. Silva
Christian Müller

an empty array so far is impossible as it either results in a parse error if you just do the obvious {} or if you try {""} it will create an empty entry which in turn will cause errors depending on the annotation.

Christian Müller kitsunet Allow empty arrays in annotations
an empty array so far is impossible as it either results in a parse error if you just do the obvious {} or if you try {""} it will create an empty entry which in turn will cause errors depending on the annotation.
ea57779
doctrinebot
Collaborator

Hello,

thank you for positing this Pull Request. I have automatically opened an issue on our Jira Bug Tracker for you with the details of this Pull-Request. See the Link:

http://doctrine-project.org/jira/browse/DCOM-187

doctrinebot
Collaborator

Oh btw, I just (automatically) realized that you are not creating this pull request against the master branch.

Unless there are good reasons for this, i would suggest to close and rebase the Pull Request against master and then create it again. Sorry!

Marco Pivetta
Collaborator

@kitsunet can you add a test for this logic? Also, please rebase onto master.

Fabio B. Silva FabioBatSilva commented on the diff
lib/Doctrine/Common/Annotations/DocParser.php
@@ -929,6 +929,10 @@ private function Arrayx()
929 929 $array = $values = array();
930 930
931 931 $this->match(DocLexer::T_OPEN_CURLY_BRACES);
  932 + if ($this->lexer->isNextToken(DocLexer::T_CLOSE_CURLY_BRACES)) {
  933 + $this->match(DocLexer::T_CLOSE_CURLY_BRACES);
  934 + return $array;
1
Fabio B. Silva Owner

Missing line before return statement

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Fabio B. Silva FabioBatSilva commented on the diff
lib/Doctrine/Common/Annotations/DocParser.php
@@ -929,6 +929,10 @@ private function Arrayx()
929 929 $array = $values = array();
930 930
931 931 $this->match(DocLexer::T_OPEN_CURLY_BRACES);
  932 + if ($this->lexer->isNextToken(DocLexer::T_CLOSE_CURLY_BRACES)) {
1
Fabio B. Silva Owner

Missing line before conditional statement

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Benjamin Eberlei
Owner

@Ocramius common doesnt have annotations in master anymore, this is just for cross reference the bugfix with annotations,where the patch is also a PR.

Marco Pivetta
Collaborator

Whoops! Didn't notice that, sorry!

Benjamin Eberlei
Owner

This was fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Mar 29, 2013
Christian Müller kitsunet Allow empty arrays in annotations
an empty array so far is impossible as it either results in a parse error if you just do the obvious {} or if you try {""} it will create an empty entry which in turn will cause errors depending on the annotation.
ea57779
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 4 additions and 0 deletions. Show diff stats Hide diff stats

  1. +4 0 lib/Doctrine/Common/Annotations/DocParser.php
4 lib/Doctrine/Common/Annotations/DocParser.php
@@ -929,6 +929,10 @@ private function Arrayx()
929 929 $array = $values = array();
930 930
931 931 $this->match(DocLexer::T_OPEN_CURLY_BRACES);
  932 + if ($this->lexer->isNextToken(DocLexer::T_CLOSE_CURLY_BRACES)) {
  933 + $this->match(DocLexer::T_CLOSE_CURLY_BRACES);
  934 + return $array;
  935 + }
932 936 $values[] = $this->ArrayEntry();
933 937
934 938 while ($this->lexer->isNextToken(DocLexer::T_COMMA)) {

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.