Skip to content

Remove "Undefined fields" from under lib folder #11662

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

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public function testConstructor($className)
$frontendMock = $this->createMock(\Magento\Framework\Cache\FrontendInterface::class);

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

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

// Test that frontend is now engaged in operations
Expand Down
21 changes: 15 additions & 6 deletions lib/internal/Magento/Framework/App/Test/Unit/Response/HttpTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

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

use \Magento\Framework\App\Response\Http;
use Magento\Framework\App\Response\Http;
use Magento\Framework\ObjectManagerInterface;

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

/**
* @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Stdlib\CookieManagerInterface
* @var \Magento\Framework\Stdlib\CookieManagerInterface|\PHPUnit_Framework_MockObject_MockObject
*/
protected $cookieManagerMock;

/**
* @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Stdlib\Cookie\CookieMetadataFactory
* @var \Magento\Framework\Stdlib\Cookie\CookieMetadataFactory|\PHPUnit_Framework_MockObject_MockObject
*/
protected $cookieMetadataFactoryMock;

/**
* @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\App\Http\Context
* @var \Magento\Framework\App\Http\Context|\PHPUnit_Framework_MockObject_MockObject
*/
protected $contextMock;

/** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\App\Http\Context */
/**
* @var \Magento\Framework\App\Http\Context|\PHPUnit_Framework_MockObject_MockObject
*/
protected $dateTimeMock;

/** @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager */
/**
* @var \Magento\Framework\App\Request\Http|\PHPUnit_Framework_MockObject_MockObject
*/
protected $requestMock;

/**
* @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager
*/
protected $objectManager;

protected function setUp()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,20 @@ class FilesystemTest extends \PHPUnit\Framework\TestCase
private $objectManager;

/**
* @var \Magento\Framework\Backup\Filesystem\Rollback\Fs
* @var \Magento\Framework\Backup\Filesystem\Rollback\Fs|\PHPUnit_Framework_MockObject_MockObject
*/
private $fsMock;

/**
* @var \Magento\Framework\Backup\Filesystem\Rollback\Ftp
* @var \Magento\Framework\Backup\Filesystem\Rollback\Ftp|\PHPUnit_Framework_MockObject_MockObject
*/
private $ftpMock;

/**
* @var \Magento\Framework\Backup\Filesystem|\PHPUnit_Framework_MockObject_MockObject
*/
private $snapshotMock;

/**
* @var \Magento\Framework\Backup\Filesystem
*/
Expand Down
17 changes: 11 additions & 6 deletions lib/internal/Magento/Framework/Config/FileResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
*/
namespace Magento\Framework\Config;

use Magento\Framework\Module\Dir\Reader as DirReader;
use Magento\Framework\App\Filesystem\DirectoryList;
use Magento\Framework\Filesystem;
use Magento\Framework\Module\Dir\Reader as DirReader;
use Magento\Framework\View\Design\Fallback\RulePool;
use Magento\Framework\View\Design\FileResolution\Fallback\ResolverInterface;
use Magento\Framework\View\Design\ThemeInterface;
use Magento\Framework\View\DesignInterface;
use Magento\Framework\App\Filesystem\DirectoryList;
use Magento\Framework\View\Design\FileResolution\Fallback\ResolverInterface;
use Magento\Framework\View\Design\Fallback\RulePool;

/**
* Class FileResolver
Expand Down Expand Up @@ -53,6 +53,11 @@ class FileResolver implements \Magento\Framework\Config\FileResolverInterface, D
*/
protected $resolver;

/**
* @var DirectoryList
*/
protected $directoryList;

/**
* @param DirReader $moduleReader
* @param FileIteratorFactory $iteratorFactory
Expand Down Expand Up @@ -105,7 +110,7 @@ public function get($filename, $scope)
);
if (file_exists($designPath)) {
try {
$designDom = new \DOMDocument;
$designDom = new \DOMDocument();
$designDom->load($designPath);
$iterator[$designPath] = $designDom->saveXML();
} catch (\Exception $e) {
Expand Down Expand Up @@ -174,7 +179,7 @@ private function getParentConfigs(ThemeInterface $theme, array $iterator, $index
$theme->getParentTheme()
);

$parentDom = new \DOMDocument;
$parentDom = new \DOMDocument();
$parentDom->load($parentDesignPath);

$iterator[$index] = $parentDom->saveXML();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ class BatchRangeIterator implements BatchIteratorInterface
*/
private $rangeField;

