-
-
Notifications
You must be signed in to change notification settings - Fork 440
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
Removed unnecessary replacing of variable from parent #1495
Removed unnecessary replacing of variable from parent #1495
Conversation
/** | ||
* @var Mage_Directory_Model_Country[] | ||
*/ | ||
protected $_items; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will loose phpdoc (typehint) by this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 resolved in ea13c48
On the vardocs, I like to add methods like this: /**
* @method Mage_Directory_Model_Country getFirstItem()
* @method Mage_Directory_Model_Country getLastItem()
* @method null|Mage_Directory_Model_Country getItemById($idValue)
* @method Mage_Directory_Model_Country[] getItems()
* @method Mage_Directory_Model_Country[] getIterator() The last one in particular is helpful when iterating a collection so that the loop value has correct type hinting automatically, at least in PhpStorm. |
Which phpStorm version do you use? I thought this would already work? Wait ... no time to check, but I solved in another way. I added something like |
PhpStorm is smart enough to use the return type of foreach (Mage::getResourceModel('directory/country_collection') as $country) {
$country->getIso2Code(); // returns string
} Also this: Mage::getResourceModel('directory/country_collection')->getFirstItem()->getIso2Code(); // returns string My example with |
@colinmollenhour you're right. |
Description (*)
Mage_Directory_Model_Resource_Country_Collection
extendingVarien_Data_Collection
where is$_items
already defined:And there was diferrent initial value.
Contribution checklist (*)