You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
# Prototypes
2
2
> Dinamically add methods to PHP classes
3
3
4
-
Using this library you can dinamically add methods to classes, as in the following example:
4
+
Using this library you can dinamcally add methods to classes, as in the following example:
5
5
```php
6
6
use skrtdev\Prototypes\Prototypeable;
7
7
@@ -21,7 +21,8 @@ Output is `What a nice way to use PHP`
21
21
22
22
### Main Features
23
23
24
-
- Closures are binded to the original object, so you can access `$this` inside closures in the same way as you do when writing a normal method for that class.
24
+
- Closures are bound to the original object, so you can access `$this` inside closures in the same way as you do when writing a normal method for that class.
25
+
- Supports **static** methods too, and you can access `self` and `static` too.
25
26
- A native-like `\Error` will be thrown when trying to call a non-existent method.
26
27
- A `skrtdev\Prototypes\Exception` will be thrown if class method already exists, is a prototype, class does not exist or isn't Prototypeable (when using `skrtdev\Prototypes\Prototypes::addMethod()`).
27
28
@@ -56,5 +57,4 @@ The `Prototypes` class itself is `Prototypeable`, how strange.
56
57
- Allow to add all methods of a normal/anonymous class into a Prototypeable one (Using `Reflection`?).
57
58
- Add ability to use some kind of [Attributes](https://www.php.net/manual/en/language.attributes.overview.php) to functions, classes and methods in order to add them as methods to a class, instead of manually adding them.
58
59
- Add the ability to define prototype methods that has been already defined as prototypes, overwriting them.
59
-
- Add the ability to define prototype for **static** methods. (is it useful enough?)
60
60
- Add the ability to define prototypes for all the Prototypeable classes. (do you see any use cases?)
0 commit comments