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

Mage_Api - IDE improvements #677

Closed
wants to merge 11 commits into from
Closed

Mage_Api - IDE improvements #677

wants to merge 11 commits into from

Conversation

sreichel
Copy link
Contributor

@sreichel sreichel commented May 23, 2019

  • added/fixed missing DOCs
  • changed @return to $this for methods
  • use @inheritdoc for methods that return parent call
  • added class check (instanceof) for those methods (instead adding @var SomeClass)
  • added class check (instanceof) for mysql related methods in setup scripts
  • changed magic methods on Varien_Objects to setData()/getData()
  • changed typehint to concrete class instead of Mage_Core_Model_Abstract
  • flipped @var annotations

- added/fixed missing DOCs
- changed @return to $this for methods
- use @inheritdoc for methods that return parent call
- added class check (instanceof) for those methods (instead adding @var SomeClass)
- added class check (instanceof) for mysql related methods in setup scripts
- changed magic methods on Varien_Objects to setData()/getData()
- flipped @var annotations
@Flyingmana
Copy link
Contributor

sorry for the extra work this causes, but I think the changes inside the code (like in the method where I did comment in) should be better done in a separate PR.
The non-code changes look fine, but reviewing the code part is currently to much extra work for me

@sreichel
Copy link
Contributor Author

@Flyingmana no problem to split this.

Are you okay with revert instanceof and parent::method() changes, but keep set/getData() instead of magic methods on Varien_Object?

@sreichel sreichel added the hold label May 28, 2019
sreichel added 7 commits May 31, 2019 01:19
- _updateRoleUsersAcl() requires Mage_Api_Model_Roles, not Mage_Core_Model_Abstract
Instead of replacing magic methods on Varien_Object just for IDE,
maybe it would be better to add some pseudo classes with @method annotations.
@sreichel sreichel removed the hold label May 30, 2019
Copy link
Contributor

@Flyingmana Flyingmana left a comment

Choose a reason for hiding this comment

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

any kind of code changes should not be mixed with docs or code style changes, its to hard to properly review them because of the mass of changes.

app/code/core/Mage/Api/Controller/Action.php Outdated Show resolved Hide resolved
@@ -0,0 +1,10 @@
<?php
Copy link
Contributor

Choose a reason for hiding this comment

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

IDE unrelated change (new code?)

Copy link
Contributor Author

@sreichel sreichel Jun 1, 2019

Choose a reason for hiding this comment

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

Proposal. See #687. Should not break anything.

@@ -0,0 +1,14 @@
<?php
Copy link
Contributor

Choose a reason for hiding this comment

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

IDE unrelated change (new code)

Copy link
Contributor Author

@sreichel sreichel Jun 1, 2019

Choose a reason for hiding this comment

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

Proposal. See #687. Should not break anything.

@@ -49,6 +49,9 @@ public function assert(Mage_Api_Model_Acl $acl, Mage_Api_Model_Acl_Role $role =
return $this->_isCleanTime(time());
}

/**
* @param $time
Copy link
Contributor

Choose a reason for hiding this comment

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

no benefit without type for IDE

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Method has no content. Just supress PHPStorm warning ;)

app/code/core/Mage/Api/Model/Config.php Outdated Show resolved Hide resolved
app/code/core/Mage/Api/Model/Resource/User.php Outdated Show resolved Hide resolved
app/code/core/Mage/Api/Model/Resource/User.php Outdated Show resolved Hide resolved
@@ -354,7 +354,7 @@ public function add(Mage_Core_Model_Abstract $user)
if ($user->getId() > 0) {
$role = Mage::getModel('api/role')->load($user->getRoleId());
} else {
$role = new Varien_Object(array('tree_level' => 0));
$role = new Mage_Api_Helper_Object_Role(array('tree_level' => 0));
Copy link
Contributor

Choose a reason for hiding this comment

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

code change

Copy link
Contributor Author

@sreichel sreichel Jun 1, 2019

Choose a reason for hiding this comment

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

Pls see #687

app/code/core/Mage/Api/Model/Wsdl/Config.php Outdated Show resolved Hide resolved
@@ -51,7 +54,7 @@ public function __construct($sourceData=null)
unset($queryParams['wsdl']);

// set up default WSDL template variables
$this->_wsdlVariables = new Varien_Object(
$this->_wsdlVariables = new Mage_Api_Helper_Object_Wsdl(
Copy link
Contributor

Choose a reason for hiding this comment

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

code change

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Proposal. Please see #687

@tbaden tbaden added the review needed Problem should be verified label Jun 1, 2019
@sreichel sreichel closed this Jun 2, 2019
@sreichel sreichel deleted the cleanup/Api branch June 2, 2019 13:35
@sreichel sreichel added invalid and removed review needed Problem should be verified labels Jun 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants