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/console-commands/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ The `beforeExecute()` and `afterExecute()` hook methods were added.

### beforeExecute()

`method` Cake\\Console\\Command::**beforeExecute**(EventInterface $event, Arguments $args, ConsoleIo $io)
`method` Cake\\Console\\Command::**beforeExecute**(EventInterface $event, Arguments $args, ConsoleIo $io): void

Called before the `execute()` method runs. Useful for initialization and
validation:
Expand All @@ -644,7 +644,7 @@ class MyCommand extends Command

### afterExecute()

`method` Cake\\Console\\Command::**afterExecute**(EventInterface $event, Arguments $args, ConsoleIo $io)
`method` Cake\\Console\\Command::**afterExecute**(EventInterface $event, Arguments $args, ConsoleIo $io): void

Called after the `execute()` method completes. Useful for cleanup and
logging:
Expand Down
4 changes: 2 additions & 2 deletions docs/en/console-commands/input-output.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ The `BannerHelper` was added in 5.1

## Getting User Input

`method` Cake\\Console\\ConsoleIo::**ask**($question, $choices = null, $default = null)
`method` Cake\\Console\\ConsoleIo::**ask**($question, $choices = null, $default = null): string

When building interactive console applications you'll need to get user input.
CakePHP provides a way to do this:
Expand All @@ -198,7 +198,7 @@ Selection validation is case-insensitive.

## Creating Files

`method` Cake\\Console\\ConsoleIo::**createFile**($path, $contents)
`method` Cake\\Console\\ConsoleIo::**createFile**($path, $contents): bool

Creating files is often important part of many console commands that help
automate development and deployment. The `createFile()` method gives you
Expand Down
2 changes: 1 addition & 1 deletion docs/en/console-commands/option-parsers.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ included its default value would be `false`, and when defined it will be

### Building a ConsoleOptionParser from an Array

`method` Cake\\Console\\ConsoleOptionParser::**buildFromArray**($spec)
`method` Cake\\Console\\ConsoleOptionParser::**buildFromArray**($spec): static

Option parsers can also be defined as arrays. Within the array, you can define
keys for `arguments`, `options`, `description` and `epilog`. The values
Expand Down
8 changes: 4 additions & 4 deletions docs/en/controllers.md
Original file line number Diff line number Diff line change
Expand Up @@ -561,15 +561,15 @@ methods are implemented by your controllers

#### beforeFilter()

`method` Cake\\Controller\\Controller::**beforeFilter**(EventInterface $event)
`method` Cake\\Controller\\Controller::**beforeFilter**(EventInterface $event): void

#### beforeRender()

`method` Cake\\Controller\\Controller::**beforeRender**(EventInterface $event)
`method` Cake\\Controller\\Controller::**beforeRender**(EventInterface $event): void

#### afterFilter()

`method` Cake\\Controller\\Controller::**afterFilter**(EventInterface $event)
`method` Cake\\Controller\\Controller::**afterFilter**(EventInterface $event): void

In addition to controller life-cycle callbacks, [Components](controllers/components)
also provide a similar set of callbacks.
Expand Down Expand Up @@ -612,7 +612,7 @@ As of 4.1.0 you can also raise a `RedirectException` to signal a redirect.

## Controller Middleware

`method` Cake\\Controller\\Controller::**middleware**($middleware, array $options = [])
`method` Cake\\Controller\\Controller::**middleware**($middleware, array $options = []): void

[Middleware](controllers/middleware) can be defined globally, in
a routing scope or within a controller. To define middleware for a specific
Expand Down
10 changes: 5 additions & 5 deletions docs/en/controllers/components.md
Original file line number Diff line number Diff line change
Expand Up @@ -306,15 +306,15 @@ $controller = $this->getController();
Components also offer a few request life-cycle callbacks that allow them to
augment the request cycle.

`method` Class::**beforeFilter**(EventInterface $event)
`method` Class::**beforeFilter**(EventInterface $event): void

`method` Class::**startup**(EventInterface $event)
`method` Class::**startup**(EventInterface $event): void

`method` Class::**beforeRender**(EventInterface $event)
`method` Class::**beforeRender**(EventInterface $event): void

