Skip to content

Commit 93f6a1e

Browse files
committed
AC-6841:Fix ArgumentsReader::getParentCall() to support named constructor arguments - Fixed statix test failures
1 parent 23b7880 commit 93f6a1e

File tree

4 files changed

+23
-20
lines changed

4 files changed

+23
-20
lines changed

lib/internal/Magento/Framework/Code/Test/Unit/Validator/ConstructorIntegrityTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
*/
66
namespace Magento\Framework\Code\Test\Unit\Validator;
77

8+
use Magento\SomeModule\Model\NamedArguments\ChildClassTest;
89
use PHPUnit\Framework\TestCase;
910
use Magento\Framework\Code\Validator\ConstructorIntegrity;
10-
use Magento\SomeModule\Model\One\Test;
1111
use Magento\Framework\Exception\ValidatorException;
1212

1313
require_once __DIR__ . '/../_files/app/code/Magento/SomeModule/Model/Three/Test.php';
@@ -32,7 +32,7 @@ protected function setUp(): void
3232

3333
public function testValidateIfParentClassExist()
3434
{
35-
$this->assertTrue($this->_model->validate(Test::class));
35+
$this->assertTrue($this->_model->validate(\Magento\SomeModule\Model\One\Test::class));
3636
}
3737

3838
public function testValidateIfClassHasParentConstructCall()
@@ -42,7 +42,7 @@ public function testValidateIfClassHasParentConstructCall()
4242

4343
public function testValidateIfClassHasParentConstructCallWithNamedArguments()
4444
{
45-
$this->assertTrue($this->_model->validate(\Magento\SomeModule\Model\NamedArguments\ChildClassTest::class));
45+
$this->assertTrue($this->_model->validate(ChildClassTest::class));
4646
}
4747

4848
public function testValidateIfClassHasArgumentsQtyEqualToParentClass()

lib/internal/Magento/Framework/Code/Test/Unit/_files/app/code/Magento/SomeModule/Model/NamedArguments/ChildClassTest.php

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,18 @@
11
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
26
declare(strict_types=1);
7+
38
namespace Magento\SomeModule\Model\NamedArguments;
49

510
require_once __DIR__ . '/ParentClassTest.php';
611

712
class ChildClassTest extends ParentClassTest
813
{
914
/**
10-
* @var stdClass
11-
*/
12-
protected $stdClassObject;
13-
14-
/**
15-
* @var array
16-
*/
17-
protected $arrayVariable;
18-
19-
/**
20-
* @param stdClass $stdClassObject
15+
* @param \stdClass $stdClassObject
2116
* @param array $arrayVariable
2217
*/
2318
public function __construct(\stdClass $stdClassObject, array $arrayVariable)

lib/internal/Magento/Framework/Code/Test/Unit/_files/app/code/Magento/SomeModule/Model/NamedArguments/ParentClassTest.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,26 @@
11
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
27

38
namespace Magento\SomeModule\Model\NamedArguments;
49

510
class ParentClassTest
611
{
712
/**
8-
* @var stdClass
13+
* @var \stdClass
914
*/
10-
protected $stdClassObject;
15+
protected \stdClass $stdClassObject;
1116

1217
/**
1318
* @var array
1419
*/
15-
protected $arrayVariable;
20+
protected array $arrayVariable;
1621

1722
/**
18-
* @param stdClass $stdClassObject
23+
* @param \stdClass $stdClassObject
1924
* @param array $arrayVariable
2025
*/
2126
public function __construct(\stdClass $stdClassObject, array $arrayVariable)

lib/internal/Magento/Framework/Code/Validator/ConstructorIntegrity.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
<?php
22
/**
3-
* Class constructor validator. Validates call of parent construct
4-
*
53
* Copyright © Magento, Inc. All rights reserved.
64
* See COPYING.txt for license details.
75
*/
6+
declare(strict_types=1);
7+
88
namespace Magento\Framework\Code\Validator;
99

1010
use Magento\Framework\Code\ValidatorInterface;
1111
use Magento\Framework\Exception\ValidatorException;
1212
use Magento\Framework\Phrase;
1313

14+
/**
15+
* Class constructor validator. Validates call of parent construct
16+
*/
1417
class ConstructorIntegrity implements ValidatorInterface
1518
{
1619
/**

0 commit comments

Comments
 (0)