1212use Magento \Eav \Api \Data \AttributeOptionInterface ;
1313use Magento \Eav \Api \Data \AttributeOptionLabelInterface ;
1414use Magento \Eav \Model \AttributeRepository ;
15+ use Magento \Framework \DataObject ;
1516use Magento \Framework \Webapi \Rest \Request ;
1617use Magento \Swatches \Model \ResourceModel \Swatch \Collection ;
1718use Magento \Swatches \Model \ResourceModel \Swatch \CollectionFactory ;
@@ -33,23 +34,23 @@ class ProductAttributeOptionManagementInterfaceTest extends WebapiAbstract
3334 /**
3435 * Test add option to swatch attribute
3536 *
37+ * @dataProvider addDataProvider
3638 * @magentoApiDataFixture Magento/Catalog/Model/Product/Attribute/_files/select_attribute.php
3739 * @param array $data
3840 * @param array $payload
3941 * @param int $expectedSwatchType
4042 * @param string $expectedLabel
4143 * @param string $expectedValue
4244 *
43- * @dataProvider addDataProvider
45+ * @return void
4446 */
4547 public function testAdd (
4648 array $ data ,
4749 array $ payload ,
4850 int $ expectedSwatchType ,
4951 string $ expectedLabel ,
5052 string $ expectedValue
51- )
52- {
53+ ): void {
5354 $ objectManager = Bootstrap::getObjectManager ();
5455 /** @var $attributeRepository AttributeRepository */
5556 $ attributeRepository = $ objectManager ->get (AttributeRepository::class);
@@ -87,8 +88,9 @@ public function testAdd(
8788
8889 /**
8990 * @magentoApiDataFixture Magento/Swatches/_files/text_swatch_attribute.php
91+ * @return void
9092 */
91- public function testUpdate ()
93+ public function testUpdate (): void
9294 {
9395 $ testAttributeCode = 'test_configurable ' ;
9496 $ optionData = [
@@ -115,7 +117,7 @@ public function testUpdate()
115117 $ this ->assertNotNull (
116118 $ this ->getAttributeOption (
117119 $ testAttributeCode ,
118- $ optionData [AttributeOptionLabelInterface ::LABEL ]
120+ $ optionData [AttributeOptionInterface ::LABEL ]
119121 )
120122 );
121123 }
@@ -124,7 +126,7 @@ public function testUpdate()
124126 * @return array
125127 * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
126128 */
127- public function addDataProvider ()
129+ public function addDataProvider (): array
128130 {
129131 return [
130132 'visual swatch option with value ' => [
@@ -249,14 +251,15 @@ public function addDataProvider()
249251 * Get swatch model
250252 *
251253 * @param int $optionId
252- * @return Swatch
254+ * @return DataObject
253255 */
254- private function getSwatch (int $ optionId )
256+ private function getSwatch (int $ optionId ): DataObject
255257 {
256258 /** @var Collection $collection */
257259 $ collection = Bootstrap::getObjectManager ()->get (CollectionFactory::class)->create ();
258260 $ collection ->addFieldToFilter ('option_id ' , $ optionId );
259261 $ collection ->setPageSize (1 );
262+
260263 return $ collection ->getFirstItem ();
261264 }
262265
@@ -300,6 +303,8 @@ private function webApiCallAttributeOptions(
300303 }
301304
302305 /**
306+ * Get Attribute options by attribute code
307+ *
303308 * @param string $testAttributeCode
304309 * @param string|null $storeCode
305310 * @return array|bool|float|int|string
@@ -317,6 +322,8 @@ private function getAttributeOptions(string $testAttributeCode, ?string $storeCo
317322 }
318323
319324 /**
325+ * Get Attribute option by attribute code
326+ *
320327 * @param string $attributeCode
321328 * @param string $optionLabel
322329 * @param string|null $storeCode
@@ -326,8 +333,7 @@ private function getAttributeOption(
326333 string $ attributeCode ,
327334 string $ optionLabel ,
328335 ?string $ storeCode = null
329- ): ?array
330- {
336+ ): ?array {
331337 $ attributeOptions = $ this ->getAttributeOptions ($ attributeCode , $ storeCode );
332338 $ option = null ;
333339 /** @var array $attributeOption */
0 commit comments