Skip to content

Commit

Permalink
Fix: Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
localheinz committed Dec 30, 2021
1 parent e3bac43 commit 6712a58
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
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 6712a58

Please sign in to comment.