/**
* @var string
*/
private $rangeFieldAlias;

/**
* @var int
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ class ColumnsRendererTest extends \PHPUnit\Framework\TestCase
*/
protected $selectMock;

/**
* @var \Zend_Db_Expr
*/
protected $sqlWildcard;

/**
* Set up
*
Expand Down
11 changes: 8 additions & 3 deletions lib/internal/Magento/Framework/DB/Tree/NodeSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,22 @@ class NodeSet implements \Iterator
/**
* @var Node[]
*/
private $_nodes = [];
private $_nodes;

/**
* @var int
*/
private $_currentNode = 0;
private $_current;

/**
* @var int
*/
private $_current = 0;
private $_currentNode;

/**
* @var int
*/
private $count;

/**
* Constructor
Expand Down
10 changes: 0 additions & 10 deletions lib/internal/Magento/Framework/DataObject/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -463,14 +463,4 @@ public function getAllReferences()
{
return $this->_references;
}

/**
* Get all references by object
*
* @return array
*/
public function getAllReferencesByObject()
{
return $this->_referencesByObject;
}
}
5 changes: 5 additions & 0 deletions lib/internal/Magento/Framework/Encryption/Encryptor.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ class Encryptor implements EncryptorInterface
*/
protected $keys = [];

/**
* @var Random
*/
protected $random;

/**
* @param Random $random
* @param DeploymentConfig $deploymentConfig
Expand Down
8 changes: 5 additions & 3 deletions lib/internal/Magento/Framework/Filesystem/Io/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
*/
namespace Magento\Framework\Filesystem\Io;

use Magento\Framework\Filesystem\DriverInterface;
use Symfony\Component\Finder\Tests\Iterator\DateRangeFilterIteratorTest;

/**
* Filesystem client
* @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
Expand Down Expand Up @@ -79,6 +76,11 @@ class File extends AbstractIo
*/
protected $_streamLocked = false;

/**
* @var \Exception
*/
protected $_streamException;

/**
* Destruct
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ private function getAbsolutePath($path)
public function testRenameFile($sourcePath, $targetPath, $targetDir)
{
if ($targetDir !== null) {
/** @noinspection PhpUndefinedFieldInspection */
$targetDir->driver = $this->getMockBuilder(DriverInterface::class)->getMockForAbstractClass();
$targetDirPath = 'TARGET_PATH/';
$targetDir->expects($this->once())
Expand Down
1 change: 1 addition & 0 deletions lib/internal/Magento/Framework/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ public function instruction()
*/
public function setImageBackgroundColor($color)
{
/** @noinspection PhpUndefinedFieldInspection */
$this->_adapter->imageBackgroundColor = intval($color);
}

Expand Down
5 changes: 5 additions & 0 deletions lib/internal/Magento/Framework/Locale/Resolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ class Resolver implements ResolverInterface
*/
protected $emulatedLocales = [];

/**
* @var string
*/
protected $defaultLocalePath;

/**
* @param ScopeConfigInterface $scopeConfig
* @param string $defaultLocalePath
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
namespace Magento\Framework\Module\Test\Unit;

use \Magento\Framework\Module\DbVersionInfo;
use Magento\Framework\Module\DbVersionInfo;

class DbVersionInfoTest extends \PHPUnit\Framework\TestCase
{
Expand All @@ -24,6 +24,11 @@ class DbVersionInfoTest extends \PHPUnit\Framework\TestCase
*/
private $moduleResource;

/**
* @var \Magento\Framework\Module\Output\ConfigInterface|\PHPUnit_Framework_MockObject_MockObject
*/
private $_outputConfig;

