Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

PHP 8 support issue in handling of current() factories in DI #39737

Copy link
Copy link
Closed
@Seldaek

Description

@Seldaek
Issue body actions

Symfony version(s) affected: 4.4.18

Description

parent::__construct(sprintf('Invalid definition for service "%s": argument %d of "%s::%s()" accepts "%s", "%s" passed.', $serviceId, 1 + $parameter->getPosition(), $parameter->getDeclaringClass()->getName(), $parameter->getDeclaringFunction()->getName(), $acceptedType, $type));
does not support ReflectionParameter which are on a function and not a class. $parameter->getDeclaringClass()->getName() fails because getDeclaringClass returns null.

This only happens on PHP 8 because

using current in PHP 8 will result in a parameter type hint being array|object, while PHP 7 did not have a type hint: https://3v4l.org/YKHtO and apparently Symfony also does not support union types as per @nicolas-grekas.

How to reproduce
I could not reduce it to a minimal repro case sorry

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.