Skip to content

Commit d72bc85

Browse files
MAGETWO-83091: Remove "Undefined fields" from under lib folder #11662
2 parents ad48bf7 + db99d7f commit d72bc85

File tree

26 files changed

+162
-47
lines changed

26 files changed

+162
-47
lines changed

lib/internal/Magento/Framework/App/Test/Unit/Cache/Type/GenericTest.php

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ public function testConstructor($className)
2020
$frontendMock = $this->createMock(\Magento\Framework\Cache\FrontendInterface::class);
2121

2222
$poolMock = $this->createMock(\Magento\Framework\App\Cache\Type\FrontendPool::class);
23+
/** @noinspection PhpUndefinedFieldInspection */
2324
$poolMock->expects(
2425
$this->atLeastOnce()
2526
)->method(
@@ -33,6 +34,7 @@ public function testConstructor($className)
3334
$model = new $className($poolMock);
3435

3536
// Test initialization was done right
37+
/** @noinspection PhpUndefinedFieldInspection */
3638
$this->assertEquals($className::CACHE_TAG, $model->getTag(), 'The tag is wrong');
3739

3840
// Test that frontend is now engaged in operations

lib/internal/Magento/Framework/App/Test/Unit/Response/HttpTest.php

+15-6
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
namespace Magento\Framework\App\Test\Unit\Response;
88

9-
use \Magento\Framework\App\Response\Http;
9+
use Magento\Framework\App\Response\Http;
1010
use Magento\Framework\ObjectManagerInterface;
1111

1212
/**
@@ -20,24 +20,33 @@ class HttpTest extends \PHPUnit\Framework\TestCase
2020
protected $model;
2121

2222
/**
23-
* @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Stdlib\CookieManagerInterface
23+
* @var \Magento\Framework\Stdlib\CookieManagerInterface|\PHPUnit_Framework_MockObject_MockObject
2424
*/
2525
protected $cookieManagerMock;
2626

2727
/**
28-
* @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Stdlib\Cookie\CookieMetadataFactory
28+
* @var \Magento\Framework\Stdlib\Cookie\CookieMetadataFactory|\PHPUnit_Framework_MockObject_MockObject
2929
*/
3030
protected $cookieMetadataFactoryMock;
3131

3232
/**
33-
* @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\App\Http\Context
33+
* @var \Magento\Framework\App\Http\Context|\PHPUnit_Framework_MockObject_MockObject
3434
*/
3535
protected $contextMock;
3636

37-
/** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\App\Http\Context */
37+
/**
38+
* @var \Magento\Framework\App\Http\Context|\PHPUnit_Framework_MockObject_MockObject
39+
*/
3840
protected $dateTimeMock;
3941

40-
/** @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager */
42+
/**
43+
* @var \Magento\Framework\App\Request\Http|\PHPUnit_Framework_MockObject_MockObject
44+
*/
45+
protected $requestMock;
46+
47+
/**
48+
* @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager
49+
*/
4150
protected $objectManager;
4251

4352
protected function setUp()

lib/internal/Magento/Framework/Backup/Test/Unit/FilesystemTest.php

+7-2
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,20 @@ class FilesystemTest extends \PHPUnit\Framework\TestCase
1515
private $objectManager;
1616

1717
/**
18-
* @var \Magento\Framework\Backup\Filesystem\Rollback\Fs
18+
* @var \Magento\Framework\Backup\Filesystem\Rollback\Fs|\PHPUnit_Framework_MockObject_MockObject
1919
*/
2020
private $fsMock;
2121

2222
/**
23-
* @var \Magento\Framework\Backup\Filesystem\Rollback\Ftp
23+
* @var \Magento\Framework\Backup\Filesystem\Rollback\Ftp|\PHPUnit_Framework_MockObject_MockObject
2424
*/
2525
private $ftpMock;
2626

27+
/**
28+
* @var \Magento\Framework\Backup\Filesystem|\PHPUnit_Framework_MockObject_MockObject
29+
*/
30+
private $snapshotMock;
31+
2732
/**
2833
* @var \Magento\Framework\Backup\Filesystem
2934
*/

lib/internal/Magento/Framework/Config/FileResolver.php

+13-7
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
*/
88
namespace Magento\Framework\Config;
99

10-
use Magento\Framework\Module\Dir\Reader as DirReader;
10+
use Magento\Framework\App\Filesystem\DirectoryList;
1111
use Magento\Framework\Filesystem;
12+
use Magento\Framework\Module\Dir\Reader as DirReader;
13+
use Magento\Framework\View\Design\Fallback\RulePool;
14+
use Magento\Framework\View\Design\FileResolution\Fallback\ResolverInterface;
1215
use Magento\Framework\View\Design\ThemeInterface;
1316
use Magento\Framework\View\DesignInterface;
14-
use Magento\Framework\App\Filesystem\DirectoryList;
15-
use Magento\Framework\View\Design\FileResolution\Fallback\ResolverInterface;
16-
use Magento\Framework\View\Design\Fallback\RulePool;
1717

1818
/**
1919
* Class FileResolver
@@ -53,11 +53,17 @@ class FileResolver implements \Magento\Framework\Config\FileResolverInterface, D
5353
*/
5454
protected $resolver;
5555

56+
/**
57+
* @var DirectoryList
58+
* @deprecated Unused class property
59+
*/
60+
private $directoryList;
61+
5662
/**
5763
* @param DirReader $moduleReader
5864
* @param FileIteratorFactory $iteratorFactory
5965
* @param DesignInterface $designInterface
60-
* @param DirectoryList $directoryList
66+
* @param DirectoryList $directoryList @deprecated
6167
* @param Filesystem $filesystem
6268
* @param ResolverInterface $resolver
6369
*/
@@ -105,7 +111,7 @@ public function get($filename, $scope)
105111
);
106112
if (file_exists($designPath)) {
107113
try {
108-
$designDom = new \DOMDocument;
114+
$designDom = new \DOMDocument();
109115
$designDom->load($designPath);
110116
$iterator[$designPath] = $designDom->saveXML();
111117
} catch (\Exception $e) {
@@ -174,7 +180,7 @@ private function getParentConfigs(ThemeInterface $theme, array $iterator, $index
174180
$theme->getParentTheme()
175181
);
176182

177-
$parentDom = new \DOMDocument;
183+
$parentDom = new \DOMDocument();
178184
$parentDom->load($parentDesignPath);
179185

180186
$iterator[$index] = $parentDom->saveXML();

lib/internal/Magento/Framework/DB/Query/BatchRangeIterator.php

+7-1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ class BatchRangeIterator implements BatchIteratorInterface
3333
*/
3434
private $rangeField;
3535

36+
/**
37+
* @var string
38+
* @deprecated unused class property
39+
*/
40+
private $rangeFieldAlias;
41+
3642
/**
3743
* @var int
3844
*/
@@ -80,7 +86,7 @@ class BatchRangeIterator implements BatchIteratorInterface
8086
* @param int $batchSize
8187
* @param string $correlationName
8288
* @param string|array $rangeField
83-
* @param string $rangeFieldAlias
89+
* @param string $rangeFieldAlias @deprecated
8490
*/
8591
public function __construct(
8692
Select $select,

lib/internal/Magento/Framework/DB/Test/Unit/Select/ColumnsRendererTest.php

+5
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ class ColumnsRendererTest extends \PHPUnit\Framework\TestCase
2828
*/
2929
protected $selectMock;
3030

31+
/**
32+
* @var \Zend_Db_Expr
33+
*/
34+
protected $sqlWildcard;
35+
3136
/**
3237
* Set up
3338
*

lib/internal/Magento/Framework/DB/Tree/NodeSet.php

+8-3
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,22 @@ class NodeSet implements \Iterator
1414
/**
1515
* @var Node[]
1616
*/
17-
private $_nodes = [];
17+
private $_nodes;
1818

1919
/**
2020
* @var int
2121
*/
22-
private $_currentNode = 0;
22+
private $_current;
2323

2424
/**
2525
* @var int
2626
*/
27-
private $_current = 0;
27+
private $_currentNode;
28+
29+
/**
30+
* @var int
31+
*/
32+
private $count;
2833

2934
/**
3035
* Constructor

lib/internal/Magento/Framework/DataObject/Cache.php

-10
Original file line numberDiff line numberDiff line change
@@ -463,14 +463,4 @@ public function getAllReferences()
463463
{
464464
return $this->_references;
465465
}
466-
467-
/**
468-
* Get all references by object
469-
*
470-
* @return array
471-
*/
472-
public function getAllReferencesByObject()
473-
{
474-
return $this->_referencesByObject;
475-
}
476466
}

lib/internal/Magento/Framework/Encryption/Encryptor.php

+5
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,11 @@ class Encryptor implements EncryptorInterface
102102
*/
103103
protected $keys = [];
104104

105+
/**
106+
* @var Random
107+
*/
108+
private $random;
109+
105110
/**
106111
* @param Random $random
107112
* @param DeploymentConfig $deploymentConfig

lib/internal/Magento/Framework/Filesystem/Io/File.php

+5-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@
55
*/
66
namespace Magento\Framework\Filesystem\Io;
77

8-
use Magento\Framework\Filesystem\DriverInterface;
9-
use Symfony\Component\Finder\Tests\Iterator\DateRangeFilterIteratorTest;
10-
118
/**
129
* Filesystem client
1310
* @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
@@ -79,6 +76,11 @@ class File extends AbstractIo
7976
*/
8077
protected $_streamLocked = false;
8178

79+
/**
80+
* @var \Exception
81+
*/
82+
private $_streamException;
83+
8284
/**
8385
* Destruct
8486
*

lib/internal/Magento/Framework/Filesystem/Test/Unit/Directory/WriteTest.php

+1
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ private function getAbsolutePath($path)
165165
public function testRenameFile($sourcePath, $targetPath, $targetDir)
166166
{
167167
if ($targetDir !== null) {
168+
/** @noinspection PhpUndefinedFieldInspection */
168169
$targetDir->driver = $this->getMockBuilder(DriverInterface::class)->getMockForAbstractClass();
169170
$targetDirPath = 'TARGET_PATH/';
170171
$targetDir->expects($this->once())

lib/internal/Magento/Framework/Image.php

+1
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ public function instruction()
261261
*/
262262
public function setImageBackgroundColor($color)
263263
{
264+
/** @noinspection PhpUndefinedFieldInspection */
264265
$this->_adapter->imageBackgroundColor = intval($color);
265266
}
266267

lib/internal/Magento/Framework/Locale/Resolver.php

+5
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ class Resolver implements ResolverInterface
4747
*/
4848
protected $emulatedLocales = [];
4949

50+
/**
51+
* @var string
52+
*/
53+
private $defaultLocalePath;
54+
5055
/**
5156
* @param ScopeConfigInterface $scopeConfig
5257
* @param string $defaultLocalePath

lib/internal/Magento/Framework/Module/Test/Unit/DbVersionInfoTest.php

+6-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66
namespace Magento\Framework\Module\Test\Unit;
77

8-
use \Magento\Framework\Module\DbVersionInfo;
8+
use Magento\Framework\Module\DbVersionInfo;
99

1010
class DbVersionInfoTest extends \PHPUnit\Framework\TestCase
1111
{
@@ -24,6 +24,11 @@ class DbVersionInfoTest extends \PHPUnit\Framework\TestCase
2424
*/
2525
private $moduleResource;
2626

27+
/**
28+
* @var \Magento\Framework\Module\Output\ConfigInterface|\PHPUnit_Framework_MockObject_MockObject
29+
*/
30+
private $_outputConfig;
31+
2732
protected function setUp()
2833
{
2934
$this->moduleList = $this->getMockForAbstractClass(\Magento\Framework\Module\ModuleListInterface::class);

lib/internal/Magento/Framework/Module/Test/Unit/PackageInfoTest.php

+6-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
*/
66
namespace Magento\Framework\Module\Test\Unit;
77

8-
use Magento\Framework\Module\ModuleList;
9-
use \Magento\Framework\Module\PackageInfo;
8+
use Magento\Framework\Module\PackageInfo;
109

1110
class PackageInfoTest extends \PHPUnit\Framework\TestCase
1211
{
@@ -25,6 +24,11 @@ class PackageInfoTest extends \PHPUnit\Framework\TestCase
2524
*/
2625
private $packageInfo;
2726

27+
/**
28+
* @var \Magento\Framework\Serialize\Serializer\Json|\PHPUnit_Framework_MockObject_MockObject
29+
*/
30+
private $serializerMock;
31+
2832
protected function setUp()
2933
{
3034
$this->componentRegistrar = $this->createMock(\Magento\Framework\Component\ComponentRegistrar::class);

lib/internal/Magento/Framework/ObjectManager/Definition/Runtime.php

+5
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ class Runtime implements \Magento\Framework\ObjectManager\DefinitionInterface
1414
*/
1515
protected $_definitions = [];
1616

17+
/**
18+
* @var \Magento\Framework\Code\Reader\ClassReaderInterface
19+
*/
20+
private $_reader;
21+
1722
/**
1823
* @param \Magento\Framework\Code\Reader\ClassReaderInterface $reader
1924
*/

lib/internal/Magento/Framework/ObjectManager/Test/Unit/ObjectManagerTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ public function testConfiguredArgumentsAreInherited()
358358
]
359359
);
360360

361-
/** @var $result \Magento\Test\Di\Aggregate\AggregateParent */
361+
/** @var $result \Magento\Test\Di\Aggregate\Child */
362362
$result = $this->_object->create(\Magento\Test\Di\Aggregate\Child::class);
363363
$this->assertInstanceOf(\Magento\Test\Di\DiParent::class, $result->interface);
364364
$this->assertEquals('first_param_value', $result->scalar);
@@ -388,7 +388,7 @@ public function testConfiguredArgumentsOverrideInheritedArguments()
388388
]
389389
);
390390

391-
/** @var $result \Magento\Test\Di\Aggregate\AggregateParent */
391+
/** @var $result \Magento\Test\Di\Aggregate\Child */
392392
$result = $this->_object->create(\Magento\Test\Di\Aggregate\Child::class);
393393
$this->assertInstanceOf(\Magento\Test\Di\Child::class, $result->interface);
394394
$this->assertEquals('second_param_value', $result->scalar);

lib/internal/Magento/Framework/Session/SaveHandler/Redis/Config.php

+6-1
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
namespace Magento\Framework\Session\SaveHandler\Redis;
77

88
use Magento\Framework\App\Config\ScopeConfigInterface;
9-
use Magento\Store\Model\ScopeInterface as StoreScopeInterface;
109
use Magento\Framework\App\DeploymentConfig;
1110
use Magento\Framework\App\State;
11+
use Magento\Store\Model\ScopeInterface as StoreScopeInterface;
1212

1313
/**
1414
* Redis session save handler
@@ -127,6 +127,11 @@ class Config implements \Cm\RedisSession\Handler\ConfigInterface
127127
*/
128128
private $scopeConfig;
129129

130+
/**
131+
* @var State
132+
*/
133+
private $appState;
134+
130135
/**
131136
* @param DeploymentConfig $deploymentConfig
132137
* @param State $appState

lib/internal/Magento/Framework/Test/Unit/DataObjectTest.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public function testGetData()
110110
'key1' => 'value1',
111111
'key2' => [
112112
'subkey2.1' => 'value2.1',
113-
'subkey2.2' => 'multiline'. PHP_EOL .'string',
113+
'subkey2.2' => 'multiline' . PHP_EOL . 'string',
114114
'subkey2.3' => new \Magento\Framework\DataObject(['test_key' => 'test_value']),
115115
],
116116
'key3' => 5,
@@ -305,10 +305,14 @@ public function testCall()
305305
*/
306306
public function testGetSet()
307307
{
308+
/** @noinspection PhpUndefinedFieldInspection */
308309
$this->dataObject->test = 'test';
310+
/** @noinspection PhpUndefinedFieldInspection */
309311
$this->assertEquals('test', $this->dataObject->test);
310312

313+
/** @noinspection PhpUndefinedFieldInspection */
311314
$this->dataObject->testTest = 'test';
315+
/** @noinspection PhpUndefinedFieldInspection */
312316
$this->assertEquals('test', $this->dataObject->testTest);
313317
}
314318

0 commit comments

Comments
 (0)