-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Closed
Labels
Fixed in 2.4.xThe issue has been fixed in 2.4-develop branchThe issue has been fixed in 2.4-develop branchIssue: Format is validGate 1 Passed. Automatic verification of issue format passedGate 1 Passed. Automatic verification of issue format passed
Description
Preconditions (*)
- Magento 2.3
- PHP 7.2
Steps to reproduce (*)
- Create a new module
- Create a test with data provider returning anonymous class
./bin/magento setup:di:compile
Expected result (*)
- Compilation succed
Actual result (*)
Notice: Uninitialized string offset: 1 in /var/www/setup/src/Magento/Setup/Module/Di/Code/Scanner/PhpScanner.php on line 219
My sample test class looks like this:
<?php
namespace OskarLaska\Xyz\Test\Unit;
class TestTest extends \PHPUnit\Framework\TestCase
{
/**
* @param $theObject
*
* @dataProvider someProvider
*/
public function testX($theObject)
{
$this->assertEquals('It works!', $theObject->callMe());
}
public function someProvider()
{
return [
'test' => [
new class {
public function callMe() {
return 'It works!';
}
}
]
];
}
}
Not sure if the anonymous class needs to be in data provider of PHPUnit's test. I saw other issues with anonymous classes resolved hence I provide my specific case.
Metadata
Metadata
Assignees
Labels
Fixed in 2.4.xThe issue has been fixed in 2.4-develop branchThe issue has been fixed in 2.4-develop branchIssue: Format is validGate 1 Passed. Automatic verification of issue format passedGate 1 Passed. Automatic verification of issue format passed