Skip to content

Commit

Permalink
Merge pull request #496 from ergebnis/fix/readme
Browse files Browse the repository at this point in the history
Fix: Update `README.md`
  • Loading branch information
localheinz authored Dec 30, 2021
2 parents e3bac43 + b052d81 commit 6ad4d49
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
[![Latest Stable Version](https://poser.pugx.org/ergebnis/classy/v/stable)](https://packagist.org/packages/ergebnis/classy)
[![Total Downloads](https://poser.pugx.org/ergebnis/classy/downloads)](https://packagist.org/packages/ergebnis/classy)

Provides a finder for classy constructs (classes, interfaces, and traits).
Provides a finder for classy constructs (classes, enums, interfaces, and traits).

## Installation

Expand Down Expand Up @@ -40,19 +40,20 @@ namespace Example;

class Foo {}

interface Bar {}
enum Bar {}

trait Baz {}
interface Baz {}

trait Qux {}
PHP;

/** @var Construct[] $constructs */
$constructs = Constructs::fromSource($source);

$names = array_map(static function (Construct $construct): string {
return $construct->name();
}, $constructs);

var_dump($names); // ['Example\Bar', 'Example\Baz', 'Example\Foo']
var_dump($names); // ['Example\Bar', 'Example\Baz', 'Example\Foo', 'Example\Qux']
```

### Collect classy constructs from a directory
Expand All @@ -65,7 +66,6 @@ Use `Constructs::fromDirectory()` to collect classy constructs in a directory:
use Ergebnis\Classy\Construct;
use Ergebnis\Classy\Constructs;

/** @var Construct[] $constructs */
$constructs = Constructs::fromDirectory(__DIR__ . '/example');

$names = array_map(static function (Construct $construct): string {
Expand Down

0 comments on commit 6ad4d49

Please sign in to comment.