You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Obviously, our parameter definitions is returning an array. Furthermore, the test adds references in the array, which are not scalar either.
I think the test is correct, but that means we need to work on the PHPDoc of the ParameterDefinitionInterface.
Shall we try something like this:
Represents a container entry that is a parameter.
A parameter is a scalar value, a reference, or an array of parameters:
PARAMETER = [scalar | ReferenceInterface | array<PARAMETER> ]
Also, since we are allowing ReferenceInterface into parameters, shall we not extend it to DefinitionInterface?
To me ParameterDefinition can be literally anything, it represents a low-level entry in a container, I don't think we should even define explicitly what it can hold, and instead just say like, mixed
mixed is really problematic when it comes to compiled containers (Symfony, Yaco...)
For those, at the very least, you have to be able to "serialize" or "var_export" what ParameterDefinition is returning.
So this rules out resources and non serializable objects which are part of "mixed".
Also, we need Symfony compatibility out of the box, so we might have a look at what Symfony does support for parameters (and restrict ourselves to this subset)
So far, the text in the PHPDoc of
ParameterDefinitionInterface
says this:Note: according to is_scalar doc, arrays are NOT "scalar" values.
In the unit tests, we have this: https://github.com/container-interop/definition-interop-tests/blob/master/src/AbstractDefinitionCompatibilityTest.php#L166-L176
Obviously, our parameter definitions is returning an array. Furthermore, the test adds references in the array, which are not scalar either.
I think the test is correct, but that means we need to work on the PHPDoc of the
ParameterDefinitionInterface
.Shall we try something like this:
Also, since we are allowing
ReferenceInterface
into parameters, shall we not extend it toDefinitionInterface
?In this case, we would have:
The text was updated successfully, but these errors were encountered: