Skip to content

Commit

Permalink
Remove param type hints from generated classes
Browse files Browse the repository at this point in the history
  • Loading branch information
shochdoerfer committed Oct 3, 2022
1 parent 1c3cf10 commit 9a5e2ef
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 16 deletions.
Expand Up @@ -89,13 +89,6 @@ public function getFileContents(string $className): string
* @see \Magento\Framework\Api\Code\Generator\ExtensionAttributesGenerator::_getClassMethods
*/

// treat array types properly in the generated code. Similar to Magento core MyInterface[] type gets
// converted to just an array
$paramType = $type;
if (strpos($type, '[]') !== false) {
$paramType = null;
}

$generator->addMethodFromGenerator(
MethodGenerator::fromArray([
'name' => 'get' . ucfirst($propertyName),
Expand All @@ -109,7 +102,7 @@ public function getFileContents(string $className): string
$generator->addMethodFromGenerator(
MethodGenerator::fromArray([
'name' => 'set' . ucfirst($propertyName),
'parameters' => [new ParameterGenerator($propertyName, $paramType)],
'parameters' => [$propertyName],
'docblock' => DocBlockGenerator::fromArray([
'tags' => [
new ParamTag($propertyName, [$type]),
Expand Down
Expand Up @@ -105,13 +105,6 @@ public function getFileContents(string $interfaceName): string
* @see \Magento\Framework\Api\Code\Generator\ExtensionAttributesGenerator::_getClassMethods
*/

// treat array types properly in the generated code. Similar to Magento core MyInterface[] type gets
// converted to just an array
$paramType = $type;
if (strpos($type, '[]') !== false) {
$paramType = null;
}

$generator->addMethodFromGenerator(
MethodGenerator::fromArray([
'name' => 'get' . ucfirst($propertyName),
Expand All @@ -125,7 +118,7 @@ public function getFileContents(string $interfaceName): string
$generator->addMethodFromGenerator(
MethodGenerator::fromArray([
'name' => 'set' . ucfirst($propertyName),
'parameters' => [new ParameterGenerator($propertyName, $paramType)],
'parameters' => [$propertyName],
'docblock' => DocBlockGenerator::fromArray([
'tags' => [
new ParamTag($propertyName, [$type]),
Expand Down

0 comments on commit 9a5e2ef

Please sign in to comment.