Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/en/appendices/5-0-upgrade-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ First, check that your application is running on latest CakePHP 4.x version.

Once your application is running on latest CakePHP 4.x, enable deprecation warnings in **config/app.php**:

``` text
``` php
'Error' => [
'errorLevel' => E_ALL,
]
Expand Down Expand Up @@ -49,7 +49,7 @@ composer install --no-dev
With the upgrade tool installed you can now run it on your application or
plugin:

``` text
``` bash
bin/cake upgrade rector --rules cakephp50 <path/to/app/src>
bin/cake upgrade rector --rules chronos3 <path/to/app/src>
```
Expand Down
2 changes: 1 addition & 1 deletion docs/en/appendices/5-1-migration-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The [upgrade tool](../appendices/migration-guides) provides rector rules for
automating some of the migration work. Run rector before updating your
`composer.json` dependencies:

``` text
``` bash
bin/cake upgrade rector --rules cakephp51 <path/to/app/src>
```

Expand Down
2 changes: 1 addition & 1 deletion docs/en/appendices/5-2-migration-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The [upgrade tool](../appendices/migration-guides) provides rector rules for
automating some of the migration work. Run rector before updating your
`composer.json` dependencies:

``` text
``` bash
bin/cake upgrade rector --rules cakephp52 <path/to/app/src>
```

Expand Down
2 changes: 1 addition & 1 deletion docs/en/appendices/5-3-migration-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The [upgrade tool](../appendices/migration-guides) provides rector rules for
automating some of the migration work. Run rector before updating your
`composer.json` dependencies:

``` text
``` bash
bin/cake upgrade rector --rules cakephp53 <path/to/app/src>
```

Expand Down
6 changes: 3 additions & 3 deletions docs/en/appendices/glossary.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ columns. Often used in conjunction with the FormHelper.
HTML attributes
An array of key =\> values that are composed into HTML attributes. For example:

``` text
``` php
// Given
['class' => 'my-class', 'target' => '_blank']

Expand All @@ -67,7 +67,7 @@ class="my-class" target="_blank"
If an option can be minimized or accepts its name as the value, then `true`
can be used:

``` text
``` php
// Given
['checked' => true]

Expand All @@ -87,7 +87,7 @@ plugin syntax
Plugin syntax refers to the dot separated class name indicating classes
are part of a plugin:

``` text
``` php
// The plugin is "DebugKit", and the class name is "Toolbar".
'DebugKit.Toolbar'

Expand Down
2 changes: 1 addition & 1 deletion docs/en/appendices/migration-guides.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ method renames and signature updates.

To use the upgrade tool:

``` text
``` bash
# Install the upgrade tool
git clone https://github.com/cakephp/upgrade
cd upgrade
Expand Down
2 changes: 1 addition & 1 deletion docs/en/console-commands/cache.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
To help you better manage cached data from a CLI environment, a console command
is available for clearing cached data your application has:

``` text
``` bash
// Clear one cache config
bin/cake cache clear <configname>

Expand Down
2 changes: 1 addition & 1 deletion docs/en/console-commands/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ CakePHP will use conventions to generate the name your commands use on the
command line. If you want to overwrite the generated name implement the
`defaultName()` method in your command:

