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

Implement values as complement to annotations #14

Closed
wants to merge 1 commit into from

Conversation

thekid
Copy link
Member

@thekid thekid commented Sep 13, 2020

See xp-framework/rfc#336, values are key/value pairs that can be attached to types and type members. They serve as a complement to PHP 8 attributes which do not support arbitrary expressions in their argument lists.

Example

use unittest\{Assert, Test, Values};

class ListOfTest {

  #$values: [[new ListOf()], [ListOf::$EMPTY]]
  #[Test, Values(using: '$values')]
  public function size_of_empty($list) {
    Assert::equals(0, $list->size());
  }
}

Note: Accessing values needs to be implemented by libraries, no automatic coupling of the Values attributes and the $values value is done!

See xp-framework/rfc#336, values are key/value pairs that can be
attached to types and type members. They serve as a complement to
PHP 8 attributes which do not support arbitrary expressions in
their argument lists.
@thekid
Copy link
Member Author

thekid commented Sep 20, 2020

Decided against this in favor of eval named argument

@thekid thekid closed this Sep 20, 2020
@thekid thekid deleted the feature/values branch September 20, 2020 16:12
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.

1 participant