Skip to content

Commit

Permalink
Merge pull request #7 from bitwise-operators/fix-cache-with-custom-at…
Browse files Browse the repository at this point in the history
…tributes

fix: Make caching work with custom attributes
  • Loading branch information
Jeroen-G authored Jun 24, 2022
2 parents a987a9f + 5de4944 commit d94db3f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

## [1.4.1]
- Custom attributes now work with caching

## [1.4.0]
- Add option to use custom attribute classes

Expand Down
6 changes: 5 additions & 1 deletion src/Console/AutowireCacheCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
use Illuminate\Console\Command;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\File;
use JeroenG\Autowire\Attribute\Autowire as AutowireAttribute;
use JeroenG\Autowire\Attribute\Configure as ConfigureAttribute;
use JeroenG\Autowire\Crawler;
use JeroenG\Autowire\Electrician;

Expand All @@ -17,7 +19,9 @@ class AutowireCacheCommand extends Command
public function handle(): int
{
$crawler = Crawler::in(config('autowire.directories'));
$electrician = new Electrician($crawler);
$autowireAttribute = config('autowire.autowire_attribute', AutowireAttribute::class);
$configureAttribute = config('autowire.configure_attribute', ConfigureAttribute::class);
$electrician = new Electrician($crawler, $autowireAttribute, $configureAttribute);

$autowires = $crawler->filter(fn(string $name) => $electrician->canAutowire($name))->classNames();
$configures = $crawler->filter(fn(string $name) => $electrician->canConfigure($name))->classNames();
Expand Down
2 changes: 0 additions & 2 deletions src/Console/AutowireClearCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
use Illuminate\Console\Command;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\File;
use JeroenG\Autowire\Crawler;
use JeroenG\Autowire\Electrician;

class AutowireClearCommand extends Command
{
Expand Down

0 comments on commit d94db3f

Please sign in to comment.