`method` Class::**afterFilter**(EventInterface $event)
`method` Class::**afterFilter**(EventInterface $event): void

`method` Class::**beforeRedirect**(EventInterface $event, $url, Response $response)
`method` Class::**beforeRedirect**(EventInterface $event, $url, Response $response): void

<a id="redirect-component-events"></a>

Expand Down
58 changes: 29 additions & 29 deletions docs/en/controllers/request-response.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ are also all found in the routing parameters:

### Query String Parameters

`method` Cake\\Http\\ServerRequest::**getQuery**($name, $default = null)
`method` Cake\\Http\\ServerRequest::**getQuery**($name, $default = null): mixed

Query string parameters can be read using the `getQuery()` method:

Expand Down Expand Up @@ -143,7 +143,7 @@ Casting functions were added.

### Request Body Data

`method` Cake\\Http\\ServerRequest::**getData**($name, $default = null)
`method` Cake\\Http\\ServerRequest::**getData**($name, $default = null): mixed

All POST data normally available through PHP's `$_POST` global variable can be
accessed using `Cake\Http\ServerRequest::getData()`. For example:
Expand Down Expand Up @@ -231,7 +231,7 @@ Unlike `Cake\Http\ServerRequest::getData()`, `Cake\Http\ServerRequest::getUpload
only return data when an actual file upload exists for the given path, if there is regular, non-file request body data
present at the given path, then this method will return `null`, just like it would for any non-existent path.

`method` Cake\\Http\\ServerRequest::**getUploadedFiles**()
`method` Cake\\Http\\ServerRequest::**getUploadedFiles**(): array

Returns all uploaded files in a normalized array structure. For the above example with the file input name of
`attachment`, the structure would look like:
Expand All @@ -244,7 +244,7 @@ Returns all uploaded files in a normalized array structure. For the above exampl
]
```

`method` Cake\\Http\\ServerRequest::**withUploadedFiles**(array $files)
`method` Cake\\Http\\ServerRequest::**withUploadedFiles**(array $files): static

