Skip to content

Commit

Permalink
extension method are deprecated (BC break)
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Oct 13, 2022
1 parent cd03244 commit 991aefb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/Utils/Finder.php
Expand Up @@ -378,6 +378,7 @@ public static function compare($l, string $operator, $r): bool
/********************* extension methods ****************d*g**/


/** @deprecated */
public function __call(string $name, array $args)
{
return isset(self::$extMethods[$name])
Expand All @@ -386,8 +387,10 @@ public function __call(string $name, array $args)
}


/** @deprecated */
public static function extensionMethod(string $name, callable $callback): void
{
trigger_error(__METHOD__ . '() is deprecated.', E_USER_DEPRECATED);
self::$extMethods[$name] = $callback;
}
}
2 changes: 1 addition & 1 deletion tests/Utils/Finder.filters.phpt
Expand Up @@ -63,7 +63,7 @@ test('date filter', function () {


test('custom filters', function () {
Finder::extensionMethod('length', function ($finder, $length) {
@Finder::extensionMethod('length', function ($finder, $length) { // is deprecated
return $finder->filter(function ($file) use ($length) {
return strlen($file->getFilename()) == $length;
});
Expand Down

0 comments on commit 991aefb

Please sign in to comment.