@@ -10,8 +10,8 @@ It also lets you to easily invoke a callable with `call()` and `apply()` support
1010
1111- Unified and simplified interface to reflect callable parameters
1212- No dependencies
13- - PHP 8.0 ready (supports union type hints ; see examples below)
14- - PHP 7.1+ compatible
13+ - Supports PHP 8.0, 8.1, 8.2, 8.3, 8.4 (supports union types, ` mixed ` , ` false ` , etc ; see examples below)
14+ - PHP 7.1+ compatible & mdash ; runs on as low as PHP 7.1
1515- Semver
1616- Tests
1717
@@ -161,11 +161,11 @@ assert($service instanceof MyService);
161161## How is this better than reflecting ` Closure::fromCallable() `
162162
163163This library's functionality is somewhat similar to what a reflection of the standard ` Closure::fromCallable() ` can provide.
164- And if that's sufficient for your use case, I recommend using the standard code .
164+ And if that's enough for your use case, you probably want to be using the standard reflection .
165165
166166This library, however, does provide some added value on top:
167167
168- - It unifies interactions will all kinds of callables, including class constructors.
168+ - It unifies interactions with all kinds of callables, including class constructors.
169169 That was actually the primary use case I had in mind for it — building a DI service container.
170170
171171 For example, you cannot instantiate a new instance with Closure::fromCallable():
@@ -181,18 +181,19 @@ This library, however, does provide some added value on top:
181181 $reflection = CallableReflection::fromConstructor(MyRemoteService::class);
182182 $service = $reflection->call($token);
183183 ```
184+
185+ - It provides utilities to check if a specific value satisfies the given function argument type declaration (see ` ->satisfies() ` ).
184186
185187- It can know and tell what type of callable was reflected, while with Closure::fromCallable() this information is lost.
186- This might be important for certain use cases, or not. Depending on the scenario .
188+ This might be important for certain use cases.
187189
188190- It has nice additional convenience getters and checkers. Like ` satisfies() ` , ` isOptional() ` , ` isNull() ` , ` isScalar() ` , etc.
189191
190- - I also find the API somewhat more intuitive and convenient (which is, of course, subjective and debatable),
191- as the native Reflection API is slightly polluted as a result of BC-preserving additions
192+ - The API is more intuitive and straighforward and hides away PHP version differences introduced to the Reflections API
193+ over years. The native Reflections API is polluted with BC-preserving constructs.
192194
193- - In terms of performance, I am sure this implementation will most definitely be slower than using the native code.
194- Though I didn't test it to provide the exact numbers. It's basically doing almost the same, but with extra code on top
195- — just operating on top of Reflections API.
195+ - The library is operating on top of the native Reflections API, and therefore is as performant as it is, plus a little
196+ overhead for the convenience wrappers.
196197
197198
198199## Changelog
0 commit comments