Skip to content

Commit 148d933

Browse files
committed
Fix code examples and typos.
- Fix missing $httpClient constructor injection in DI example. - Fix deprecated order() to orderBy() in DI example. - Fix string literal instead of variable in errors.md example. - Fix no-op $this->response statement in request-response.md. - Fix typos in internationalization docs.
1 parent 1620e4d commit 148d933

File tree

4 files changed

+11
-9
lines changed

4 files changed

+11
-9
lines changed

docs/en/controllers/request-response.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1078,7 +1078,7 @@ public function view()
10781078
if ($response->isNotModified($this->request)) {
10791079
return $response;
10801080
}
1081-
$this->response;
1081+
$this->response = $response;
10821082
// ...
10831083
}
10841084
```

docs/en/core-libraries/internationalization-and-localization.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ of characters between the first and last character.
1414
## Setting Up Translations
1515

1616
There are only a few steps to go from a single-language application to a
17-
multi-lingual application, the first of which is to make use of the
17+
multilingual application, the first of which is to make use of the
1818
`__()` function in your code. Below is an example of some code for a
1919
single-language application:
2020

@@ -59,7 +59,7 @@ is selected.
5959

6060
The core strings messages extracted from the CakePHP library can be stored
6161
separately in a file named **cake.po** in `resources/locales/`.
62-
The [CakePHP localized library](https://github.com/cakephp/localized) houses
62+
The [CakePHP Localized plugin](https://github.com/cakephp/localized) houses
6363
translations for the client-facing translated strings in the core (the cake
6464
domain). To use these files, link or copy them into their expected location:
6565
`resources/locales/<locale>/cake.po`. If your locale is incomplete or incorrect,
@@ -78,7 +78,7 @@ messages:
7878
de/
7979
my_plugin.po
8080

81-
Translation folders can be the two or three letter ISO code of the language or
81+
Translation folders can be the two or three-letter ISO code of the language or
8282
the full ICU locale name such as `fr_FR`, `es_AR`, `da_DK` which contains
8383
both the language and the country where it is spoken.
8484

@@ -479,7 +479,7 @@ I18n::setTranslator(
479479

480480
It is possible to continue using the same conventions CakePHP uses, but use
481481
a message parser other than `PoFileParser`. For example, if you wanted to load
482-
translation messages using `YAML`, you will first need to created the parser
482+
translation messages using `YAML`, you will first need to create the parser
483483
class:
484484

485485
``` php
@@ -642,7 +642,7 @@ Make sure you read the [Date & Time](../core-libraries/time) and [Number](../cor
642642
sections to learn more about formatting options.
643643

644644
By default, dates returned for the ORM results use the `Cake\I18n\DateTime` class,
645-
so displaying them directly in you application will be affected by changing the
645+
so displaying them directly in your application will be affected by changing the
646646
current locale.
647647

648648
<a id="parsing-localized-dates"></a>

docs/en/development/dependency-injection.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -914,7 +914,7 @@ class UserRepository
914914
{
915915
return $this->users->find()
916916
->where(['active' => true])
917-
->order(['created' => 'DESC']);
917+
->orderBy(['created' => 'DESC']);
918918
}
919919

920920
public function findByRole(string $role): SelectQuery
@@ -1022,13 +1022,15 @@ Inject configuration values using the `Configure` attribute:
10221022
namespace App\Service;
10231023

10241024
use Cake\Core\Attribute\Configure;
1025+
use Cake\Http\Client;
10251026

10261027
class ApiClientService
10271028
{
10281029
public function __construct(
10291030
#[Configure('Api.key')] private string $apiKey,
10301031
#[Configure('Api.endpoint')] private string $endpoint,
1031-
private LoggerInterface $logger
1032+
private LoggerInterface $logger,
1033+
private Client $httpClient,
10321034
) {
10331035
}
10341036

docs/en/development/errors.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ public function view($id = null)
470470
if (!$article) {
471471
throw new NotFoundException(__('Article not found'));
472472
}
473-
$this->set('article', 'article');
473+
$this->set(compact('article'));
474474
$this->viewBuilder()->setOption('serialize', ['article']);
475475
}
476476
```

0 commit comments

Comments
 (0)