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

Added fix to prevent method lines to be intended again and again #7210

Conversation

RalfEggert
Copy link
Contributor

This PR fixes #7209

It makes sure that all unnecessary leading spaces from all code lines within a method are removed properly. Please look into issue #7209 for more details.

@Martin-P
Copy link
Contributor

I think this can use a test 😉

@@ -61,12 +61,41 @@ public static function fromReflection(MethodReflection $reflectionMethod)
$method->setParameter(ParameterGenerator::fromReflection($reflectionParameter));
}

$method->setBody($reflectionMethod->getBody());
$method->setBody(self::clearBodyIndention($reflectionMethod->getBody()));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

static::

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@RalfEggert
Copy link
Contributor Author

I added a unit test ZendTest\Code\Generator\MethodGeneratorTest::testMethodFromReflectionMultiLinesIndention() to test this new behaviour.

<?php
/**
* File header here
*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

license header here :

/**
 * Zend Framework (http://framework.zend.com/)
 *
 * @link      http://github.com/zendframework/zf2 for the canonical source repository
 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
 * @license   http://framework.zend.com/license/new-bsd New BSD License
 */

@RalfEggert
Copy link
Contributor Author

Would be great if this fix could be added to milestone 2.4.0...

@weierophinney weierophinney added this to the 2.4.0 milestone Feb 19, 2015
@weierophinney weierophinney merged commit e5e367b into zendframework:develop Feb 25, 2015
weierophinney added a commit that referenced this pull request Feb 25, 2015
…ass-reflection

Added fix to prevent method lines to be intended again and again
weierophinney added a commit that referenced this pull request Feb 25, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants