Rudolph Gottesheim
Rudolph Gottesheim
This package seems to be doing just that: https://github.com/icanhazstring/composer-unused
I just saw a talk where @Ocramius mentions a tool that does exactly that: https://github.com/icanhazstring/composer-unused
I still think this would be a welcome feature to a "generic" "Require-Checker".
Duplicate of #14?
> Adding support for `T of array` is easy, but I don't know what you're trying to achieve with `T & array{mykey: int}`. ```php $before = ['knownKey' => 'test']; $after...
See the [corresponding TypeScript example](https://www.typescriptlang.org/play?#code/MYewdgzgLgBAhgEwQZRAWwKYGkME8YC8MAPACowYAeUGYCEMA3gL4B8AFAFAw8xpwAHAFwxSAGm68AbnAA2AVwwiw8tACMMAJwkBKEeQBkTNLgDWeZao2bmhVjHaNJPAHRv+Aibz5mLMGQoYEsw6ANycnKCQsBoAZiCaGIRMpmAgAO5gOLgiAOQ00LnM4VHQ8LE0msmIKOjYeOxxCUEwAIwATGGR4BAgshgusiAA5uxwFVouJua4YUA).
By the way, I'm sure this is all quite difficult to implement, but we're pretty spoiled by TypeScript which supports almost anything you could want from a type system. But...
Aside from the topic at hand of intersecting "maps" (`array`) with "structs" (`array{foo: string, bar: int}`), the more straight-forward and probably less controversial thing to do is intersecting two "structs"...
I do see where you're coming from, but I don't think that's right. First of all, [TypeScript can do it](https://www.typescriptlang.org/play?#code/GYVwdgxgLglg9mABMAFAQwFyIN7DnLAZygCcYwBzAX0QDIcAjNEo086gSlbMoChteiIYhIBTKCBJI0AOjxxEAakSymJANy8qvXqmxUO6xAHpjyfCrAATRGpVjEAWxiFC7XSlz4sAciijiHwMjU0QAaVEAT1tmRBcnFzc+PTVff0DgkzMI6Pk4wgTXdz15NICoHwAaGJZEP3KgwyzEAHU4EgBrQiA). Second, it's no different that the following: ```php interface NamedThing...
By the way, it's the opposite when you're talking about union types: ```php /** * @param array{foo: string} | array{bar: string} */ function f(array $thing): string { if (array_key_exists('foo')) {...