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
### Using first class callable syntax (enabling IDE autocompletion)
112
+
113
+
Since PHP 8.1, you can use a first class callable syntax, or simply put an anonymous function, to pipe the value through. This enables **full method autocompletion**.
114
+
115
+
```php
116
+
take('STRING')
117
+
->pipe(strtolower(...))
118
+
->get()
119
+
120
+
// "string"
121
+
```
122
+
123
+
Or using parameters:
124
+
125
+
```php
126
+
Pipe::from('https://sebastiaanluca.com/blog')
127
+
->pipe(parse_url(...))
128
+
->end()
129
+
->pipe(substr(...), PIPED_VALUE, 3)
130
+
->pipe(strtoupper(...))
131
+
->get(),
132
+
133
+
// "OG"
134
+
```
135
+
136
+
137
+
110
138
### Using closures
111
139
112
140
Sometimes standard methods don't cut it and you need to perform a custom operation on a value in the process. You can do so using a closure:
@@ -151,6 +179,32 @@ class MyClass
151
179
152
180
If you don't want to use the internal pipe proxy and pass `$this`, there are two other ways you can use class methods.
0 commit comments