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

Make route annotation parameters default to array #336

Conversation

kmucavele
Copy link
Contributor

After the following change in the in the minor update from 3.10.0 -> 3.11.0:

Add PHP 8 Attributes support

The parameter $parameters in src/Configuration/Annotation/Route is set to null by default instead of an array.

This leads to the following exception on routes that don't pass this parameter:

The route parameters should be an array, NULL given. Maybe you forgot to wrap the expression in expr(...).

Example:

/**
 * @Hateoas\Relation(
 *      "self",
 *      href = @Hateoas\Route("api_example_route", absolute = true)
 * )
 */

But according the docs the $parameters are required and should default to an array, if not passed.

@Route

Property Required Content Expression language
name Yes string No
parameters Defaults to array() array / string Yes (string + array values)

@mvhirsch
Copy link

mvhirsch commented Nov 8, 2024

Please add a test for this! Thanks!

TBH, I don't know how to add such a test case in this library. @goetas could you give us a headstart on this one, please?

@goetas goetas merged commit 4cb096e into willdurand:master Nov 9, 2024
56 checks passed
@mvhirsch
Copy link

@goetas thank you for merging this! Could you please create a new release, e.g. 3.11.1 so we're able to start using attributes in our project? ❤️

@W0rma
Copy link
Contributor

W0rma commented Nov 23, 2024

@goetas Thank you for the new release. Do you plan to tag a new release for https://github.com/willdurand/BazingaHateoasBundle as well?

@goetas
Copy link
Collaborator

goetas commented Nov 24, 2024

done

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

Successfully merging this pull request may close these issues.

4 participants