1515 */
1616class ExtensionAttributesGenerator extends \Magento \Framework \Code \Generator \EntityAbstract
1717{
18- const ENTITY_TYPE = 'extension ' ;
18+ public const ENTITY_TYPE = 'extension ' ;
1919
20- const EXTENSION_SUFFIX = 'Extension ' ;
20+ public const EXTENSION_SUFFIX = 'Extension ' ;
2121
2222 /**
2323 * @var \Magento\Framework\Api\ExtensionAttribute\Config
@@ -80,23 +80,23 @@ private function getTypeProcessor()
8080 }
8181
8282 /**
83- * { @inheritdoc}
83+ * @inheritdoc
8484 */
8585 protected function _getDefaultConstructorDefinition ()
8686 {
8787 return [];
8888 }
8989
9090 /**
91- * { @inheritdoc}
91+ * @inheritdoc
9292 */
9393 protected function _getClassProperties ()
9494 {
9595 return [];
9696 }
9797
9898 /**
99- * { @inheritdoc}
99+ * @inheritdoc
100100 */
101101 protected function _getClassMethods ()
102102 {
@@ -139,7 +139,7 @@ protected function _getClassMethods()
139139 }
140140
141141 /**
142- * { @inheritdoc}
142+ * @inheritdoc
143143 */
144144 protected function _validateData ()
145145 {
@@ -148,7 +148,7 @@ protected function _validateData()
148148 }
149149
150150 /**
151- * { @inheritdoc}
151+ * @inheritdoc
152152 */
153153 protected function _generateCode ()
154154 {
@@ -177,11 +177,11 @@ protected function getCustomAttributes()
177177 if (!isset ($ this ->allCustomAttributes )) {
178178 $ this ->allCustomAttributes = $ this ->config ->get ();
179179 }
180- $ dataInterface = ltrim ($ this ->getSourceClassName (), '\\' );
180+ $ dataInterface = $ this -> getSourceClassName () !== null ? ltrim ($ this ->getSourceClassName (), '\\' ) : '' ;
181181 if (isset ($ this ->allCustomAttributes [$ dataInterface ])) {
182182 foreach ($ this ->allCustomAttributes [$ dataInterface ] as $ attributeName => $ attributeMetadata ) {
183183 $ attributeType = $ attributeMetadata [Converter::DATA_TYPE ];
184- if (strpos ($ attributeType , '\\' ) !== false ) {
184+ if ($ attributeType !== null && strpos ($ attributeType , '\\' ) !== false ) {
185185 /** Add preceding slash to class names, while leaving primitive types as is */
186186 $ attributeType = $ this ->_getFullyQualifiedClassName ($ attributeType );
187187 $ this ->allCustomAttributes [$ dataInterface ][$ attributeName ][Converter::DATA_TYPE ] =
@@ -202,7 +202,7 @@ protected function getCustomAttributes()
202202 protected function validateResultClassName ()
203203 {
204204 $ result = true ;
205- $ sourceClassName = $ this ->getSourceClassName ();
205+ $ sourceClassName = $ this ->getSourceClassName () ?? '' ;
206206 $ resultClassName = $ this ->_getResultClassName ();
207207 $ interfaceSuffix = 'Interface ' ;
208208 $ expectedResultClassName = substr ($ sourceClassName , 0 , -strlen ($ interfaceSuffix )) . self ::EXTENSION_SUFFIX ;
0 commit comments