diff --git a/app/code/Magento/Customer/Test/Unit/Model/AccountManagementTest.php b/app/code/Magento/Customer/Test/Unit/Model/AccountManagementTest.php index da270233577e4..6f164266ae79b 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/AccountManagementTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/AccountManagementTest.php @@ -1850,7 +1850,7 @@ private function reInitModel(): void ->getMockForAbstractClass(); $dateTime = '2017-10-25 18:57:08'; - $timestamp = '1508983028'; + $timestamp = 1508983028; $dateTimeMock = $this->getMockBuilder(\DateTime::class) ->disableOriginalConstructor() ->onlyMethods(['format', 'getTimestamp', 'setTimestamp']) @@ -2363,7 +2363,7 @@ public function testCreateAccountWithPasswordHashWithCustomerAddresses(): void private function prepareDateTimeFactory(): string { $dateTime = '2017-10-25 18:57:08'; - $timestamp = '1508983028'; + $timestamp = 1508983028; $dateTimeMock = $this->createMock(\DateTime::class); $dateTimeMock->expects($this->any()) ->method('format') diff --git a/lib/internal/Magento/Framework/App/Console/Request.php b/lib/internal/Magento/Framework/App/Console/Request.php index ceb8ccca87968..28682ff8f701c 100644 --- a/lib/internal/Magento/Framework/App/Console/Request.php +++ b/lib/internal/Magento/Framework/App/Console/Request.php @@ -1,7 +1,5 @@ setParams($data); @@ -35,6 +33,7 @@ public function __construct(array $parameters = []) */ public function getModuleName() { + // phpcs:ignore Squiz.PHP.NonExecutableCode.ReturnNotRequired return; } @@ -42,10 +41,11 @@ public function getModuleName() * Set Module name * * @param string $name + * * @return void * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function setModuleName($name) + public function setModuleName($name) // phpcs:ignore Magento2.CodeAnalysis.EmptyBlock { } @@ -56,6 +56,7 @@ public function setModuleName($name) */ public function getActionName() { + // phpcs:ignore Squiz.PHP.NonExecutableCode.ReturnNotRequired return; } @@ -66,7 +67,7 @@ public function getActionName() * @return void * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function setActionName($name) + public function setActionName($name) // phpcs:ignore Magento2.CodeAnalysis.EmptyBlock { } @@ -112,10 +113,11 @@ public function setParams(array $data) * * @param null|string $name * @param null|string $default + * * @return null|string|void * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function getCookie($name, $default) + public function getCookie($name, $default) // phpcs:ignore Magento2.CodeAnalysis.EmptyBlock { } diff --git a/lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfig/WriterTest.php b/lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfig/WriterTest.php index 7bd6c25d88b94..f449f74751e45 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfig/WriterTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfig/WriterTest.php @@ -175,7 +175,8 @@ public function testSaveConfig() ->method('getFiles') ->willReturn('test.php'); $this->dirRead->expects($this->any()) - ->method('getAbsolutePath'); + ->method('getAbsolutePath') + ->willReturn(''); $this->filesystem->expects($this->any()) ->method('getDirectoryWrite') ->with(DirectoryList::CONFIG) @@ -231,7 +232,8 @@ public function testSaveConfigOverride() ->method('getFiles') ->willReturn('test.php'); $this->dirRead->expects($this->any()) - ->method('getAbsolutePath'); + ->method('getAbsolutePath') + ->willReturn(''); $this->filesystem->expects($this->any()) ->method('getDirectoryWrite') ->with(DirectoryList::CONFIG) diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Request/HttpTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Request/HttpTest.php index a9c95a804568c..6e759f8fbe13c 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/Request/HttpTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/Request/HttpTest.php @@ -142,7 +142,7 @@ public function testGetBasePathWithPath() public function testGetBasePathWithoutPath() { $this->model = $this->getModel(); - $this->model->setBasePath(null); + $this->model->setBasePath(''); $this->assertEquals('/', $this->model->getBasePath()); } diff --git a/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php b/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php index 66e6bb26293e2..cd1522c90925e 100644 --- a/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php +++ b/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php @@ -814,7 +814,7 @@ protected function _splitMultiQuery($sql) $parts = preg_split( '#(;|\'|"|\\\\|//|--|\n|/\*|\*/)#', $sql, - null, + -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE ); @@ -3625,6 +3625,7 @@ public function selectsByRange($rangeField, \Magento\Framework\DB\Select $select private function getQueryGenerator() { if ($this->queryGenerator === null) { + // phpcs:ignore Magento2.PHP.AutogeneratedClassNotInConstructor $this->queryGenerator = \Magento\Framework\App\ObjectManager::getInstance()->create(QueryGenerator::class); } return $this->queryGenerator; @@ -4097,6 +4098,7 @@ public function getAutoIncrementField($tableName, $schemaName = null) public function getSchemaListener() { if ($this->schemaListener === null) { + // phpcs:ignore Magento2.PHP.AutogeneratedClassNotInConstructor $this->schemaListener = \Magento\Framework\App\ObjectManager::getInstance()->create(SchemaListener::class); } return $this->schemaListener; diff --git a/lib/internal/Magento/Framework/DB/Test/Unit/DB/Statement/MysqlTest.php b/lib/internal/Magento/Framework/DB/Test/Unit/DB/Statement/MysqlTest.php index d820ea5cbd92f..ee95e1fc8e9ec 100644 --- a/lib/internal/Magento/Framework/DB/Test/Unit/DB/Statement/MysqlTest.php +++ b/lib/internal/Magento/Framework/DB/Test/Unit/DB/Statement/MysqlTest.php @@ -87,7 +87,7 @@ public function testExecuteWhenThrowPDOException() $this->pdoStatementMock->expects($this->once()) ->method('execute') ->willThrowException(new \PDOException('test message')); - + $this->setQueryStringForPdoStmtMock($query); $this->assertEquals($errorReporting, error_reporting(), 'Error report level was\'t restored'); (new Mysql($this->adapterMock, $query))->_execute(); @@ -152,4 +152,23 @@ public function testExecuteWhenParamsAsParameterObject() (new Mysql($this->adapterMock, $query))->_execute($params); } + + /** + * Initialize queryString property. + * + * @param string $query + * + * @return void + */ + private function setQueryStringForPdoStmtMock(string $query): void + { + /* + * In PHP 8.1 $queryString is a Typed property, thus it should be initialized before the 1st call. + * But it's not automatically initialized in case of Mocking, so we do it here. + * Note: In PHP < 8.1 such assignment prohibited. + */ + if (PHP_VERSION_ID >= 80100) { + $this->pdoStatementMock->queryString = $query; + } + } } diff --git a/lib/internal/Magento/Framework/DataObject.php b/lib/internal/Magento/Framework/DataObject.php index 11452c49fa162..bb224b8888e9d 100644 --- a/lib/internal/Magento/Framework/DataObject.php +++ b/lib/internal/Magento/Framework/DataObject.php @@ -373,9 +373,9 @@ public function toString($format = '') /** * Set/Get attribute wrapper * - * @param string $method - * @param array $args - * @return mixed + * @param string $method + * @param array $args + * @return mixed * @throws \Magento\Framework\Exception\LocalizedException */ public function __call($method, $args) @@ -464,7 +464,7 @@ public function serialize($keys = [], $valueSeparator = '=', $fieldSeparator = ' * Present object data as string in debug mode * * @param mixed $data - * @param array &$objects + * @param array $objects * @return array */ public function debug($data = null, &$objects = []) diff --git a/lib/internal/Magento/Framework/Event/Observer/Cron.php b/lib/internal/Magento/Framework/Event/Observer/Cron.php index ebff693595fcd..af191984b3f74 100644 --- a/lib/internal/Magento/Framework/Event/Observer/Cron.php +++ b/lib/internal/Magento/Framework/Event/Observer/Cron.php @@ -27,7 +27,7 @@ class Cron extends \Magento\Framework\Event\Observer */ public function isValidFor(\Magento\Framework\Event $event) { - $e = preg_split('#\s+#', $this->getCronExpr(), null, PREG_SPLIT_NO_EMPTY); + $e = preg_split('#\s+#', $this->getCronExpr(), -1, PREG_SPLIT_NO_EMPTY); if (count($e) !== 5) { return false; } diff --git a/lib/internal/Magento/Framework/Filter/SplitWords.php b/lib/internal/Magento/Framework/Filter/SplitWords.php index b217cd058f060..01a7824b6bf43 100644 --- a/lib/internal/Magento/Framework/Filter/SplitWords.php +++ b/lib/internal/Magento/Framework/Filter/SplitWords.php @@ -5,9 +5,6 @@ */ namespace Magento\Framework\Filter; -/** - * Split words - */ class SplitWords implements \Zend_Filter_Interface { /** @@ -46,7 +43,7 @@ public function __construct($uniqueOnly = true, $wordsQty = 0, $wordSeparatorReg public function filter($str) { $result = []; - $split = preg_split('#' . $this->wordSeparatorRegexp . '#siu', $str, null, PREG_SPLIT_NO_EMPTY); + $split = preg_split('#' . $this->wordSeparatorRegexp . '#siu', $str, -1, PREG_SPLIT_NO_EMPTY); foreach ($split as $word) { if ($this->uniqueOnly) { $result[$word] = $word; diff --git a/lib/internal/Magento/Framework/Model/ResourceModel/Db/Collection/AbstractCollection.php b/lib/internal/Magento/Framework/Model/ResourceModel/Db/Collection/AbstractCollection.php index b63291394e1d1..4b8c651dfaa1c 100644 --- a/lib/internal/Magento/Framework/Model/ResourceModel/Db/Collection/AbstractCollection.php +++ b/lib/internal/Magento/Framework/Model/ResourceModel/Db/Collection/AbstractCollection.php @@ -6,8 +6,10 @@ namespace Magento\Framework\Model\ResourceModel\Db\Collection; -use \Magento\Framework\App\ResourceConnection\SourceProviderInterface; -use \Magento\Framework\Data\Collection\AbstractDb; +use Magento\Framework\App\ObjectManager; +use Magento\Framework\App\ResourceConnection\SourceProviderInterface; +use Magento\Framework\Data\Collection\AbstractDb; +use Magento\Framework\Event\ManagerInterface; /** * Abstract Resource Collection @@ -106,7 +108,7 @@ abstract class AbstractCollection extends AbstractDb implements SourceProviderIn /** * Event manager proxy * - * @var \Magento\Framework\Event\ManagerInterface + * @var ManagerInterface */ protected $_eventManager = null; @@ -114,7 +116,7 @@ abstract class AbstractCollection extends AbstractDb implements SourceProviderIn * @param \Magento\Framework\Data\Collection\EntityFactoryInterface $entityFactory * @param \Psr\Log\LoggerInterface $logger * @param \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy - * @param \Magento\Framework\Event\ManagerInterface $eventManager + * @param ManagerInterface $eventManager * @param \Magento\Framework\DB\Adapter\AdapterInterface $connection * @param \Magento\Framework\Model\ResourceModel\Db\AbstractDb $resource */ @@ -122,7 +124,7 @@ public function __construct( \Magento\Framework\Data\Collection\EntityFactoryInterface $entityFactory, \Psr\Log\LoggerInterface $logger, \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, - \Magento\Framework\Event\ManagerInterface $eventManager, + ManagerInterface $eventManager, \Magento\Framework\DB\Adapter\AdapterInterface $connection = null, \Magento\Framework\Model\ResourceModel\Db\AbstractDb $resource = null ) { @@ -241,12 +243,7 @@ protected function _initSelectFields() $column = $field; } - if ($alias !== null && - in_array($alias, $columnsToSelect) || - // If field already joined from another table - $alias === null && - isset($alias, $columnsToSelect) - ) { + if ($alias !== null && in_array($alias, $columnsToSelect)) { continue; } @@ -468,9 +465,8 @@ public function getResourceModelName() public function getResource() { if (empty($this->_resource)) { - $this->_resource = \Magento\Framework\App\ObjectManager::getInstance()->create( - $this->getResourceModelName() - ); + // phpcs:ignore Magento2.PHP.AutogeneratedClassNotInConstructor + $this->_resource = ObjectManager::getInstance()->create($this->getResourceModelName()); } return $this->_resource; } @@ -513,14 +509,13 @@ public function getAllIds() */ public function join($table, $cond, $cols = '*') { + $alias = $table; if (is_array($table)) { foreach ($table as $k => $v) { $alias = $k; $table = $v; break; } - } else { - $alias = $table; } if (!isset($this->_joinedTables[$alias])) { @@ -624,7 +619,7 @@ public function __sleep() public function __wakeup() { parent::__wakeup(); - $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); - $this->_eventManager = $objectManager->get(\Magento\Framework\Event\ManagerInterface::class); + // phpcs:ignore Magento2.PHP.AutogeneratedClassNotInConstructor + $this->_eventManager = ObjectManager::getInstance()->get(ManagerInterface::class); } } diff --git a/lib/internal/Magento/Framework/ObjectManager/TMap.php b/lib/internal/Magento/Framework/ObjectManager/TMap.php index 49b33546998f4..e64d80c307149 100644 --- a/lib/internal/Magento/Framework/ObjectManager/TMap.php +++ b/lib/internal/Magento/Framework/ObjectManager/TMap.php @@ -8,7 +8,6 @@ use Magento\Framework\ObjectManagerInterface; /** - * Class TMap * @internal */ class TMap implements \IteratorAggregate, \Countable, \ArrayAccess @@ -62,7 +61,7 @@ public function __construct( array $array = [], \Closure $objectCreationStrategy = null ) { - if (!class_exists($this->type) && !interface_exists($type)) { + if ((empty($this->type) || !class_exists($this->type)) && !interface_exists($type)) { throw new \InvalidArgumentException(sprintf('Unknown type %s', $type)); } @@ -142,7 +141,7 @@ private function initObject($index) } /** - * {inheritdoc} + * @inheritdoc */ public function getIterator() { @@ -156,7 +155,7 @@ public function getIterator() } /** - * {inheritdoc} + * @inheritdoc */ public function offsetExists($offset) { @@ -164,7 +163,7 @@ public function offsetExists($offset) } /** - * {inheritdoc} + * @inheritdoc */ public function offsetGet($offset) { @@ -172,7 +171,7 @@ public function offsetGet($offset) } /** - * {inheritdoc} + * @inheritdoc */ public function offsetSet($offset, $value) { @@ -187,7 +186,7 @@ public function offsetSet($offset, $value) } /** - * {inheritdoc} + * @inheritdoc */ public function offsetUnset($offset) { @@ -202,7 +201,7 @@ public function offsetUnset($offset) } /** - * {inheritdoc} + * @inheritdoc */ public function count() { diff --git a/lib/internal/Magento/Framework/Pricing/Price/AbstractPrice.php b/lib/internal/Magento/Framework/Pricing/Price/AbstractPrice.php index 89470cf24cbb6..38bf7f8412baf 100644 --- a/lib/internal/Magento/Framework/Pricing/Price/AbstractPrice.php +++ b/lib/internal/Magento/Framework/Pricing/Price/AbstractPrice.php @@ -15,6 +15,7 @@ * Class AbstractPrice * Should be the base for creating any Price type class * + * phpcs:disable Magento2.Classes.AbstractApi * @api * @since 100.0.2 */ @@ -105,9 +106,12 @@ public function getAmount() } /** + * Calculates custom amount + * * @param float $amount * @param null|bool|string|array $exclude * @param null|array $context + * * @return AmountInterface|bool|float */ public function getCustomAmount($amount = null, $exclude = null, $context = []) @@ -131,6 +135,8 @@ public function getPriceCode() } /** + * Returns product + * * @return SaleableInterface */ public function getProduct() @@ -139,6 +145,8 @@ public function getProduct() } /** + * Returns qty + * * @return float */ public function getQuantity() diff --git a/lib/internal/Magento/Framework/Profiler.php b/lib/internal/Magento/Framework/Profiler.php index 4fafc68a568db..9f91741788f15 100644 --- a/lib/internal/Magento/Framework/Profiler.php +++ b/lib/internal/Magento/Framework/Profiler.php @@ -1,7 +1,5 @@ useIntlFormatObject = (null === $useIntlFormatObject) - ? !defined('HHVM_VERSION') - : $useIntlFormatObject; + $this->useIntlFormatObject = $useIntlFormatObject ?? !\defined('HHVM_VERSION'); + $this->localeResolver = $localeResolver + ?? ObjectManager::getInstance()->get(ResolverInterface::class); } /** - * Get locale resolver - * - * @return \Magento\Framework\Locale\ResolverInterface|mixed - */ - private function getLocaleResolver() - { - if ($this->localeResolver === null) { - $this->localeResolver = \Magento\Framework\App\ObjectManager::getInstance()->get( - \Magento\Framework\Locale\ResolverInterface::class - ); - } - return $this->localeResolver; - } - - /** - * {@inheritdoc} + * @inheritdoc */ public function formatObject($object, $format = null, $locale = null) { - $locale = (null === $locale) ? $this->getLocaleResolver()->getLocale() : $locale; + $locale = $locale ?? $this->localeResolver->getLocale(); if ($this->useIntlFormatObject) { return \IntlDateFormatter::formatObject($object, $format, $locale); } diff --git a/lib/internal/Magento/Framework/Stdlib/DateTime/Timezone.php b/lib/internal/Magento/Framework/Stdlib/DateTime/Timezone.php index 1dfc621b1e1ea..4eb5c4f2e64dd 100644 --- a/lib/internal/Magento/Framework/Stdlib/DateTime/Timezone.php +++ b/lib/internal/Magento/Framework/Stdlib/DateTime/Timezone.php @@ -200,7 +200,7 @@ public function date($date = null, $locale = null, $useTimezone = true, $include break; } - return (new \DateTime(null, new \DateTimeZone($timezone)))->setTimestamp($date); + return (new \DateTime('now', new \DateTimeZone($timezone)))->setTimestamp($date); } /** diff --git a/lib/internal/Magento/Framework/Stdlib/StringUtils.php b/lib/internal/Magento/Framework/Stdlib/StringUtils.php index 3e3072ee58677..2beb90bfb85df 100644 --- a/lib/internal/Magento/Framework/Stdlib/StringUtils.php +++ b/lib/internal/Magento/Framework/Stdlib/StringUtils.php @@ -89,7 +89,7 @@ public function split($value, $length = 1, $keepWords = false, $trim = false, $w } } else { // split smartly, keeping words - $split = preg_split('/(' . $wordSeparatorRegex . '+)/siu', $value, null, PREG_SPLIT_DELIM_CAPTURE); + $split = preg_split('/(' . $wordSeparatorRegex . '+)/siu', $value, -1, PREG_SPLIT_DELIM_CAPTURE); $index = 0; $space = ''; $spaceLen = 0; diff --git a/lib/internal/Magento/Framework/Test/Unit/Data/CollectionTest.php b/lib/internal/Magento/Framework/Test/Unit/Data/CollectionTest.php index fa6b958339184..68f2c6e61bd3b 100644 --- a/lib/internal/Magento/Framework/Test/Unit/Data/CollectionTest.php +++ b/lib/internal/Magento/Framework/Test/Unit/Data/CollectionTest.php @@ -70,7 +70,7 @@ public function testWalkWithAssociativeArrayInParameter() $this->collection->addItem($elementOne); $this->collection->addItem($elementTwo); $this->collection->addItem($elementThree); - $this->collection->walk([$this, 'modifyObjectNames'], ['testPrefix' => 'test prefix']); + $this->collection->walk([$this, 'modifyObjectNames'], ['test prefix']); $expectedNames = [ 'test prefix firstElement', 'test prefix secondElement', diff --git a/lib/internal/Magento/Framework/View/Asset/Bundle.php b/lib/internal/Magento/Framework/View/Asset/Bundle.php index 4775f50bd12a0..21bdd72408776 100644 --- a/lib/internal/Magento/Framework/View/Asset/Bundle.php +++ b/lib/internal/Magento/Framework/View/Asset/Bundle.php @@ -6,9 +6,9 @@ namespace Magento\Framework\View\Asset; +use Magento\Framework\App\Filesystem\DirectoryList; use Magento\Framework\Filesystem; use Magento\Framework\View\Asset\Bundle\Manager; -use Magento\Framework\App\Filesystem\DirectoryList; use Magento\Framework\View\Asset\File\FallbackContext; /** @@ -72,6 +72,8 @@ public function __construct( } /** + * Init asset and add into array + * * @param LocalInterface $asset * @return void */ @@ -98,6 +100,8 @@ protected function add(LocalInterface $asset) } /** + * Initialization + * * @param LocalInterface $asset * @return void */ @@ -112,6 +116,8 @@ protected function init(LocalInterface $asset) } /** + * Returns the asset code based on context + * * @param LocalInterface $asset * @return string */ @@ -123,6 +129,8 @@ protected function getContextCode(LocalInterface $asset) } /** + * Returns a part index for the asset + * * @param LocalInterface $asset * @return int */ @@ -147,7 +155,10 @@ protected function getPartIndex(LocalInterface $asset) } /** + * Returns size of the part + * * @param LocalInterface $asset + * * @return int */ protected function getMaxPartSize(LocalInterface $asset) @@ -228,6 +239,8 @@ protected function getAssetContent(LocalInterface $asset) } /** + * Returns require.config init + * * @return string */ protected function getInitJs() @@ -248,6 +261,8 @@ protected function getInitJs() } /** + * Stores bundle types and flush data + * * @return void */ public function flush() @@ -261,7 +276,10 @@ public function flush() } /** + * Save bundle + * * @param array $types + * * @return void */ protected function save($types) @@ -286,13 +304,16 @@ protected function save($types) } /** + * Set bundle content + * * @param array $parts * @param FallbackContext $context + * * @return void */ protected function fillContent($parts, $context) { - $index = count($this->content) > 0 ? count($this->content) - 1 : 0 ; + $index = count($this->content) > 0 ? count($this->content) - 1 : 0; foreach ($parts as $part) { if (!isset($this->content[$index])) { $this->content[$index] = ''; diff --git a/lib/internal/Magento/Framework/View/Asset/Bundle/Manager.php b/lib/internal/Magento/Framework/View/Asset/Bundle/Manager.php index 490c04004365d..5a9bad7a4afba 100644 --- a/lib/internal/Magento/Framework/View/Asset/Bundle/Manager.php +++ b/lib/internal/Magento/Framework/View/Asset/Bundle/Manager.php @@ -202,6 +202,8 @@ public function addAsset(LocalInterface $asset) } /** + * Check for an asset's minified + * * @param LocalInterface $asset * @return bool */ @@ -229,6 +231,8 @@ protected function isAssetMinification(LocalInterface $asset) } /** + * Validates asset + * * @param LocalInterface $asset * @return bool */ @@ -244,6 +248,8 @@ protected function isValidAsset(LocalInterface $asset) } /** + * Check if asset has valid type. + * * @param LocalInterface $asset * @return bool */ diff --git a/lib/internal/Magento/Framework/View/Element/Template.php b/lib/internal/Magento/Framework/View/Element/Template.php index e9f164ca2fd14..e68d059c07984 100644 --- a/lib/internal/Magento/Framework/View/Element/Template.php +++ b/lib/internal/Magento/Framework/View/Element/Template.php @@ -45,15 +45,11 @@ class Template extends AbstractBlock protected $_viewVars = []; /** - * Base URL - * * @var string */ protected $_baseUrl; /** - * JS URL - * * @var string */ protected $_jsUrl; @@ -80,15 +76,11 @@ class Template extends AbstractBlock protected $_template; /** - * Template engine pool - * * @var \Magento\Framework\View\TemplateEnginePool */ protected $templateEnginePool; /** - * Store manager - * * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -115,8 +107,6 @@ class Template extends AbstractBlock private $mediaDirectory; /** - * Template context - * * @var \Magento\Framework\View\Element\BlockInterface */ protected $templateContext; diff --git a/lib/internal/Magento/Framework/View/Element/UiComponent/Context.php b/lib/internal/Magento/Framework/View/Element/UiComponent/Context.php index 8f980d82d4be0..72fb6dbbc7e37 100644 --- a/lib/internal/Magento/Framework/View/Element/UiComponent/Context.php +++ b/lib/internal/Magento/Framework/View/Element/UiComponent/Context.php @@ -52,8 +52,6 @@ class Context implements ContextInterface protected $contentTypeFactory; /** - * Accept type - * * @var string */ protected $acceptType; @@ -81,8 +79,6 @@ class Context implements ContextInterface protected $componentsDefinitions = []; /** - * Url Builder - * * @var UrlInterface */ protected $urlBuilder; @@ -386,7 +382,7 @@ public function getUrl($route = '', $params = []) * @param UiComponentInterface $component * @return void */ - protected function prepareDataSource(array & $data, UiComponentInterface $component) + protected function prepareDataSource(array &$data, UiComponentInterface $component) { $childComponents = $component->getChildComponents(); if (!empty($childComponents)) { diff --git a/lib/internal/Magento/Framework/View/FileSystem.php b/lib/internal/Magento/Framework/View/FileSystem.php index 687b6adcb0f8e..97be9e3e39693 100644 --- a/lib/internal/Magento/Framework/View/FileSystem.php +++ b/lib/internal/Magento/Framework/View/FileSystem.php @@ -189,10 +189,10 @@ public static function normalizePath($path) } /** - * Get a relative path between $relatedPath and $path paths as if $path was to refer to $relatedPath - * relatively of itself - * * Returns new calculated relative path. + * + * Get a relative path between $relatedPath and $path paths, + * as if $path was to refer to $relatedPath relatively of itself. * Examples: * $path: /some/directory/one/file.ext * $relatedPath: /some/directory/two/another/file.ext diff --git a/lib/internal/Magento/Framework/View/Page/Config.php b/lib/internal/Magento/Framework/View/Page/Config.php index ea71e49615e47..d6a782d9197d8 100644 --- a/lib/internal/Magento/Framework/View/Page/Config.php +++ b/lib/internal/Magento/Framework/View/Page/Config.php @@ -158,6 +158,7 @@ class Config private function getAreaResolver() { if ($this->areaResolver === null) { + // phpcs:ignore Magento2.PHP.AutogeneratedClassNotInConstructor $this->areaResolver = ObjectManager::getInstance() ->get(\Magento\Framework\App\State::class); } @@ -291,7 +292,8 @@ public function setContentType($contentType) public function getContentType() { $this->build(); - if (strtolower($this->metadata[self::META_CONTENT_TYPE]) === 'auto') { + if (!empty($this->metadata[self::META_CONTENT_TYPE]) + && strtolower($this->metadata[self::META_CONTENT_TYPE]) === 'auto') { $this->metadata[self::META_CONTENT_TYPE] = $this->getMediaType() . '; charset=' . $this->getCharset(); } return $this->metadata[self::META_CONTENT_TYPE]; diff --git a/setup/src/Magento/Setup/Test/Unit/Fixtures/Quote/QuoteGeneratorTest.php b/setup/src/Magento/Setup/Test/Unit/Fixtures/Quote/QuoteGeneratorTest.php index a88988ce3b337..fc06f9038c7bd 100644 --- a/setup/src/Magento/Setup/Test/Unit/Fixtures/Quote/QuoteGeneratorTest.php +++ b/setup/src/Magento/Setup/Test/Unit/Fixtures/Quote/QuoteGeneratorTest.php @@ -119,8 +119,11 @@ protected function setUp(): void ->setMethods( [ 'getSimpleCountTo', + 'getSimpleCountFrom', 'getConfigurableCountTo', + 'getConfigurableCountFrom', 'getBigConfigurableCountTo', + 'getBigConfigurableCountFrom', 'getRequiredQuoteQuantity', 'getFixtureDataFilename', 'getExistsQuoteQuantity', @@ -173,8 +176,11 @@ public function testGenerateQuotes() $select = $this->getMockBuilder(Select::class) ->disableOriginalConstructor() ->getMock(); + $this->config->expects($this->atLeastOnce())->method('getSimpleCountFrom')->willReturn(0); $this->config->expects($this->atLeastOnce())->method('getSimpleCountTo')->willReturn(2); + $this->config->expects($this->atLeastOnce())->method('getConfigurableCountFrom')->willReturn(0); $this->config->expects($this->atLeastOnce())->method('getConfigurableCountTo')->willReturn(1); + $this->config->expects($this->atLeastOnce())->method('getBigConfigurableCountFrom')->willReturn(0); $this->config->expects($this->atLeastOnce())->method('getBigConfigurableCountTo')->willReturn(1); $this->config->expects($this->atLeastOnce())->method('getRequiredQuoteQuantity')->willReturn(1); $this->config->expects($this->atLeastOnce())->method('getExistsQuoteQuantity')->willReturn(0);