Skip to content

[Forwordport2.2] Fix incorrect type hinting in PHPDocs #16118

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

Closed
wants to merge 20 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
1b46e82
fix tets fixture and mark return processor as @api
seruymt Apr 24, 2018
0a9d3ab
Merge pull request #11 from chirag-wagento/2.2-develop-PR-port-14842
chirag-wagento Jun 5, 2018
a61a376
Remove unused WriteInterface namespace
Apr 24, 2018
e7e0a1f
Merge pull request #13 from chirag-wagento/2.2-develop-PR-port-14834
chirag-wagento Jun 5, 2018
6a9fb4c
Merge pull request #14 from chirag-wagento/2.2-develop-PR-port-14805
chirag-wagento Jun 5, 2018
0a0d781
PHPDoc and type hints
May 28, 2018
a1d76f7
Merge pull request #19 from chirag-wagento/2.2-develop-PR-port-15558
chirag-wagento Jun 7, 2018
fc07f22
Merge remote-tracking branch 'upstream/2.2-develop' into 2.2-develop
chirag-wagento Jun 7, 2018
7f0e42f
Merge remote-tracking branch 'upstream/2.2-develop' into 2.2-develop
chirag-wagento Jun 11, 2018
33c1cd4
Avoid calling function repetitively in loop conditionals
lfluvisotto Jun 11, 2018
2a23c37
Avoid calling function repetitively in loop conditionals
lfluvisotto Jun 11, 2018
0c176c6
Merge pull request #26 from chirag-wagento/2.2-develop-PR-port-16027
chirag-wagento Jun 12, 2018
d7e021e
add missing properties
May 28, 2018
74f31f5
reference to invalid class Magento\Backend\Block\Catalog\Product\Widg…
May 28, 2018
4252db9
widget.xml to match fixed class reference
May 28, 2018
906fd4c
add SuppressWarnings(PHPMD.TooManyFields)
May 28, 2018
5250cd4
Merge pull request #38 from chirag-wagento/2.2-develop-PR-port-15554
chirag-wagento Jun 12, 2018
ab79179
Merge remote-tracking branch 'upstream/2.2-develop' into 2.2-develop
chirag-wagento Jun 14, 2018
c53b9ac
Merge branch '2.2-develop' of github.com:chirag-wagento/magento2 into…
chirag-wagento Jun 14, 2018
823627d
Fix incorrect type hinting in PHPDocs for Forwordport 2.2.
chirag-wagento Jun 14, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/code/Magento/Backend/Block/Dashboard/Graph.php
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ public function getChartUrl($directUrl = true)
$thisdataarray = $serie;
if ($this->_encoding == "s") {
// SIMPLE ENCODING
for ($j = 0; $j < sizeof($thisdataarray); $j++) {
for ($j = 0, $jMax = sizeof($thisdataarray); $j < $jMax; $j++) {
$currentvalue = $thisdataarray[$j];
if (is_numeric($currentvalue)) {
$ylocation = round(
Expand All @@ -344,7 +344,7 @@ public function getChartUrl($directUrl = true)
}
} else {
// EXTENDED ENCODING
for ($j = 0; $j < sizeof($thisdataarray); $j++) {
for ($j = 0, $jMax = sizeof($thisdataarray); $j < $jMax; $j++) {
$currentvalue = $thisdataarray[$j];
if (is_numeric($currentvalue)) {
if ($yrange) {
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Catalog/Block/Adminhtml/Category/Tree.php
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ public function getBreadcrumbsJavascript($path, $javascriptVarName)
*
* @param Node|array $node
* @param int $level
* @return string
* @return array
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings(PHPMD.NPathComplexity)
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ function (node, e) {
*
* @param \Magento\Framework\Data\Tree\Node|array $node
* @param int $level
* @return string
* @return array
*/
protected function _getNodeJson($node, $level = 0)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Element extends \Magento\Backend\Block\Widget\Form\Renderer\Fieldset\Eleme
/**
* Retrieve data object related with form
*
* @return \Magento\Catalog\Model\Product || \Magento\Catalog\Model\Category
* @return \Magento\Catalog\Model\Product|\Magento\Catalog\Model\Category
*/
public function getDataObject()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,7 @@ protected function _prepareColumns()
'type' => 'options',
'options' => ['1' => __('Yes'), '0' => __('No')],
'align' => 'center'
],
'is_user_defined'
]
);

$this->_eventManager->dispatch('product_attribute_grid_build', ['grid' => $this]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function getSelectorOptions()
*
* @param string $labelPart
* @param int $templateId
* @return \Magento\Catalog\Model\ResourceModel\Product\Attribute\Collection
* @return array
*/
public function getSuggestedAttributes($labelPart, $templateId = null)
{
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Catalog/Block/Adminhtml/Rss/Grid/Link.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function isRssAllowed()
}

/**
* @return string
* @return array
*/
protected function getLinkParams()
{
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Catalog/Block/Category/Rss/Link.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function getLabel()
}

/**
* @return string
* @return array
*/
protected function getLinkParams()
{
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Catalog/Block/Product/AbstractProduct.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ public function getAddToCompareUrl()
* Gets minimal sales quantity
*
* @param \Magento\Catalog\Model\Product $product
* @return int|null
* @return float|null
*/
public function getMinimalQty($product)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ public function getPrice($price, $includingTax = null)
* Returns price converted to current currency rate
*
* @param float $price
* @return float
* @return float|string
*/
public function getCurrencyPrice($price)
{
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Catalog/Block/Rss/Product/Special.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ protected function _construct()
}

/**
* @return string
* @return array
*/
public function getRssData()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ public function testTierPrices($priceScope, $expectedWebsiteId)
$this->assertTrue(is_array($tpArray));
$this->assertEquals(sizeof($tps), sizeof($tpArray));

for ($i = 0; $i < sizeof($tps); $i++) {
for ($i = 0, $iMax = sizeof($tps); $i < $iMax; $i++) {
$tpData = $tpArray[$i];
$this->assertEquals($expectedWebsiteId, $tpData['website_id'], 'Website Id does not match');
$this->assertEquals($tps[$i]->getValue(), $tpData['price'], 'Price/Value does not match');
Expand Down Expand Up @@ -233,7 +233,7 @@ public function testTierPrices($priceScope, $expectedWebsiteId)
$this->assertEquals(50, $tpRest->getExtensionAttributes()->getPercentageValue());
}

for ($i = 0; $i < sizeof($tps); $i++) {
for ($i = 0, $iMax = sizeof($tps); $i < $iMax; $i++) {
$this->assertEquals(
$tps[$i]->getValue(),
$tpRests[$i]->getValue(),
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Payment/Model/Method/Cc.php
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ public function validateCcNum($ccNumber)
$cardNumber = strrev($ccNumber);
$numSum = 0;

for ($i = 0; $i < strlen($cardNumber); $i++) {
for ($i = 0, $iMax = strlen($cardNumber); $i < $iMax; $i++) {
$currentNum = substr($cardNumber, $i, 1);

/**
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Sales/Model/Order/Pdf/AbstractPdf.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ public function widthForStringUsingFontSize($string, $font, $fontSize)
);

$characters = [];
for ($i = 0; $i < strlen($drawingString); $i++) {
for ($i = 0, $iMax = strlen($drawingString); $i < $iMax; $i++) {
$characters[] = ord($drawingString[$i++]) << 8 | ord($drawingString[$i]);
}
$glyphs = $font->glyphNumbersForCharacters($characters);
Expand Down
4 changes: 1 addition & 3 deletions app/code/Magento/Sales/Model/Order/Shipment/Item.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,7 @@ public function getOrderItem()
* Declare qty
*
* @param float $qty
* @return \Magento\Sales\Model\Order\Shipment\Item
* @throws \Magento\Framework\Exception\LocalizedException
* @return $this
*/
public function setQty($qty)
{
Expand All @@ -159,7 +158,6 @@ public function setQty($qty)
* Applying qty to order item
*
* @return $this
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function register()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

/**
* Class ReturnProcessor
*
* @api
*/
class ReturnProcessor
{
Expand Down
3 changes: 1 addition & 2 deletions app/code/Magento/Ui/Model/Export/ConvertToCsv.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
use Magento\Framework\Exception\FileSystemException;
use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\Filesystem;
use Magento\Framework\Filesystem\Directory\WriteInterface;
use Magento\Ui\Component\MassAction\Filter;

/**
Expand All @@ -18,7 +17,7 @@
class ConvertToCsv
{
/**
* @var WriteInterface
* @var DirectoryList
*/
protected $directory;

Expand Down
3 changes: 1 addition & 2 deletions app/code/Magento/Ui/Model/Export/ConvertToXml.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
use Magento\Framework\Exception\FileSystemException;
use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\Filesystem;
use Magento\Framework\Filesystem\Directory\WriteInterface;
use Magento\Ui\Component\MassAction\Filter;

/**
Expand All @@ -22,7 +21,7 @@
class ConvertToXml
{
/**
* @var WriteInterface
* @var DirectoryList
*/
protected $directory;

Expand Down
11 changes: 11 additions & 0 deletions app/code/Magento/Widget/Model/Widget/Instance.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
* @method int getThemeId()
*
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
* @SuppressWarnings(PHPMD.TooManyFields)
* @since 100.0.2
*/
class Instance extends \Magento\Framework\Model\AbstractModel
Expand Down Expand Up @@ -96,6 +97,16 @@ class Instance extends \Magento\Framework\Model\AbstractModel
*/
protected $_relatedCacheTypes;

/**
* @var \Magento\Catalog\Model\Product\Type
*/
protected $_productType;

/**
* @var \Magento\Widget\Model\Config\Reader
*/
protected $_reader;

/**
* @var \Magento\Framework\Escaper
*/
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Widget/Test/Unit/Model/_files/widget.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
</parameter>
<parameter name="id_path" xsi:type="block" visible="true" required="true" sort_order="10">
<label translate="true">Product</label>
<block class="Magento\Backend\Block\Catalog\Product\Widget\Chooser">
<block class="Magento\Catalog\Block\Adminhtml\Product\Widget\Chooser">
<data>
<item name="button" xsi:type="array">
<item name="open" xsi:type="string" translate="true">Select Product...</item>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
'type' => 'label',
'@' => ['type' => 'complex'],
'helper_block' => [
'type' => \Magento\Backend\Block\Catalog\Product\Widget\Chooser::class,
'type' => \Magento\Catalog\Block\Adminhtml\Product\Widget\Chooser::class,
'data' => ['button' => ['open' => 'Select Product...']],
],
'visible' => '1',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

use Magento\Sales\Model\Order\ShipmentFactory;

require 'order.php';

$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
Expand Down Expand Up @@ -36,4 +39,10 @@

$order->setIsInProcess(true);

$transaction->addObject($invoice)->addObject($order)->save();
$items = [];
foreach ($order->getItems() as $orderItem) {
$items[$orderItem->getId()] = $orderItem->getQtyOrdered();
}
$shipment = $objectManager->get(ShipmentFactory::class)->create($order, $items);

$transaction->addObject($invoice)->addObject($shipment)->addObject($order)->save();
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function testDictionaryGetter()
}

$file = $this->getMockForAbstractClass(\Magento\Framework\Filesystem\File\ReadInterface::class);
for ($i = 0; $i < count($data); $i++) {
for ($i = 0, $iMax = count($data); $i < $iMax; $i++) {
$file->expects($this->at($i))->method('readCsv')->will($this->returnValue($data[$i]));
}
$file->expects($this->at($i))->method('readCsv')->will($this->returnValue(false));
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/Magento/Framework/Archive.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public function pack($source, $destination = 'packed.tgz', $skipRoot = false)
{
$archivers = $this->_getArchivers($destination);
$interimSource = '';
for ($i = 0; $i < count($archivers); $i++) {
for ($i = 0, $iMax = count($archivers); $i < $iMax; $i++) {
if ($i == count($archivers) - 1) {
$packed = $destination;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public function getCleanPath($path)
$pathParts = explode("/", $pathTokP);
$realPathParts = [];

for ($i = 0, $realPathParts = []; $i < count($pathParts); $i++) {
for ($i = 0, $realPathParts = [], $iMax = count($pathParts); $i < $iMax; $i++) {
if ($pathParts[$i] == '.') {
continue;
} elseif ($pathParts[$i] == '..') {
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/Magento/Framework/Filter/Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ protected function getVariable($value, $default = '{no_value_defined}')
$stackVars = $tokenizer->tokenize();
$result = $default;
$last = 0;
for ($i = 0; $i < count($stackVars); $i++) {
for ($i = 0, $iMax = count($stackVars); $i < $iMax; $i++) {
if ($i == 0 && isset($this->templateVars[$stackVars[$i]['name']])) {
// Getting of template value
$stackVars[$i]['variable'] = & $this->templateVars[$stackVars[$i]['name']];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ protected function _getOrderedTimerIds()

$prevTimerId = $timerIds[0];
$result = [$prevTimerId];
for ($i = 1; $i < count($timerIds); $i++) {
for ($i = 1, $iMax = count($timerIds); $i < $iMax; $i++) {
$timerId = $timerIds[$i];
/* Skip already added timer */
if (!$timerId) {
Expand All @@ -209,7 +209,7 @@ protected function _getOrderedTimerIds()
/* Loop over all timers that need to be closed under previous timer */
while (strpos($timerId, $prevTimerId . Profiler::NESTING_SEPARATOR) !== 0) {
/* Add to result all timers nested in the previous timer */
for ($j = $i + 1; $j < count($timerIds); $j++) {
for ($j = $i + 1, $jMax = count($timerIds); $j < $jMax; $j++) {
if (strpos($timerIds[$j], $prevTimerId . Profiler::NESTING_SEPARATOR) === 0) {
$result[] = $timerIds[$j];
/* Mark timer as already added */
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/Magento/Framework/System/Ftp.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function mkdirRecursive($path, $mode = 0777)
$dir = explode("/", $path);
$path = "";
$ret = true;
for ($i = 0; $i < count($dir); $i++) {
for ($i = 0, $iMax = count($dir); $i < $iMax; $i++) {
$path .= "/" . $dir[$i];
if (!@ftp_chdir($this->_conn, $path)) {
@ftp_chdir($this->_conn, "/");
Expand Down
4 changes: 2 additions & 2 deletions setup/src/Magento/Setup/Module/I18n/Parser/Adapter/Html.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ protected function _parse()

$results = [];
preg_match_all(Filter::CONSTRUCTION_PATTERN, $data, $results, PREG_SET_ORDER);
for ($i = 0; $i < count($results); $i++) {
for ($i = 0, $iMax = count($results); $i < $iMax; $i++) {
if ($results[$i][1] === Filter::TRANS_DIRECTIVE_NAME) {
$directive = [];
if (preg_match(Filter::TRANS_DIRECTIVE_REGEX, $results[$i][2], $directive) !== 1) {
Expand All @@ -43,7 +43,7 @@ protected function _parse()
}

preg_match_all(self::HTML_FILTER, $data, $results, PREG_SET_ORDER);
for ($i = 0; $i < count($results); $i++) {
for ($i = 0, $iMax = count($results); $i < $iMax; $i++) {
if (!empty($results[$i]['value'])) {
$this->_addPhrase($results[$i]['value']);
}
Expand Down
4 changes: 2 additions & 2 deletions setup/src/Magento/Setup/Module/I18n/Parser/Adapter/Js.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ protected function _parse()
$fileRow = fgets($fileHandle, 4096);
$results = [];
preg_match_all('/mage\.__\(\s*([\'"])(.*?[^\\\])\1.*?[),]/', $fileRow, $results, PREG_SET_ORDER);
for ($i = 0; $i < count($results); $i++) {
for ($i = 0, $iMax = count($results); $i < $iMax; $i++) {
if (isset($results[$i][2])) {
$quote = $results[$i][1];
$this->_addPhrase($quote . $results[$i][2] . $quote, $lineNumber);
}
}

preg_match_all('/\\$t\(\s*([\'"])(.*?[^\\\])\1.*?[),]/', $fileRow, $results, PREG_SET_ORDER);
for ($i = 0; $i < count($results); $i++) {
for ($i = 0, $iMax = count($results); $i < $iMax; $i++) {
if (isset($results[$i][2])) {
$quote = $results[$i][1];
$this->_addPhrase($quote . $results[$i][2] . $quote, $lineNumber);
Expand Down