Parse docblock indented with tabs #3273

Closed
wants to merge 3 commits into
from

Projects

None yet

3 participants

@mtorromeo
Contributor

This fixes the regular expression used to clean-up the docComments.
The tab escape (\t) was not parsed correctly because it was specified inside a single quoted string.

Additionally the DocBlockScanner did not catch tabs as whitespace tokens.

This fixes #2445

mtorromeo added some commits Dec 21, 2012
@mtorromeo mtorromeo Parse docblock indented with tabs
This fixes the regular expression used to clean-up the docComments.
The tab escape (\t) was not parsed correctly because it was specified
inside a single quoted string.

Additionally the cleaned-up doc comment ($this->cleanDocComment) was
used by the DocBlockScanner.

This fixes #2445
76cd37b
@mtorromeo mtorromeo Fixed DOCBLOCK_WHITESPACE token to detect tabs
This definetely fixes #2445 and passes all unit tests.
New unit tests for docblocks indented with tabs that
fail to be parsed without this fix.
7c84a09
@mtorromeo
Contributor

I just noticed that there is a test that is not passed and that is the code style checker:
https://travis-ci.org/zendframework/zf2/jobs/3778614

I think this is a false positive and actually an exception to the rule since I specifically added a class to the unit tests with tabs indentation (that is the whole point of the test).

@Maks3w Maks3w commented on an outdated diff Dec 22, 2012
library/Zend/Code/Scanner/DocBlockScanner.php
@@ -269,7 +269,7 @@ protected function tokenize()
goto TOKENIZER_TOP;
}
- if ($currentChar === ' ') {
+ if ($currentChar === ' ' or $currentChar === "\t") {
@Maks3w
Maks3w Dec 22, 2012 Member

Use || instead of or

@mtorromeo
Contributor

Is this good for merge now?

@weierophinney weierophinney added a commit that referenced this pull request Jan 3, 2013
@weierophinney weierophinney [#3273] Added PHP-CS-Fixer rules
- Omit test file known to have issues (as they are required for tests)
24cb9e6
@weierophinney weierophinney added a commit that referenced this pull request Jan 3, 2013
@weierophinney weierophinney Merge branch 'hotfix/3273' into develop
Forward port #3273
5e94a37
@weierophinney weierophinney added a commit that closed this pull request Jan 3, 2013
@weierophinney weierophinney Merge branch 'hotfix/3273'
Close #3273
dc3c980
@weierophinney
Member

Looks good. I added .php_cs files in the project root and tests directory to exclude the one file when running CS checks.

@weierophinney weierophinney was assigned Jan 3, 2013
@weierophinney weierophinney added a commit to zendframework/zend-i18n-resources that referenced this pull request May 28, 2015
@weierophinney weierophinney [zendframework/zendframework#3273] Added PHP-CS-Fixer rules
- Omit test file known to have issues (as they are required for tests)
ef15bd1
@weierophinney weierophinney added a commit to zendframework/zend-i18n-resources that referenced this pull request May 28, 2015
@weierophinney weierophinney Merge branch 'hotfix/3273' 7884984
@weierophinney weierophinney added a commit to zendframework/zend-i18n-resources that referenced this pull request May 28, 2015
@weierophinney weierophinney Merge branch 'hotfix/3273' into develop f673f5c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment