Skip to content

Commit 8fce4bf

Browse files
committed
MC-17251: Creating a preference for category product indexer breaks setup:di:compile
- Added more common fix - Reverted changes in Magento\Catalog\Model\Indexer\Category\Product\Action\Full
1 parent b08d800 commit 8fce4bf

File tree

3 files changed

+25
-10
lines changed
  • app/code/Magento/Catalog/Model/Indexer/Category/Product/Action
  • lib/internal/Magento/Framework

3 files changed

+25
-10
lines changed

app/code/Magento/Catalog/Model/Indexer/Category/Product/Action/Full.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,9 @@ private function switchTables(): void
150150
/**
151151
* Refresh entities index
152152
*
153-
* @return AbstractAction
153+
* @return $this
154154
*/
155-
public function execute(): AbstractAction
155+
public function execute(): self
156156
{
157157
$this->createTables();
158158
$this->clearReplicaTables();

lib/internal/Magento/Framework/Interception/Code/Generator/Interceptor.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
* See COPYING.txt for license details.
55
*/
66

7+
declare(strict_types=1);
8+
79
namespace Magento\Framework\Interception\Code\Generator;
810

911
/**
@@ -58,6 +60,7 @@ protected function _getDefaultConstructorDefinition()
5860
? "parent::__construct({$this->_getParameterList($parameters)});"
5961
: "parent::__construct();";
6062
}
63+
6164
return [
6265
'name' => '__construct',
6366
'parameters' => $parameters,
@@ -81,6 +84,7 @@ protected function _getClassMethods()
8184
$methods[] = $this->_getMethodInfo($method);
8285
}
8386
}
87+
8488
return $methods;
8589
}
8690

@@ -109,7 +113,7 @@ protected function _getMethodInfo(\ReflectionMethod $method)
109113
$parameters[] = $this->_getMethodParameterInfo($parameter);
110114
}
111115

112-
$returnTypeValue = $this->getReturnTypeValue($method->getReturnType());
116+
$returnTypeValue = $this->getReturnTypeValue($method);
113117
$methodInfo = [
114118
'name' => ($method->returnsReference() ? '& ' : '') . $method->getName(),
115119
'parameters' => $parameters,
@@ -184,6 +188,7 @@ protected function _generateCode()
184188
$this->_classGenerator->addTrait('\\' . \Magento\Framework\Interception\Interceptor::class);
185189
$interfaces[] = '\\' . \Magento\Framework\Interception\InterceptorInterface::class;
186190
$this->_classGenerator->setImplementedInterfaces($interfaces);
191+
187192
return parent::_generateCode();
188193
}
189194

@@ -211,24 +216,27 @@ protected function _validateData()
211216
$result = false;
212217
}
213218
}
219+
214220
return $result;
215221
}
216222

217223
/**
218224
* Returns return type
219225
*
220-
* @param mixed $returnType
226+
* @param \ReflectionMethod $method
221227
* @return null|string
222228
*/
223-
private function getReturnTypeValue($returnType): ?string
229+
private function getReturnTypeValue(\ReflectionMethod $method): ?string
224230
{
225231
$returnTypeValue = null;
232+
$returnType = $method->getReturnType();
226233
if ($returnType) {
227234
$returnTypeValue = ($returnType->allowsNull() ? '?' : '');
228235
$returnTypeValue .= ($returnType->getName() === 'self')
229-
? $this->getSourceClassName()
236+
? $this->_getFullyQualifiedClassName($method->getDeclaringClass()->getName())
230237
: $returnType->getName();
231238
}
239+
232240
return $returnTypeValue;
233241
}
234242
}

lib/internal/Magento/Framework/ObjectManager/Code/Generator/Proxy.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
* See COPYING.txt for license details.
77
*/
88

9+
declare(strict_types=1);
10+
911
namespace Magento\Framework\ObjectManager\Code\Generator;
1012

1113
/**
@@ -73,6 +75,7 @@ protected function _getClassProperties()
7375
'tags' => [['name' => 'var', 'description' => 'bool']],
7476
],
7577
];
78+
7679
return $properties;
7780
}
7881

@@ -154,6 +157,7 @@ protected function _generateCode()
154157
$this->_classGenerator->setExtendedClass($typeName);
155158
$this->_classGenerator->setImplementedInterfaces(['\\' . self::NON_INTERCEPTABLE_INTERFACE]);
156159
}
160+
157161
return parent::_generateCode();
158162
}
159163

@@ -173,7 +177,7 @@ protected function _getMethodInfo(\ReflectionMethod $method)
173177
$parameters[] = $this->_getMethodParameterInfo($parameter);
174178
}
175179

176-
$returnTypeValue = $this->getReturnTypeValue($method->getReturnType());
180+
$returnTypeValue = $this->getReturnTypeValue($method);
177181
$methodInfo = [
178182
'name' => $method->getName(),
179183
'parameters' => $parameters,
@@ -269,24 +273,27 @@ protected function _validateData()
269273
$result = false;
270274
}
271275
}
276+
272277
return $result;
273278
}
274279

275280
/**
276281
* Returns return type
277282
*
278-
* @param mixed $returnType
283+
* @param \ReflectionMethod $method
279284
* @return null|string
280285
*/
281-
private function getReturnTypeValue($returnType): ?string
286+
private function getReturnTypeValue(\ReflectionMethod $method): ?string
282287
{
283288
$returnTypeValue = null;
289+
$returnType = $method->getReturnType();
284290
if ($returnType) {
285291
$returnTypeValue = ($returnType->allowsNull() ? '?' : '');
286292
$returnTypeValue .= ($returnType->getName() === 'self')
287-
? $this->getSourceClassName()
293+
? $this->_getFullyQualifiedClassName($method->getDeclaringClass()->getName())
288294
: $returnType->getName();
289295
}
296+
290297
return $returnTypeValue;
291298
}
292299
}

0 commit comments

Comments
 (0)