``` text
``` php
public static function defaultName(): string
{
return 'oh_hi';
Expand Down
2 changes: 1 addition & 1 deletion docs/en/contributing/backwards-compatibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ locate code that needs to be updated before it breaks. If you wish to disable
runtime warnings you can do so using the `Error.errorLevel` configuration
value:

``` text
``` php
// in config/app.php
// ...
'Error' => [
Expand Down
18 changes: 9 additions & 9 deletions docs/en/contributing/cakephp-coding-conventions.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Four spaces will be used for indentation.

So, indentation should look like this:

``` text
``` php
// base level
// level 1
// level 2
Expand Down Expand Up @@ -98,7 +98,7 @@ In short:
Control structures are for example "`if`", "`for`", "`foreach`",
"`while`", "`switch`" etc. Below, an example with "`if`":

``` text
``` php
if ((expr_1) || (expr_2)) {
// action_1;
} elseif (!(expr_3) && (expr_4)) {
Expand Down Expand Up @@ -368,7 +368,7 @@ tags:
PhpDoc tags are very much like JavaDoc tags in Java. Tags are only processed if
they are the first thing in a DocBlock line, for example:

``` text
``` php
/**
* Tag example.
*
Expand All @@ -377,7 +377,7 @@ they are the first thing in a DocBlock line, for example:
*/
```

``` text
``` php
/**
* Example of inline phpDoc tags.
*
Expand Down Expand Up @@ -467,7 +467,7 @@ public function foo()
`include`, `require`, `include_once` and `require_once` do not have
parentheses:

``` text
``` php
// wrong = parentheses
require_once('ClassFileName.php');
require_once ($class);
Expand All @@ -491,7 +491,7 @@ The short echo should be used in template files in place of `<?php echo`. It
should be immediately followed by a single space, the variable or function value
to `echo`, a single space, and the php closing tag:

``` text
``` php
// wrong = semicolon, no spaces
<td><?=$name;?></td>

Expand Down Expand Up @@ -593,22 +593,22 @@ of `floatval($var)` when applicable.

Constants should be defined in capital letters:

``` text
``` php
define('CONSTANT', 1);
```

If a constant name consists of multiple words, they should be separated by an
underscore character, for example:

``` text
``` php
define('LONG_NAMED_CONSTANT', 2);
```

### Enums

Enum cases are defined in `CamelCase` style:

``` text
``` php
enum ArticleStatus: string
{
case Published = 'Y';
Expand Down
10 changes: 5 additions & 5 deletions docs/en/contributing/code.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ is for. For example if you are fixing a bug in `3.x` you would want to use the
`master` branch as the base for your branch. If your change is a bug fix for
the 2.x release series, you should use the `2.x` branch:

``` text
``` bash
# fixing a bug on 3.x
git fetch upstream
git checkout -b ticket-1234 upstream/master
Expand Down Expand Up @@ -80,7 +80,7 @@ following:
Once your changes are done and you're ready for them to be merged into CakePHP,
you'll want to update your branch:

``` text
``` bash
# Rebase fix on top of master
git checkout master
git fetch upstream
Expand All @@ -95,20 +95,20 @@ code. You might encounter a conflict during the `rebase`. If the rebase quits
early you can see which files are conflicted/un-merged with `git status`.
Resolve each conflict, and then continue the rebase:

``` text
``` bash
git add <filename> # do this for each conflicted file.
git rebase --continue
```

Check that all your tests continue to pass. Then push your branch to your fork:

``` text
``` bash
git push origin <branch-name>
```

If you've rebased after pushing your branch, you'll need to use force push:

``` text
``` bash
git push --force origin <branch-name>
```

Expand Down
22 changes: 11 additions & 11 deletions docs/en/controllers/middleware/rate-limit.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ new RateLimitMiddleware([
The middleware automatically handles proxy headers. You can configure
which headers to check using the `ipHeader` option:

``` text
``` php
new RateLimitMiddleware([
'identifier' => RateLimitMiddleware::IDENTIFIER_IP,
'ipHeader' => ['CF-Connecting-IP', 'X-Forwarded-For'],
Expand All @@ -103,7 +103,7 @@ new RateLimitMiddleware([

Track requests per authenticated user:

``` text
``` php
new RateLimitMiddleware([
'identifier' => RateLimitMiddleware::IDENTIFIER_USER,
'limit' => 1000,
Expand All @@ -118,7 +118,7 @@ The middleware checks for users implementing `Authentication\IdentityInterface`.

Apply different limits to different routes:

``` text
``` php
new RateLimitMiddleware([
'identifier' => RateLimitMiddleware::IDENTIFIER_ROUTE,
'limit' => 10,
Expand All @@ -132,7 +132,7 @@ This creates separate limits for each controller/action combination.

Track requests by API key or token:

``` text
``` php
new RateLimitMiddleware([
'identifier' => RateLimitMiddleware::IDENTIFIER_API_KEY,
'limit' => 5000,
Expand All @@ -143,7 +143,7 @@ new RateLimitMiddleware([
By default, the middleware looks for tokens in the `Authorization` and
`X-API-Key` headers. You can customize which headers to check:

``` text
``` php
new RateLimitMiddleware([
'identifier' => RateLimitMiddleware::IDENTIFIER_TOKEN,
'tokenHeaders' => ['Authorization', 'X-API-Key', 'X-Auth-Token'],
Expand Down Expand Up @@ -171,7 +171,7 @@ new RateLimitMiddleware([
The default strategy that provides smooth rate limiting by continuously
adjusting the window based on request timing:

``` text
``` php
new RateLimitMiddleware([
'strategy' => RateLimitMiddleware::STRATEGY_SLIDING_WINDOW,
])
Expand All @@ -181,7 +181,7 @@ new RateLimitMiddleware([

Resets the counter at fixed intervals:

``` text
``` php
new RateLimitMiddleware([
'strategy' => RateLimitMiddleware::STRATEGY_FIXED_WINDOW,
])
Expand All @@ -191,7 +191,7 @@ new RateLimitMiddleware([

Allows for burst capacity while maintaining an average rate:

``` text
``` php
new RateLimitMiddleware([
'strategy' => RateLimitMiddleware::STRATEGY_TOKEN_BUCKET,
'limit' => 100, // bucket capacity
Expand All @@ -204,7 +204,7 @@ new RateLimitMiddleware([
You can use a custom rate limiter strategy by specifying the `strategyClass`
option. Your class must implement `Cake\Http\RateLimiter\RateLimiterInterface`:

``` text
``` php
new RateLimitMiddleware([
'strategyClass' => App\RateLimiter\MyCustomRateLimiter::class,
])
Expand Down Expand Up @@ -367,7 +367,7 @@ $middlewareQueue->add(new RateLimitMiddleware([
The rate limiter stores its data in cache. Make sure you have a persistent
cache configured:

``` text
``` php
// In config/app.php
'Cache' => [
'rate_limit' => [
Expand All @@ -380,7 +380,7 @@ cache configured:

Then use it in the middleware:

``` text
``` php
new RateLimitMiddleware([
'cache' => 'rate_limit',
])
Expand Down
2 changes: 1 addition & 1 deletion docs/en/core-libraries/email.md
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ is useful for debugging. Configuring transports allows you to keep configuration
data out of your application code and makes deployment simpler as you can simply
change the configuration data. An example transport configuration looks like:

``` text
``` php
// In config/app.php
'EmailTransport' => [
// Sample Mail configuration
Expand Down
6 changes: 3 additions & 3 deletions docs/en/core-libraries/global-constants-and-functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ convenience wrappers for other CakePHP functionality, such as debugging and
translating content. By default only namespaced functions are autoloaded,
however you can optionally load global aliases by adding:

``` text
``` php
require CAKE . 'functions.php';
```

Expand All @@ -32,13 +32,13 @@ This function handles localization in CakePHP applications. The
`$string_id` identifies the ID for a translation. You can supply
additional arguments to replace placeholders in your string:

``` text
``` php
__('You have {0} unread messages', $number);
```

You can also provide a name-indexed array of replacements:

``` text
``` php
__('You have {unread} unread messages', ['unread' => $number]);
```

Expand Down
Loading