Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
c4a9ce1c
Commit
c4a9ce1c
authored
Mar 31, 2010
by
romanb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[2.0][DDC-483] Fixed.
parent
5aa14ab3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
7 deletions
+16
-7
Parser.php
lib/Doctrine/Common/Annotations/Parser.php
+6
-7
ParserTest.php
tests/Doctrine/Tests/Common/Annotations/ParserTest.php
+10
-0
No files found.
lib/Doctrine/Common/Annotations/Parser.php
View file @
c4a9ce1c
...
...
@@ -410,12 +410,11 @@ class Parser
$this
->
match
(
Lexer
::
T_CLOSE_CURLY_BRACES
);
foreach
(
$values
as
$value
)
{
$key
=
key
(
$value
);
if
(
is_string
(
$key
))
{
$array
[
$key
]
=
$value
[
$key
];
list
(
$key
,
$val
)
=
$value
;
if
(
$key
!==
null
)
{
$array
[
$key
]
=
$val
;
}
else
{
$array
[]
=
$val
ue
[
$key
]
;
$array
[]
=
$val
;
}
}
...
...
@@ -441,9 +440,9 @@ class Parser
$key
=
$this
->
_lexer
->
token
[
'value'
];
$this
->
match
(
Lexer
::
T_EQUALS
);
return
array
(
$key
=>
$this
->
PlainValue
());
return
array
(
$key
,
$this
->
PlainValue
());
}
return
array
(
$this
->
Value
());
return
array
(
null
,
$this
->
Value
());
}
}
\ No newline at end of file
tests/Doctrine/Tests/Common/Annotations/ParserTest.php
View file @
c4a9ce1c
...
...
@@ -25,6 +25,16 @@ class ParserTest extends \Doctrine\Tests\DoctrineTestCase
$this
->
assertNull
(
$annot
->
value
);
$this
->
assertTrue
(
is_array
(
$annot
->
foo
));
$this
->
assertTrue
(
isset
(
$annot
->
foo
[
'key1'
]));
// Numerical arrays
$result
=
$parser
->
parse
(
'@Name({2="foo", 4="bar"})'
);
$annot
=
$result
[
'Doctrine\Tests\Common\Annotations\Name'
];
$this
->
assertTrue
(
is_array
(
$annot
->
value
));
$this
->
assertEquals
(
'foo'
,
$annot
->
value
[
2
]);
$this
->
assertEquals
(
'bar'
,
$annot
->
value
[
4
]);
$this
->
assertFalse
(
isset
(
$annot
->
value
[
0
]));
$this
->
assertFalse
(
isset
(
$annot
->
value
[
1
]));
$this
->
assertFalse
(
isset
(
$annot
->
value
[
3
]));
// Nested arrays with nested annotations
$result
=
$parser
->
parse
(
'@Name(foo={1,2, {"key"=@Name}})'
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment