Hi, i find it quite confusing myself, here's a use case mixing `&` and `|`.
```php <?php namespace App\Foo; class Bar { /** * in this example `Bar` constructor accepts an object that implement * ( `CacheInterface` and `ResetableInterface` ) or `ResetableCacheInterface` * * should the doc block be formatted this way : * * @param object&CacheInterface&ResetableInterface|ResetableCacheInterface $cache * * or maybe like this ? * * @param object&ResetableCacheInterface|ResetableInterface&CacheInterface $cache * * or maybe we can use parentheses ? ¯\_(ツ)_/¯ * * @param object & ( ResetableCacheInterface | ( ResetableInterface & CacheInterface ) ) $cache */ public function __construct($cache) { // initialize cache property } } ``` On Sat, Oct 20, 2018 at 11:53 AM Johannes Schmitt <schmitt...@gmail.com> wrote: > Hi there, > > generally, I think the addition of `&` is a great idea. > > One thing regarding the grammar specifically, right now you would support > mixing `|` with `&` like `A|B&C`. I'm not sure if mixing would be desirable > (I don't have use-case for this at this point). Also the grammar currently > requires `|` to be before `&`- so something like `A&B|C` would not be > supported - I'm not sure if this is intentional? Maybe it's best to only > either support `|` or `&`, but not allow to mix them for the moment? > > Thanks, > Johannes > > On Fri, Oct 19, 2018 at 2:50 PM Chuck Burgess <demon.g...@gmail.com> > wrote: > >> Hello everyone, >> >> There is a new PR [1] from a contributor, asking for an Intersection Type >> Operator. This appears to simply use `&` akin to how `|` is used for Union >> Types. >> >> Neither Unions nor Intersections are (yet) in the language itself, but >> `string|null` Union Typing in Tags has been in wide usage for a while now. >> In looking over RFCs on attempts to get these two Type Operators into the >> language, it seems likely to me that the Operators chosen will be `|` and >> `&` if they do ever get in. As such, I'm personally good with the choice >> of `&` for Intersection Operator for Typing in Tags. >> >> Please keep discussion on this request on this ML thread. >> >> Chuck Burgess, Editor >> >> [1] -- https://github.com/php-fig/fig-standards/pull/1104 >> >> -- >> You received this message because you are subscribed to the Google Groups >> "PHP Framework Interoperability Group" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to php-fig+unsubscr...@googlegroups.com. >> To post to this group, send email to php-fig@googlegroups.com. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/php-fig/9f5897a1-b771-4352-8cba-9851bddcb9ce%40googlegroups.com >> <https://groups.google.com/d/msgid/php-fig/9f5897a1-b771-4352-8cba-9851bddcb9ce%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > -- > You received this message because you are subscribed to the Google Groups > "PHP Framework Interoperability Group" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to php-fig+unsubscr...@googlegroups.com. > To post to this group, send email to php-fig@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/php-fig/CANdv-DeCnvpSgfQC9WP_kq9yz%3DFq4O8tfQok_o%2BoGR4QNyg1Ww%40mail.gmail.com > <https://groups.google.com/d/msgid/php-fig/CANdv-DeCnvpSgfQC9WP_kq9yz%3DFq4O8tfQok_o%2BoGR4QNyg1Ww%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "PHP Framework Interoperability Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to php-fig+unsubscr...@googlegroups.com. To post to this group, send email to php-fig@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/php-fig/CAMshokcbDnAkcMqAqm%3DeTG52oUFgXXz%2B5emTckN0iib1tj%2BEbQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.