Skip to content

Use modern first class callable syntax #535

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/ElFinder/ElFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function __construct($opts)
if (defined('E_DEPRECATED')) {
$errLevel |= E_DEPRECATED | E_USER_DEPRECATED;
}
set_error_handler('elFinder::phpErrorHandler', $errLevel);
set_error_handler(elFinder::phpErrorHandler(...), $errLevel);

// Associative array of files to delete at the end of script: ['temp file path' => true]
$GLOBALS['elFinderTempFiles'] = [];
Expand Down Expand Up @@ -195,7 +195,7 @@ public function __construct($opts)
$doRegist = (false !== strpos($cmd, '*'));

if (!$doRegist) {
$doRegist = ($_reqCmd && in_array($_reqCmd, array_map('elFinder::getCmdOfBind', explode(' ', $cmd))));
$doRegist = ($_reqCmd && in_array($_reqCmd, array_map(elFinder::getCmdOfBind(...), explode(' ', $cmd))));
}

if ($doRegist) {
Expand All @@ -215,7 +215,7 @@ public function __construct($opts)
if (0 === strcasecmp($_domain, 'plugin')) {
if ($plugin = $this->getPluginInstance($_name, $opts['plugin'][$_name] ?? []) and
method_exists($plugin, $_method)) {
$this->bind($cmd, [$plugin, $_method]);
$this->bind($cmd, $plugin->$_method(...));
}
}
} else {
Expand Down
8 changes: 4 additions & 4 deletions src/Twig/Extension/FMElfinderExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ public function getFunctions(): array
$options = ['is_safe' => ['html']];

return [
new TwigFunction('elfinder_tinymce_init', [$this, 'tinymce'], $options),
new TwigFunction('elfinder_tinymce_init4', [$this, 'tinymce4'], $options),
new TwigFunction('elfinder_tinymce_init5', [$this, 'tinymce5'], $options),
new TwigFunction('elfinder_summernote_init', [$this, 'summernote'], $options),
new TwigFunction('elfinder_tinymce_init', $this->tinymce(...), $options),
new TwigFunction('elfinder_tinymce_init4', $this->tinymce4(...), $options),
new TwigFunction('elfinder_tinymce_init5', $this->tinymce5(...), $options),
new TwigFunction('elfinder_summernote_init', $this->summernote(...), $options),
];
}

Expand Down
2 changes: 1 addition & 1 deletion tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@

$loader = require $file;

AnnotationRegistry::registerLoader([$loader, 'loadClass']);
AnnotationRegistry::registerLoader($loader->loadClass(...));