protected function setUp()
{
$this->moduleList = $this->getMockForAbstractClass(\Magento\Framework\Module\ModuleListInterface::class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
*/
namespace Magento\Framework\Module\Test\Unit;

use Magento\Framework\Module\ModuleList;
use \Magento\Framework\Module\PackageInfo;
use Magento\Framework\Module\PackageInfo;

class PackageInfoTest extends \PHPUnit\Framework\TestCase
{
Expand All @@ -25,6 +24,11 @@ class PackageInfoTest extends \PHPUnit\Framework\TestCase
*/
private $packageInfo;

/**
* @var \Magento\Framework\Serialize\Serializer\Json|\PHPUnit_Framework_MockObject_MockObject
*/
private $serializerMock;

protected function setUp()
{
$this->componentRegistrar = $this->createMock(\Magento\Framework\Component\ComponentRegistrar::class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ class Runtime implements \Magento\Framework\ObjectManager\DefinitionInterface
*/
protected $_definitions = [];

/**
* @var \Magento\Framework\Code\Reader\ClassReaderInterface
*/
protected $_reader;

/**
* @param \Magento\Framework\Code\Reader\ClassReaderInterface $reader
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ public function testConfiguredArgumentsAreInherited()
]
);

/** @var $result \Magento\Test\Di\Aggregate\AggregateParent */
/** @var $result \Magento\Test\Di\Aggregate\Child */
$result = $this->_object->create(\Magento\Test\Di\Aggregate\Child::class);
$this->assertInstanceOf(\Magento\Test\Di\DiParent::class, $result->interface);
$this->assertEquals('first_param_value', $result->scalar);
Expand Down Expand Up @@ -388,7 +388,7 @@ public function testConfiguredArgumentsOverrideInheritedArguments()
]
);

/** @var $result \Magento\Test\Di\Aggregate\AggregateParent */
/** @var $result \Magento\Test\Di\Aggregate\Child */
$result = $this->_object->create(\Magento\Test\Di\Aggregate\Child::class);
$this->assertInstanceOf(\Magento\Test\Di\Child::class, $result->interface);
$this->assertEquals('second_param_value', $result->scalar);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
namespace Magento\Framework\Session\SaveHandler\Redis;

use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Store\Model\ScopeInterface as StoreScopeInterface;
use Magento\Framework\App\DeploymentConfig;
use Magento\Framework\App\State;
use Magento\Store\Model\ScopeInterface as StoreScopeInterface;

/**
* Redis session save handler
Expand Down Expand Up @@ -127,6 +127,11 @@ class Config implements \Cm\RedisSession\Handler\ConfigInterface
*/
private $scopeConfig;

/**
* @var State
*/
private $appState;

/**
* @param DeploymentConfig $deploymentConfig
* @param State $appState
Expand Down
6 changes: 5 additions & 1 deletion lib/internal/Magento/Framework/Test/Unit/DataObjectTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public function testGetData()
'key1' => 'value1',
'key2' => [
'subkey2.1' => 'value2.1',
'subkey2.2' => 'multiline'. PHP_EOL .'string',
'subkey2.2' => 'multiline' . PHP_EOL . 'string',
'subkey2.3' => new \Magento\Framework\DataObject(['test_key' => 'test_value']),
],
'key3' => 5,
Expand Down Expand Up @@ -305,10 +305,14 @@ public function testCall()
*/
public function testGetSet()
{
/** @noinspection PhpUndefinedFieldInspection */
$this->dataObject->test = 'test';
/** @noinspection PhpUndefinedFieldInspection */
$this->assertEquals('test', $this->dataObject->test);

/** @noinspection PhpUndefinedFieldInspection */
$this->dataObject->testTest = 'test';
/** @noinspection PhpUndefinedFieldInspection */
$this->assertEquals('test', $this->dataObject->testTest);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,17 @@ class MethodInvokedAtIndex extends \PHPUnit_Framework_MockObject_Matcher_Invoked
*/
public function matches(\PHPUnit_Framework_MockObject_Invocation $invocation)
{
/** @noinspection PhpUndefinedFieldInspection */
if (!isset($this->indexes[$invocation->methodName])) {
/** @noinspection PhpUndefinedFieldInspection */
$this->indexes[$invocation->methodName] = 0;
} else {
/** @noinspection PhpUndefinedFieldInspection */
$this->indexes[$invocation->methodName]++;
}
$this->currentIndex++;

/** @noinspection PhpUndefinedFieldInspection */
return $this->indexes[$invocation->methodName] == $this->sequenceIndex;
}
}
Loading