This method sets the uploaded files of the request object, it accepts an array of objects that implement
[\Psr\Http\Message\UploadedFileInterface](https://www.php-fig.org/psr/psr-7/#16-uploaded-files). It will
Expand Down Expand Up @@ -304,7 +304,7 @@ types making the parsed data available in `$request->getData()` and

### Environment Variables (from \$\_SERVER and \$\_ENV)

`method` Cake\\Http\\ServerRequest::**getEnv**($key, $default = null)
`method` Cake\\Http\\ServerRequest::**getEnv**($key, $default = null): string|null

`ServerRequest::getEnv()` is a wrapper for `getenv()` global function and acts as
a getter for environment variables without possible undefined keys:
Expand All @@ -319,7 +319,7 @@ To access all the environment variables in a request use `getServerParams()`:
$env = $this->request->getServerParams();
```

`method` Cake\\Http\\ServerRequest::**withEnv**($key, $value)
`method` Cake\\Http\\ServerRequest::**withEnv**($key, $value): static

`ServerRequest::withEnv()` is a wrapper for `putenv()` global function and acts as
a setter for environment variables without having to modify globals
Expand Down Expand Up @@ -376,7 +376,7 @@ $base = $request->getAttribute('webroot');

### Checking Request Conditions

`method` Cake\\Http\\ServerRequest::**is**($type, $args...)
`method` Cake\\Http\\ServerRequest::**is**($type, $args...): bool

The request object provides a way to inspect certain conditions in a given
request. By using the `is()` method you can check a number of common
Expand All @@ -403,7 +403,7 @@ detectors. There are different types of detectors that you can create:
to handle the check. The callback will receive the request object as its only
parameter.

`method` Cake\\Http\\ServerRequest::**addDetector**($name, $options)
`method` Cake\\Http\\ServerRequest::**addDetector**($name, $options): void

Some examples would be:

Expand Down Expand Up @@ -500,7 +500,7 @@ to use the session object.

### Host and Domain Name

`method` Cake\\Http\\ServerRequest::**domain**($tldLength = 1)
`method` Cake\\Http\\ServerRequest::**domain**($tldLength = 1): string

Returns the domain name your application is running on:

Expand All @@ -509,7 +509,7 @@ Returns the domain name your application is running on:
echo $request->domain();
```

`method` Cake\\Http\\ServerRequest::**subdomains**($tldLength = 1)
`method` Cake\\Http\\ServerRequest::**subdomains**($tldLength = 1): array

Returns the subdomains your application is running on as an array:

Expand All @@ -518,7 +518,7 @@ Returns the subdomains your application is running on as an array:
$subdomains = $request->subdomains();
```

`method` Cake\\Http\\ServerRequest::**host**()
`method` Cake\\Http\\ServerRequest::**host**(): string|null

Returns the host your application is on:

Expand All @@ -529,7 +529,7 @@ echo $request->host();

### Reading the HTTP Method

`method` Cake\\Http\\ServerRequest::**getMethod**()
`method` Cake\\Http\\ServerRequest::**getMethod**(): string

Returns the HTTP method the request was made with:

Expand All @@ -540,7 +540,7 @@ echo $request->getMethod();

### Restricting Which HTTP method an Action Accepts

`method` Cake\\Http\\ServerRequest::**allowMethod**($methods)
`method` Cake\\Http\\ServerRequest::**allowMethod**($methods): bool

Set allowed HTTP methods. If not matched, will throw
`MethodNotAllowedException`. The 405 response will include the required
Expand Down Expand Up @@ -574,11 +574,11 @@ $hasAcceptHeader = $this->request->hasHeader('Accept');
While some apache installs don't make the `Authorization` header accessible,
CakePHP will make it available through apache specific methods as required.

`method` Cake\\Http\\ServerRequest::**referer**($local = true)
`method` Cake\\Http\\ServerRequest::**referer**($local = true): string|null

Returns the referring address for the request.

`method` Cake\\Http\\ServerRequest::**clientIp**()
`method` Cake\\Http\\ServerRequest::**clientIp**(): string

Returns the current visitor's IP address.

Expand Down Expand Up @@ -616,7 +616,7 @@ proxy.

### Checking Accept Headers

`method` Cake\\Http\\ServerRequest::**accepts**($type = null)
`method` Cake\\Http\\ServerRequest::**accepts**($type = null): array|bool

Find out which content types the client accepts, or check whether it accepts a
particular type of content.
Expand All @@ -633,7 +633,7 @@ Check for a single type:
$acceptsJson = $this->request->accepts('application/json');
```

`method` Cake\\Http\\ServerRequest::**acceptLanguage**($language = null)
`method` Cake\\Http\\ServerRequest::**acceptLanguage**($language = null): array|bool

Get all the languages accepted by the client,
or check whether a specific language is accepted.
Expand Down Expand Up @@ -731,7 +731,7 @@ tasks such as:

### Dealing with Content Types

`method` Cake\\Http\\Response::**withType**($contentType = null)
`method` Cake\\Http\\Response::**withType**($contentType = null): static

You can control the Content-Type of your application's responses with
`Cake\Http\Response::withType()`. If your application needs to deal
Expand All @@ -754,7 +754,7 @@ automatic view switching provided by [Controller Viewclasses](../controllers#con

### Sending Files

`method` Cake\\Http\\Response::**withFile**(string $path, array $options = [])
`method` Cake\\Http\\Response::**withFile**(string $path, array $options = []): static

There are times when you want to send files as responses for your requests.
You can accomplish that by using `Cake\Http\Response::withFile()`:
Expand Down Expand Up @@ -850,7 +850,7 @@ redirect location header.

### Setting the Body

`method` Cake\\Http\\Response::**withStringBody**($string)
`method` Cake\\Http\\Response::**withStringBody**($string): static

To set a string as the response body, do the following:

Expand Down Expand Up @@ -905,7 +905,7 @@ $response = $response->withBody($stream);

### Setting the Character Set

`method` Cake\\Http\\Response::**withCharset**($charset)
`method` Cake\\Http\\Response::**withCharset**($charset): static

Sets the charset that will be used in the response:

Expand All @@ -915,7 +915,7 @@ $this->response = $this->response->withCharset('UTF-8');

### Interacting with Browser Caching

`method` Cake\\Http\\Response::**withDisabledCache**()
`method` Cake\\Http\\Response::**withDisabledCache**(): static

You sometimes need to force browsers not to cache the results of a controller
action. `Cake\Http\Response::withDisabledCache()` is intended for just
Expand All @@ -933,7 +933,7 @@ public function index()
> Disabling caching from SSL domains while trying to send
> files to Internet Explorer can result in errors.

`method` Cake\\Http\\Response::**withCache**($since, $time = '+1 day')
`method` Cake\\Http\\Response::**withCache**($since, $time = '+1 day'): static

You can also tell clients that you want them to cache responses. By using
`Cake\Http\Response::withCache()`:
Expand Down Expand Up @@ -971,7 +971,7 @@ or reverse proxy caching.

#### The Cache Control Header

`method` Cake\\Http\\Response::**withSharable**($public, $time = null)
`method` Cake\\Http\\Response::**withSharable**($public, $time = null): static

Used under the expiration model, this header contains multiple indicators that
can change the way browsers or proxies use the cached content. A
Expand Down Expand Up @@ -1012,7 +1012,7 @@ the `Cache-Control` header.

#### The Expiration Header

`method` Cake\\Http\\Response::**withExpires**($time)
`method` Cake\\Http\\Response::**withExpires**($time): static

You can set the `Expires` header to a date and time after which the response
is no longer considered fresh. This header can be set using the
Expand All @@ -1030,7 +1030,7 @@ be parsed by the `DateTime` class.

#### The Etag Header

`method` Cake\\Http\\Response::**withEtag**($tag, $weak = false)
`method` Cake\\Http\\Response::**withEtag**($tag, $weak = false): static

Cache validation in HTTP is often used when content is constantly changing, and
asks the application to only generate the response contents if the cache is no
Expand Down Expand Up @@ -1073,7 +1073,7 @@ public function index()

#### The Last Modified Header

`method` Cake\\Http\\Response::**withModified**($time)
`method` Cake\\Http\\Response::**withModified**($time): static

Also, under the HTTP cache validation model, you can set the `Last-Modified`
header to indicate the date and time at which the resource was modified for the
Expand All @@ -1099,7 +1099,7 @@ public function view()

#### The Vary Header

`method` Cake\\Http\\Response::**withVary**($header)
`method` Cake\\Http\\Response::**withVary**($header): static

In some cases, you might want to serve different content using the same URL.
This is often the case if you have a multilingual page or respond with different
Expand All @@ -1114,7 +1114,7 @@ $response = $this->response->withVary('Accept-Language');

#### Sending Not-Modified Responses

`method` Cake\\Http\\Response::**isNotModified**(Request $request)
`method` Cake\\Http\\Response::**isNotModified**(Request $request): bool

Compares the cache headers for the request object with the cache header from the
response and determines whether it can still be considered fresh. If so, deletes
Expand Down
8 changes: 4 additions & 4 deletions docs/en/core-libraries/app.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ The App class is responsible for resource location and path management.

### App::className()

`static` Cake\\Core\\App::**className**($name, $type = '', $suffix = '')
`static` Cake\\Core\\App::**className**($name, $type = '', $suffix = ''): string|null

This method is used to resolve class names throughout CakePHP. It resolves
the short form names CakePHP uses and returns the fully resolved class name:
Expand All @@ -35,7 +35,7 @@ class names do not exist, `false` will be returned.

### App::path()

`static` Cake\\Core\\App::**path**(string $package, ?string $plugin = null)
`static` Cake\\Core\\App::**path**(string $package, ?string $plugin = null): array

The method returns paths set using `App.paths` app config:

Expand All @@ -50,7 +50,7 @@ The same way you can retrieve paths for `locales` and `plugins`.

### App::classPath()

`static` Cake\\Core\\App::**classPath**(string $package, ?string $plugin = null)
`static` Cake\\Core\\App::**classPath**(string $package, ?string $plugin = null): array

Used to get locations for paths based on conventions:

Expand All @@ -67,7 +67,7 @@ for.

### App::core()

`static` Cake\\Core\\App::**core**(string $package)
`static` Cake\\Core\\App::**core**(string $package): array

Used for finding the path to a package inside CakePHP:

Expand Down
Loading