Skip to content

Commit 479c2a7

Browse files
committed
readme: fixes
1 parent fb5cb8b commit 479c2a7

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

readme.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ You can also print closure as arrow function using printer:
413413

414414
```php
415415
$closure = new Nette\PhpGenerator\Closure;
416-
$closure->setBody('return $a + $b;');
416+
$closure->setBody('$a + $b');
417417
$closure->addParameter('a');
418418
$closure->addParameter('b');
419419

@@ -430,7 +430,7 @@ fn($a, $b) => $a + $b
430430
Attributes
431431
----------
432432

433-
You can add PHP 8 attributes to all classes, methods, properties, constants, functions, closures and parameters.
433+
You can add PHP 8 attributes to all classes, methods, properties, constants, enum cases, functions, closures and parameters.
434434

435435
```php
436436
$class = new Nette\PhpGenerator\ClassType('Demo');
@@ -495,7 +495,7 @@ Simple placeholders `?`
495495
$str = 'any string';
496496
$num = 3;
497497
$function = new Nette\PhpGenerator\GlobalFunction('foo');
498-
$function->addBody('return strlen(?, ?);', [$str, $num]);
498+
$function->addBody('return substr(?, ?);', [$str, $num]);
499499
echo $function;
500500
```
501501

@@ -504,7 +504,7 @@ Result:
504504
```php
505505
function foo()
506506
{
507-
return strlen('any string', 3);
507+
return substr('any string', 3);
508508
}
509509
```
510510

@@ -557,7 +557,7 @@ function foo($a)
557557
Namespace
558558
---------
559559

560-
Classes, traits and interfaces (hereinafter classes) can be grouped into namespaces ([PhpNamespace](https://api.nette.org/php-generator/Nette/PhpGenerator/PhpNamespace.html)):
560+
Classes, traits, interfaces and enums (hereinafter classes) can be grouped into namespaces ([PhpNamespace](https://api.nette.org/php-generator/Nette/PhpGenerator/PhpNamespace.html)):
561561

562562
```php
563563
$namespace = new Nette\PhpGenerator\PhpNamespace('Foo');
@@ -685,7 +685,7 @@ class A
685685
Generate using Reflection
686686
-------------------------
687687

688-
Another common use case is to create class or method based on existing ones:
688+
Another common use case is to create class or function based on existing one:
689689

690690
```php
691691
$class = Nette\PhpGenerator\ClassType::from(PDO::class);
@@ -697,7 +697,7 @@ $closure = Nette\PhpGenerator\Closure::from(
697697
);
698698
```
699699

700-
Method bodies are empty by default. If you want to load them as well, use this way
700+
Function and method bodies are empty by default. If you want to load them as well, use this way
701701
(it requires `nikic/php-parser` to be installed):
702702

703703
```php

0 commit comments

Comments
 (0)