Zend Framework

Allow a tag with no parameters and multiple spaces between tag/value/description

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: 1.9.3
  • Component/s: Zend_Reflection
  • Labels:
    None
  • Fix Version Priority:
    Nice to Have

Description

Hi!

It would be great to allow a single tag and multiple spaces in tags.
E.g. i annotated all my service methods with @service, but zend_reflection complains because no value is present

I also like to "format" my tags:

* @myfirsttag
* @mysecondtag tagvalue
* @param       int    $var
* @return      string some value

These changes are done with minor regular-expression-updates:

--- Tag.php	(revision 15636)
+++ Tag.php	(working copy)
@@ -55,7 +55,7 @@
-        if (!preg_match('#^@(\w+)\s#', $tagDocblockLine, $matches)) {
+        if (!preg_match('#^@(\w+)(\s|$)#', $tagDocblockLine, $matches)) {
@@ -107,13 +107,13 @@
-        if (!preg_match('#^@(\w+)\s(.*)?#', $tagDocblockLine, $matches)) {
+        if (!preg_match('#^@(\w+)(?:\s+([^\s].*)|$)?#', $tagDocblockLine, $matches)) {
===================================================================
--- Tag/Param.php	(revision 15636)
+++ Tag/Param.php	(working copy)
@@ -49,7 +49,7 @@
-        if (!preg_match('#^@(\w+)\s(\w+)(?:\s(\$\S+))?(?:\s(.*))?#s', $tagDocblockLine, $matches)) {
+        if (!preg_match('#^@(\w+)\s+(\w+)(?:\s(\$\S+))?(?:\s([^\s].*))?#s', $tagDocblockLine, $matches)) {
===================================================================
--- Tag/Return.php	(revision 15636)
+++ Tag/Return.php	(working copy)
@@ -43,7 +43,7 @@
-        if (!preg_match('#^@(\w+)\s(\w+)(?:\s(.*))?#', $tagDocblockLine, $matches)) {
+        if (!preg_match('#^@(\w+)\s+(\w+)(?:\s+([^\s].*))?#', $tagDocblockLine, $matches)) {

thanks.

  1. ZF-6726.lib.diff
    02/Sep/09 5:45 AM
    2 kB
    Carlton Gibson
  2. ZF-6726.test.diff
    02/Sep/09 5:44 AM
    4 kB
    Carlton Gibson

Issue Links

Activity

Hide
daniel prieler added a comment - - edited

I also know now why a single-tag did work under windows and not under linux:
because of \r\n newlines the $tagDocblockLine contains the \r!

So the expression "@\w+\s" did match becuase \s matches \r's

maybe we should add a change request for this issue too?

regards, Daniel.

Show
daniel prieler added a comment - - edited I also know now why a single-tag did work under windows and not under linux: because of \r\n newlines the $tagDocblockLine contains the \r! So the expression "@\w+\s" did match becuase \s matches \r's maybe we should add a change request for this issue too? regards, Daniel.
Hide
Carlton Gibson added a comment -

Unit tests for this issue. Fail before fix.

Show
Carlton Gibson added a comment - Unit tests for this issue. Fail before fix.
Hide
Carlton Gibson added a comment -

Patch file fixing issue. New tests all pass.

Show
Carlton Gibson added a comment - Patch file fixing issue. New tests all pass.
Hide
Carlton Gibson added a comment -

Ralph,

I have the changeset for this issue and ZF-7227 waiting for your okay. Let me know if there are any problems and I'll fix/commit.

Regards,
Carlton

Show
Carlton Gibson added a comment - Ralph, I have the changeset for this issue and ZF-7227 waiting for your okay. Let me know if there are any problems and I'll fix/commit. Regards, Carlton
Hide
Benjamin Eberlei added a comment -

Carlton can you please commit this fixes? I cant review them without them being in trunk

Show
Benjamin Eberlei added a comment - Carlton can you please commit this fixes? I cant review them without them being in trunk
Hide
Carlton Gibson added a comment -

Okay: Committed revision 18072.

Ralph said he'd review the patch, then I'd commit. Still learning.

Show
Carlton Gibson added a comment - Okay: Committed revision 18072. Ralph said he'd review the patch, then I'd commit. Still learning.
Hide
Carlton Gibson added a comment -

Merged to 1.9 release branch by r18160

Show
Carlton Gibson added a comment - Merged to 1.9 release branch by r18160

People

Vote (3)
Watch (4)

Dates

  • Created:
    Updated:
    Resolved:

Time Tracking

Estimated:
1h
Original Estimate - 1 hour
Remaining:
1h
Remaining Estimate - 1 hour
Logged:
Not Specified
Time Spent - Not Specified