Skip to content

Commit cb7b882

Browse files
committed
Minor fixes
1 parent dfe6981 commit cb7b882

File tree

11 files changed

+38
-38
lines changed

11 files changed

+38
-38
lines changed

guide/en/caching/data.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public function getTopProducts(\Yiisoft\Cache\CacheInterface $cache): array
1919

2020
// Try retrieving $data from cache.
2121
$data = $cache->getOrSet($key, function (\Psr\SimpleCache\CacheInterface $cache) use ($count) {
22-
// Can't find $data in cache, calculate it from scratch.
22+
// Can't find $data in a cache, calculate it from scratch.
2323
return getTopProductsFromDatabase($count);
2424
}, 3600);
2525

@@ -52,7 +52,7 @@ Yii provides the following handlers:
5252
- [File](https://github.com/yiisoft/cache-file) — uses standard files to store cached data. This is particularly suitable
5353
to cache large chunks of data, such as page content.
5454
- [Memcached](https://github.com/yiisoft/cache-memcached) — uses a PHP [memcached](https://secure.php.net/manual/en/book.memcached.php)
55-
extension. You can consider this option as the fastest one when dealing with cache in distributed application
55+
extension. You can consider this option as the fastest one when dealing with cache in a distributed application
5656
(e.g., with several servers, load balancers, etc.)
5757
- [Wincache](https://github.com/yiisoft/cache-wincache) — uses PHP [WinCache](https://iis.net/downloads/microsoft/wincache-extension)
5858
([see also](https://secure.php.net/manual/en/book.wincache.php)) extension.
@@ -107,7 +107,7 @@ The `$ttl` parameter indicates for how many seconds the data item can remain val
107107
the data item, if it has passed the expiration time, the method will execute the function and set the resulting value
108108
into cache.
109109

110-
You may set default TTL for the cache:
110+
You may set the default TTL for the cache:
111111

112112
```php
113113
$cache = new \Yiisoft\Cache\Cache($arrayCache, 60 * 60); // 1 hour
@@ -168,7 +168,7 @@ The `\Yiisoft\Cache\Cache` uses a built-in "Probably early expiration" algorithm
168168
This algorithm randomly fakes a cache miss for one user while others are still served the cached value.
169169
You can control its behavior with the fifth optional parameter of `getOrSet()`, which is a float value called `$beta`.
170170
By default, beta is `1.0`, which is usually enough.
171-
The higher the value the earlier cache will be re-created.
171+
The higher the value, the earlier cache will be re-created.
172172

173173
```php
174174
/**

guide/en/concept/di-container.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ final readonly class CachedWidget extends Cache
2828
}
2929
```
3030

31-
The issue here is that these two are becoming unnecessarily coupled or inter-dependent making them more fragile.
31+
The issue here is that these two are becoming unnecessarily coupled or inter-dependent, making them more fragile.
3232

3333
Another way to handle this is composition:
3434

guide/en/concept/immutability.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ $discounted = $price->withAmount(800);
106106
> If you define a simple DTO, you can use modern PHP `readonly` and leave properties `public`. The `readonly` keyword
107107
> would ensure that the properties cannot be modified after the object is created.
108108
109-
## Using clone (and why it is cheap)
109+
## Using clone (and why it is inexpensive)
110110

111111
PHP's clone performs a shallow copy of the object. For immutable value objects that contain only scalars
112112
or other immutable objects, shallow cloning is enough and fast. In modern PHP, cloning small value objects is

guide/en/databases/db-migrations.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ composer require yiisoft/db-migration
88

99
### Example usage
1010

11-
First, configure DI container. Create `config/common/db.php` with the following content:
11+
First, configure a DI container. Create `config/common/db.php` with the following content:
1212

1313
```php
1414
<?php
@@ -67,7 +67,7 @@ use Yiisoft\Db\Migration\RevertibleMigrationInterface;
6767
use Yiisoft\Db\Migration\TransactionalMigrationInterface;
6868

6969
/**
70-
* Handles the creation of table `my_first_table`.
70+
* Handles the creation of a table `my_first_table`.
7171
*/
7272
final class M240115143455CreateMyFirstTableTable implements RevertibleMigrationInterface, TransactionalMigrationInterface
7373
{
@@ -97,6 +97,6 @@ Migrations in Yii2 and the [yiisoft/db-migration](https://github.com/yiisoft/db-
9797
and the `migration` table is also not
9898
compatible.
9999
A probable solution is to use structure dumps and rename the old `migration` table. Upon the initial execution of
100-
migrations, a new `migration` table with new fields will be created. All subsequent changes in the database schema are
100+
migrations, a new `migration` table with new fields will be created. All further changes in the database schema are
101101
applied using the new `migration` component and recorded in the new migration table.
102102

guide/en/intro/what-is-yii.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Yii currently has three major versions available: 1.1, 2.0, and 3.0.
5151

5252
## Requirements and prerequisites
5353

54-
Yii3 requires PHP 8.2 or above, but some packages also older PHP such as PHP 7.4.
54+
Yii3 requires PHP 8.2 or above, but some packages work with older PHP, such as PHP 7.4.
5555

5656
Using Yii requires basic knowledge of object-oriented programming (OOP), as Yii is a pure OOP-based framework.
5757
Yii3 also makes use of the latest PHP features, such as type declarations and generators. Understanding these

guide/en/security/authentication.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ return [
3737

3838
// User:
3939
IdentityRepositoryInterface::class => static function (ContainerInterface $container) {
40-
// instead of Cycle-based repository, you can use any implementation
40+
// instead of a Cycle-based repository, you can use any implementation
4141
return $container->get(\Cycle\ORM\ORMInterface::class)->getRepository(\App\Entity\User::class);
4242
},
4343
];
@@ -49,7 +49,7 @@ The identity class must implement the `\Yiisoft\Auth\IdentityInterface` which ha
4949

5050
* [[yii\web\IdentityInterface::getId()|getId()]]: it returns the ID of the user represented by this identity instance.
5151

52-
In the following example, an identity class implemented as a pure PHP object.
52+
In the following example, an identity class is implemented as a pure PHP object.
5353

5454
```php
5555
<?php
@@ -131,8 +131,8 @@ final readonly class IdentityRepository implements IdentityRepositoryInterface
131131

132132
## Using `\Yiisoft\User\User` <span id="using-user"></span>
133133

134-
You can use `\Yiisoft\User\User` service to obtain current user identity.
135-
As any service, it could be auto wired in either action handler constructor or method:
134+
You can use `\Yiisoft\User\User` service to get current user identity.
135+
As any service, it could be auto-wired in either action handler constructor or method:
136136

137137
```php
138138
use \Psr\Http\Message\ServerRequestInterface;
@@ -166,7 +166,7 @@ $user->login($identity);
166166
The `login()` method sets the identity to the User service.
167167
It stores identity into session so user authentication status is maintained.
168168

169-
To logout a user, simply call
169+
To log out a user, call
170170

171171
```php
172172
/* @var $user \Yiisoft\User\User */

guide/en/security/authorization.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ You may assign a role to one or many users.
6464
To check if a user has a specified permission, you may check if the user has a role with that permission.
6565

6666
Associated with each role or permission, there may be a *rule*.
67-
A rule represents a piece of code that access checker
67+
A rule represents a piece of code that an access checker
6868
will execute to decide if the corresponding role or permission applies to the current user.
6969
For example, the "update post" permission may have a rule that checks if the current user is the post creator.
7070
During access checking, if the user is NOT the post creator, there's no "update post" permission.
@@ -99,7 +99,7 @@ return [
9999
];
100100
```
101101

102-
`\Yiisoft\Rbac\Manager\PhpManager` uses a PHP script files to store authorization data.
102+
`\Yiisoft\Rbac\Manager\PhpManager` uses PHP script files to store authorization data.
103103
The files are under `@rbac` alias.
104104
Make sure the directory and all the files in it are writable by the Web server process if you want to change permission
105105
hierarchy online.
@@ -168,7 +168,7 @@ final readonly class RbacCommand extends Command
168168
$updatePost = (new Permission('updatePost'))->withDescription('Update post');
169169
$auth->add($updatePost);
170170

171-
// add "author" role and give this role the "createPost" permission
171+
// add the "author" role and give this role the "createPost" permission
172172
$author = new Role('author');
173173
$auth->add($author);
174174
$auth->addChild($author, $createPost);
@@ -230,7 +230,7 @@ class m170124_084304_init_rbac extends Migration
230230
$updatePost = (new Permission('updatePost'))->withDescription('Update post');
231231
$auth->add($updatePost);
232232

233-
// add "author" role and give this role the "createPost" permission
233+
// add the "author" role and give this role the "createPost" permission
234234
$author = new Role('author');
235235
$auth->add($author);
236236
$auth->addChild($author, $createPost);
@@ -266,10 +266,10 @@ You could apply migration by using `./yii migrate`.
266266

267267
TODO: update when signup implemented in demo / template.
268268

269-
The author can create a post, admin can update post and do everything the author can.
269+
The author can create a post, admin can update the post and do everything the author can.
270270

271-
If your application allows user signup, you need to assign roles to these new users once.
272-
For example, in order for all signed-up users to become authors in your advanced project template you need
271+
If your application allows user signup, you need to assign roles to these new users at once.
272+
For example, in order for all signed-up users to become authors in your advanced project template, you need
273273
to change `frontend\models\SignupForm::signup()` as follows:
274274

275275
```php
@@ -314,7 +314,7 @@ use Yiisoft\Rbac\Item;
314314
use \Yiisoft\Rbac\Rule;
315315

316316
/**
317-
* Checks if authorID matches user passed via params.
317+
* Checks if the authorID matches user passed via params.
318318
*/
319319
final readonly class AuthorRule extends Rule
320320
{
@@ -360,7 +360,7 @@ Now you've got the following hierarchy:
360360

361361
### Access check <span id="access-check"></span>
362362

363-
The check is done similar to how it was done in the first section of this guide:
363+
The check is done similarly to how it was done in the first section of this guide:
364364

365365
```php
366366
namespace App\Blog\Post;
@@ -396,7 +396,7 @@ final readonly class PostController
396396
}
397397
```
398398

399-
The difference is that now checking for user's own post is part of the RBAC.
399+
The difference is that now checking for a user's own post is part of the RBAC.
400400

401401
If the current user is Jane with `ID=1` you are starting at `createPost` and trying to get to `Jane`:
402402

guide/en/structure/middleware.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ as follows:
2121

2222
## Using middleware
2323

24-
Any PSR-15 compatible middleware could be used with Yii and there are many.
25-
Say, you need to add basic authentication
26-
one of the application URLs. URL-dependent middleware is configured using router, so you need to change router factory.
24+
Any [PSR-15](https://www.php-fig.org/psr/psr-15/) compatible middleware could be used with Yii, and there are many.
25+
Say, you need to add basic authentication to one of the application URLs.
26+
URL-dependent middleware is configured using router, so you need to change the router factory.
2727

2828
Authentication middleware is implemented by `middlewares/http-authentication` package so execute
2929
`composer require middlewares/http-authentication` in the application root directory.
@@ -68,7 +68,7 @@ When configuring routing, you're binding `/basic-auth` URL to a chain of middlew
6868
authentication, and the action itself. A chain is a special middleware that executes all the middleware it's configured
6969
with.
7070

71-
The action itself may be the following:
71+
The action itself could be the following:
7272

7373
```php
7474
public function auth(ServerRequestInterface $request): ResponseInterface
@@ -113,9 +113,9 @@ To create middleware, you need to implement a single `process` method of `Psr\Ht
113113
public function process(ServerRequestInterface $request, RequestHandlerInterface $next): ResponseInterface;
114114
```
115115

116-
There are multiple ways to handle request and choosing one depends on what the middleware should achieve.
116+
There are multiple ways to handle a request, and choosing one depends on what the middleware should achieve.
117117

118-
### Forming response directly
118+
### Forming a response directly
119119

120120
To respond directly, one needs a response factory passed via constructor:
121121

@@ -148,8 +148,8 @@ final readonly class RespondingMiddleware implements MiddlewareInterface
148148

149149
### Delegating handling to the next middleware
150150

151-
If middleware either isn't intended form response / change request or can't do it this time, handling could be
152-
left to the next middleware in the stack:
151+
If middleware either isn't intended to form a response or change the request or can't do anything this time,
152+
handling could be left to the next middleware in the stack:
153153

154154
```php
155155
return $next->handle($request);
@@ -170,7 +170,7 @@ $answer = $request->getAttribute('answer');
170170

171171
### Capturing response to manipulate it
172172

173-
You may want to capture response to manipulate it. It could be useful for adding CORS headers, gzipping content etc.
173+
You may want to capture the response to manipulate it. It could be useful for adding CORS headers, gzipping content, etc.
174174

175175
```php
176176
$response = $next->handle($request);

guide/en/tutorial/performance-tuning.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ A well-configured PHP environment is important. To get maximum performance:
1111

1212
- Use the latest stable PHP version. Major releases of PHP may bring significant performance improvements.
1313
- Enable bytecode caching with [Opcache](https://secure.php.net/opcache).
14-
Bytecode caching avoids the time spent in parsing and including PHP scripts for every incoming request.
14+
Bytecode caching avoids the time spent on parsing and including PHP scripts for every incoming request.
1515
- [Tune `realpath()` cache](https://github.com/samdark/realpath_cache_tuner).
1616
- Make sure [XDebug](https://xdebug.org/) isn't installed in the production environment.
1717
- Try [PHP 7 preloading](https://wiki.php.net/rfc/preload).
@@ -134,7 +134,7 @@ was used with the following run parameters:
134134
ab -n 1000 -c 10 -t 10
135135
```
136136

137-
Also, the debug mode was disabled. And an optimized autoloader of the [Composer](https://getcomposer.org) was used
137+
Also, the debug mode was disabled. And an optimized autoloader of the [Composer](https://getcomposer.org) was used,
138138
and development dependencies weren't used:
139139

140140
```shell

guide/en/tutorial/using-with-event-loop.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ in the state of a service made by the previous request may affect the current re
4040
if data from one user is available to another user.
4141

4242
There are two ways of dealing with it. First, you can avoid having state by making services stateless. PHP's `readonly`
43-
keyword may be handy for it. Second, you can reset services state at the end of the request processing.
43+
keyword may be handy for it. Second, you can reset the services' state at the end of the request processing.
4444
In this case, a state resetter will help you:
4545

4646
```php

0 commit comments

Comments
 (0)