Skip to content

Commit

Permalink
style fix
Browse files Browse the repository at this point in the history
cappuc committed Mar 4, 2024
1 parent 19d9d11 commit 723d4d5
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/Drop.php
Original file line number Diff line number Diff line change
@@ -8,6 +8,9 @@
use Keepsuit\Liquid\Drops\Hidden;
use Keepsuit\Liquid\Exceptions\UndefinedDropMethodException;
use Keepsuit\Liquid\Support\Str;
use ReflectionClass;
use ReflectionMethod;
use Traversable;

class Drop implements IsContextAware
{
@@ -104,21 +107,21 @@ protected function getCacheableMethods(): array
* @phpstan-assert !null $this->invokableMethods
* @phpstan-assert !null $this->cacheableMethods
*/
protected function init(): void
private function init(): void
{
$blacklist = array_map(
fn (\ReflectionMethod $method) => $method->getName(),
(new \ReflectionClass(Drop::class))->getMethods(\ReflectionMethod::IS_PUBLIC)
fn (ReflectionMethod $method) => $method->getName(),
(new ReflectionClass(Drop::class))->getMethods(ReflectionMethod::IS_PUBLIC)
);

if ($this instanceof \Traversable) {
if ($this instanceof Traversable) {
$blacklist = [...$blacklist, 'current', 'next', 'key', 'valid', 'rewind'];
}

$publicMethods = (new \ReflectionClass($this))->getMethods(\ReflectionMethod::IS_PUBLIC);
$publicMethods = (new ReflectionClass($this))->getMethods(ReflectionMethod::IS_PUBLIC);

$visibleMethodNames = array_map(
fn (\ReflectionMethod $method) => $method->getAttributes(Hidden::class) !== [] ? null : $method->getName(),
fn (ReflectionMethod $method) => $method->getAttributes(Hidden::class) !== [] ? null : $method->getName(),
$publicMethods
);

@@ -128,7 +131,7 @@ protected function init(): void
));

$this->cacheableMethods = array_values(array_filter(array_map(
fn (\ReflectionMethod $method) => $method->getAttributes(Cache::class) !== [] ? $method->getName() : null,
fn (ReflectionMethod $method) => $method->getAttributes(Cache::class) !== [] ? $method->getName() : null,
$publicMethods
)));
}

0 comments on commit 723d4d5

Please sign in to comment.