Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Warning: Uninitialized string offset 1 in Parser.php:160" when using readonly on anonymous classes #6755

Open
neontsun opened this issue May 15, 2024 · 0 comments

Comments

@neontsun
Copy link

What are you trying to achieve?

In some of our testcases we use anonymous classes. When creating an anonymous readonly class, this class issues a warning. The tests run fine though.

What do you get instead?

vendor/bin/codecept run
Codeception PHP Testing Framework v5.1.2

Uninitialized string offset 1 at /var/www/api/vendor/codeception/codeception/src/Codeception/Lib/Parser.php:160

Provide test source code if related

<?php

namespace Shared\Tests\Unit\Domain\ValueObject;

use Throwable;

final class AbstractCollectionTest extends \Codeception\Test\Unit
{
    protected UnitTester $tester;
    
    public function testCreateVo(): void
    {
        try {
            new readonly class (12) extends AbstractValueObject {
                public function __construct(
                    public mixed $value,
                ) {}
            };
            
            $this->tester->assertTrue(true);
        } catch (Throwable $e) {
            $this->tester->fail($e->getMessage());
        }
    }
}

Details

  • Codeception version: 5.1.2

  • PHP Version: 8.3

  • Operating System: MacOS

  • Installation type: Composer

  • Suite configuration:

# Codeception Test Suite Configuration
#
# Suite for unit or integration tests.

actor: UnitTester
modules:
    enabled:
        - Asserts
step_decorators: ~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant