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

Remove "Undefined fields" from app folder #11625

Conversation

adrian-martinez-interactiv4
Copy link
Contributor

@adrian-martinez-interactiv4 adrian-martinez-interactiv4 commented Oct 22, 2017

Remove "Undefined fields" from app folder

Description

This PR adds missing properties to class, and optimize / reorder imports, under app folder.

Fixed Issues (if relevant)

None, improvement, since it's not really a problem, it makes no sense to backport it.

Manual testing scenarios

captura de pantalla 2017-10-22 a las 3 13 02

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)

@orlangur
Copy link
Contributor

@adrian-martinez-interactiv4 are you interested in running "Undefined field" PhpStorm inspection all over the code maybe and fix all "Field declared dynamically" warnings in this PR?

I remember there was even some Fatal Error reported due to field not initialized in constructor.

@dmanners
Copy link
Contributor

@orlangur I would suggest that a complete update of "Undefined fields" should be extracted to a separate issue/pr. I see this as a good fix for now and we can improve in steps.

@orlangur
Copy link
Contributor

@dmanners I wouldn't want to process them as 10-20 PRs on the other hand :) Let's wait for the PR author response and if he will not find my suggestion interesting let's maybe report generic 'up for grabs' issue.

@adrian-martinez-interactiv4
Copy link
Contributor Author

@orlangur @dmanners I'll give a try to fix all Undefined fields errors, I'll keep you updated

@adrian-martinez-interactiv4 adrian-martinez-interactiv4 changed the title Class property 'data' used but not defined in \Magento\Theme\Model\Indexer\Design\Config Remove "Undefined fields" from app folder Oct 23, 2017
@adrian-martinez-interactiv4
Copy link
Contributor Author

This PR will try to fix "Undefined fields" from app folder, lib and dev folders will have its own PR.

@orlangur orlangur self-assigned this Oct 23, 2017
@adrian-martinez-interactiv4 adrian-martinez-interactiv4 force-pushed the FR#THEME-INDEXER-DECLARE-DATA-CLASS-PROPERTY branch from ef4069b to 4805bf2 Compare October 23, 2017 21:25
@adrian-martinez-interactiv4
Copy link
Contributor Author

adrian-martinez-interactiv4 commented Oct 23, 2017

@orlangur Hi, commit 9980202 is the main commit of this PR.

I've left Magento/Sitemap/Model/Observer.php untouched, because it will be fixed by open PR #11320.

About class properties added, visibility has been set according to neighbour properties, and since dynamic declared variables have open visibility, most of defined properties are protected (although some that clearly could be private have been defined so, I already know they all should be private), to ensure the system still works properly. Reviewing if all the protected variables can be changed to private, and make the proper changes if needed is out of the scope of this task.

@adrian-martinez-interactiv4 adrian-martinez-interactiv4 force-pushed the FR#THEME-INDEXER-DECLARE-DATA-CLASS-PROPERTY branch 2 times, most recently from 7926799 to 9980202 Compare October 23, 2017 23:10
@dmanners dmanners removed their assignment Oct 24, 2017
@adrian-martinez-interactiv4
Copy link
Contributor Author

adrian-martinez-interactiv4 commented Oct 24, 2017

@orlangur I don't know what Codacy is complaining about:
captura de pantalla 2017-10-24 a las 20 49 41

Also, I find static tests have failed due to two types of errors, this one was an existing error:
/home/travis/build/magento/magento2/app/code/Magento/Catalog/Observer/Compare/BindCustomerLoginObserver.php:38 Avoid unused parameters such as '$observer'. /home/travis/build/magento/magento2/app/code/Magento/Catalog/Observer/Compare/BindCustomerLogoutObserver.php:38 Avoid unused parameters such as '$observer'.

They fail after adding the variable even when @SuppressWarnings(PHPMD.UnusedLocalVariable) is already used in execute() method. What should I do with them?

The second type:
/home/travis/build/magento/magento2/app/code/Magento/Fedex/Model/Carrier.php:26 The class Carrier has 16 fields. Consider redesigning Carrier to keep the number of fields under 15. /home/travis/build/magento/magento2/app/code/Magento/Shipping/Test/Unit/Controller/Adminhtml/Order/Shipment/NewActionTest.php:17 The class NewActionTest has 16 fields. Consider redesigning NewActionTest to keep the number of fields under 15. /home/travis/build/magento/magento2/app/code/Magento/Widget/Model/Widget/Instance.php:27 The class Instance has 16 fields. Consider redesigning Instance to keep the number of fields under 15.

It looks like missing fields may have been left out on purpose to fit the 15 fields limit. Should I suppress warnings for this classes?

@orlangur
Copy link
Contributor

orlangur commented Oct 24, 2017

Hi @adrian-martinez-interactiv4, I don't have time to review this PR fully this night but here are the quick answers on your questions:

  • simply ignore Codacy, it is not mandatory and complaining on things like else and local variable longer than 20 symbols
  • use @SuppressWarnings(PHPMD.UnusedFormalParameter) annotation
  • yeah, we cannot remove even unused existing fields due to backward compatibility, please suppress those errors

Magento/Sitemap/Model/Observer.php => will be fixed by open PR magento#11320
@adrian-martinez-interactiv4 adrian-martinez-interactiv4 force-pushed the FR#THEME-INDEXER-DECLARE-DATA-CLASS-PROPERTY branch from 9980202 to 85bd65c Compare October 24, 2017 19:54
@adrian-martinez-interactiv4
Copy link
Contributor Author

@orlangur done

@okorshenko okorshenko modified the milestones: January 2018, February 2018 Feb 7, 2018
@okorshenko okorshenko modified the milestones: February 2018, March 2018 Mar 1, 2018
@okorshenko okorshenko added partners-contribution Pull Request is created by Magento Partner and removed partner contribution labels Apr 2, 2018
@okorshenko okorshenko modified the milestones: March 2018, April 2018 Apr 16, 2018
@okorshenko okorshenko modified the milestones: April 2018, May 2018 May 18, 2018
@okorshenko okorshenko removed this from the May 2018 milestone May 31, 2018
@ihor-sviziev
Copy link
Contributor

Hi @adrian-martinez-interactiv4 and @orlangur.
As for me it looks like this PR is too big and has quite big list of conflicts.
I think it's better to close this PR and prepare few smaller PRs that could be processed much faster.

What do you think about it?

@ihor-sviziev ihor-sviziev added Partner: Interactiv4 Pull Request is created by partner Interactiv4 Progress: needs update labels Aug 14, 2018
@ihor-sviziev ihor-sviziev self-assigned this Aug 14, 2018
@sidolov
Copy link
Contributor

sidolov commented Aug 28, 2018

Hi @adrian-martinez-interactiv4 , I am closing this PR now due to inactivity.
Please reopen and update if you wish to continue.
Thank you for the collaboration!

@sidolov sidolov closed this Aug 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Config Partner: Interactiv4 Pull Request is created by partner Interactiv4 partners-contribution Pull Request is created by Magento Partner Progress: needs update Release Line: 2.3
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants