Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

magento/magento2#8607: Interface constructor if present will break Magento compilation #9524

Merged
merged 1 commit into from
May 15, 2017

Conversation

LoganayakiK
Copy link

@LoganayakiK LoganayakiK commented May 5, 2017

Description

$class->isInterface() method of an php reflection class will implement the getConstructor() function not to pull any dependencies from the interface constructor.
So we must have to add this condition in order to call getConstructor(). This solves the issue

Fixed Issues (if relevant)

  1. Interface constructor if present will break Magento compilation #8607: Interface constructor if present will break Magento compilation

Manual testing scenarios

  1. Will be covered with unit test

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)

…pilation

 - $class->isInterface() method of an php reflection class will implement the getConstructor() function not to pull any dependencies from the interface constructor. 
So we must have to add this condition  in order to call getConstructor(). This solves the issue
@magento-cicd2
Copy link
Contributor

magento-cicd2 commented May 5, 2017

CLA assistant check
All committers have signed the CLA.

@adragus-inviqa
Copy link
Contributor

Could you fix the code style to be something like this?

if ($class->isInterface() || 
    !$class->getFileName() || 
    false == $class->hasMethod('__construct') || 
    !$inherited && 
    $class->getConstructor()->class != $class->getName()
) {
    return $output;
}

It looks awful atm.

@okorshenko okorshenko self-assigned this May 9, 2017
@okorshenko okorshenko added this to the May 2017 milestone May 9, 2017
@okorshenko
Copy link
Contributor

@LoganayakiK thank you for your contribution. Could you please cover the fix with unit test?

@LoganayakiK
Copy link
Author

LoganayakiK commented May 9, 2017 via email

@okorshenko
Copy link
Contributor

@LoganayakiK Try this book: Test Driven Development: By Example (author Kent Beck). This is good book to start

@magento-team magento-team merged commit 2963021 into magento:2.1-develop May 15, 2017
magento-team pushed a commit that referenced this pull request May 15, 2017
…ento compilation #9524

 - covered fix with the unit test
magento-team pushed a commit that referenced this pull request May 15, 2017
@magento-team
Copy link
Contributor

@LoganayakiK thank you for your contribution to Magento 2 project

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

Successfully merging this pull request may close these issues.

5 participants