Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Unindentified index 1 #82

Closed
chris-kruining opened this issue Jul 15, 2016 · 9 comments
Closed

Unindentified index 1 #82

chris-kruining opened this issue Jul 15, 2016 · 9 comments

Comments

@chris-kruining
Copy link

src/Generator/MethodGenerator.php -> clearBodyIndention (lines 90 to 109)

is trying to parse the following body:

array (size=1)
0 => string ' return $this->getServiceLocator()->get('Core\Page\Service\PageService');' (length=86)

(this is a vardump of the result from the explode on line 96)

this method asumes that all my functions have an enter at the first line, I'd suggest to make this method a tad bit smarter so that it is able to work when you have a oneliner, like I have in my case.

zendframework-zend-code-001.txt

@chris-kruining
Copy link
Author

zendframework-zend-code-001.txt

oops, still getting used to php7 :P

@Ocramius
Copy link
Member

Requires a failing test case

@chris-kruining
Copy link
Author

Sorry. I'm new to the 'official' bug reporting. How does such a failing test case look like? Do I make a unit test that fails? Do I suply an exsisting unit test with my function so that that test fails?

@Ocramius
Copy link
Member

@chris-kruining
Copy link
Author

This is the code wich caused the bug; because all the functions are 1-liners the explode on \n will fail to produce an array with more than one result
zendframework-zend-code-002.txt

I hope this will help :D

@Ocramius
Copy link
Member

@chris-kruining could you try sending a patch for the MethodGeneratorTest.php that I linked above?

@chris-kruining
Copy link
Author

chris-kruining commented Jul 18, 2016

testClearBodyIndentation.txt

like this? in my testcase it should fail with the current code in de methodgenerator.
(I couldn't manage to make a pull request, git was being an asshole)

@Saeven
Copy link

Saeven commented Jul 18, 2016

Test checked in
#83

@Ocramius
Copy link
Member

@Saeven thanks! Closing this one as duplicate.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants