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/input-output.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ The `BannerHelper` was added in 5.1

## Getting User Input

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

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

## Creating Files

`method` Cake\\Console\\ConsoleIo::**createFile**($path, $contents): bool
`method` Cake\\Console\\ConsoleIo::**createFile**(string $path, string $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
46 changes: 23 additions & 23 deletions docs/en/controllers/request-response.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ are also all found in the routing parameters:

### Query String Parameters

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

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

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

### Request Body Data

`method` Cake\\Http\\ServerRequest::**getData**($name, $default = null): mixed
`method` Cake\\Http\\ServerRequest::**getData**(?string $name = null, mixed $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 @@ -210,7 +210,7 @@ necessary. In an CLI environment, where the concept of uploading files doesn't
exist, it will allow to move the file that you've referenced irrespective of its
origins, which makes testing file uploads possible.

`method` Cake\\Http\\ServerRequest::**getUploadedFile**($path): UploadedFileInterface|null
`method` Cake\\Http\\ServerRequest::**getUploadedFile**(string $path): UploadedFileInterface|null

Returns the uploaded file at a specific path. The path uses the same dot syntax as the
`Cake\Http\ServerRequest::getData()` method:
Expand Down Expand Up @@ -296,7 +296,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): string|null
`method` Cake\\Http\\ServerRequest::**getEnv**(string $key, ?string $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 @@ -311,7 +311,7 @@ To access all the environment variables in a request use `getServerParams()`:
$env = $this->request->getServerParams();
```

`method` Cake\\Http\\ServerRequest::**withEnv**($key, $value): static
`method` Cake\\Http\\ServerRequest::**withEnv**(string $key, string $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 @@ -368,7 +368,7 @@ $base = $request->getAttribute('webroot');

### Checking Request Conditions

`method` Cake\\Http\\ServerRequest::**is**($type, $args...): bool
`method` Cake\\Http\\ServerRequest::**is**(array|string $type, mixed ...$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 @@ -395,7 +395,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): void
`method` Cake\\Http\\ServerRequest::**addDetector**(string $name, Closure|array $options): void

Some examples would be:

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

### Host and Domain Name

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

Returns the domain name your application is running on:

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

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

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

Expand Down Expand Up @@ -532,7 +532,7 @@ echo $request->getMethod();

### Restricting Which HTTP method an Action Accepts

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

Set allowed HTTP methods. If not matched, will throw
`MethodNotAllowedException`. The 405 response will include the required
Expand Down Expand Up @@ -566,7 +566,7 @@ $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): string|null
`method` Cake\\Http\\ServerRequest::**referer**(bool $local = true): string|null

Returns the referring address for the request.

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

### Checking Accept Headers

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

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

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

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

### Dealing with Content Types

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

You can control the Content-Type of your application's responses with
`Cake\Http\Response::withType()`. If your application needs to deal
Expand Down Expand Up @@ -836,7 +836,7 @@ redirect location header.

### Setting the Body

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

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

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

### Setting the Character Set

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

Sets the charset that will be used in the response:

Expand Down Expand Up @@ -919,7 +919,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'): static
`method` Cake\\Http\\Response::**withCache**(string $since, string $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 @@ -957,7 +957,7 @@ or reverse proxy caching.

#### The Cache Control Header

`method` Cake\\Http\\Response::**withSharable**($public, $time = null): static
`method` Cake\\Http\\Response::**withSharable**(bool $public, ?int $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 @@ -998,7 +998,7 @@ the `Cache-Control` header.

#### The Expiration Header

`method` Cake\\Http\\Response::**withExpires**($time): static
`method` Cake\\Http\\Response::**withExpires**(DateTimeInterface|string $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 @@ -1016,7 +1016,7 @@ be parsed by the `DateTime` class.

#### The Etag Header

`method` Cake\\Http\\Response::**withEtag**($tag, $weak = false): static
`method` Cake\\Http\\Response::**withEtag**(string $tag, bool $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 @@ -1059,7 +1059,7 @@ public function index()

#### The Last Modified Header

`method` Cake\\Http\\Response::**withModified**($time): static
`method` Cake\\Http\\Response::**withModified**(DateTimeInterface|string $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 @@ -1085,7 +1085,7 @@ public function view()

#### The Vary Header

`method` Cake\\Http\\Response::**withVary**($header): static
`method` Cake\\Http\\Response::**withVary**(string $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 @@ -1100,7 +1100,7 @@ $response = $this->response->withVary('Accept-Language');

#### Sending Not-Modified Responses

`method` Cake\\Http\\Response::**isNotModified**(Request $request): bool
`method` Cake\\Http\\Response::**isNotModified**(ServerRequest $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
14 changes: 7 additions & 7 deletions docs/en/core-libraries/caching.md
Original file line number Diff line number Diff line change
Expand Up @@ -672,19 +672,19 @@ The required API for a CacheEngine is

`class` Cake\\Cache\\**CacheEngine**

`method` Cake\\Cache\\CacheEngine::**write**($key, $value)
`method` Cake\\Cache\\CacheEngine::**write**(string $key, mixed $value, DateInterval|int|null $ttl = null): bool

`method` Cake\\Cache\\CacheEngine::**read**($key)
`method` Cake\\Cache\\CacheEngine::**read**(string $key, mixed $default = null): mixed

`method` Cake\\Cache\\CacheEngine::**delete**($key): bool
`method` Cake\\Cache\\CacheEngine::**delete**(string $key): bool

`method` Cake\\Cache\\CacheEngine::**clear**($check): bool
`method` Cake\\Cache\\CacheEngine::**clear**(): bool

`method` Cake\\Cache\\CacheEngine::**clearGroup**($group): bool
`method` Cake\\Cache\\CacheEngine::**clearGroup**(string $group): bool

`method` Cake\\Cache\\CacheEngine::**decrement**($key, $offset = 1): int|false
`method` Cake\\Cache\\CacheEngine::**decrement**(string $key, int $offset = 1): int|false

`method` Cake\\Cache\\CacheEngine::**increment**($key, $offset = 1): int|false
`method` Cake\\Cache\\CacheEngine::**increment**(string $key, int $offset = 1): int|false

## Cache Events

Expand Down
4 changes: 2 additions & 2 deletions docs/en/core-libraries/email.md
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ you want the filenames to appear in the recipient's mail client:

### Mailer::addAttachment()

`method` Cake\\Mailer\\Mailer::**addAttachment**(\\Psr\\Http\\Message\\UploadedFileInterface|string $path, ?string $name, ?string $mimetype, ?string $contentId, ?bool $contentDisposition)
`method` Cake\\Mailer\\Mailer::**addAttachment**(\\Psr\\Http\\Message\\UploadedFileInterface|string $path, ?string $name = null, ?string $mimetype = null, ?string $contentId = null, ?bool $contentDisposition = null): static

You can also add attachments using the `addAttachment()` method.

Expand Down Expand Up @@ -546,7 +546,7 @@ query string arguments.

### Mailer::drop()

`static` Cake\\Mailer\\Mailer::**drop**($key)
`static` Cake\\Mailer\\Mailer::**drop**(string $config): bool

Once configured, transports cannot be modified. In order to modify a transport
you must first drop it and then reconfigure it.
Expand Down
2 changes: 1 addition & 1 deletion docs/en/core-libraries/httpclient.md
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ $this->mockClientDelete(/* ... */);

### Response::newClientResponse()

`method` Cake\\Http\\TestSuite\\Response::**newClientResponse**(int $code = 200, array $headers = [], string $body = '')
`method` Cake\\Http\\TestSuite\\Response::**newClientResponse**(int $code = 200, array $headers = [], string $body = ''): Cake\\Http\\Client\\Response

As seen above you can use the `newClientResponse()` method to create responses
for the requests your application will make. The headers need to be a list of
Expand Down
2 changes: 1 addition & 1 deletion docs/en/core-libraries/logging.md
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ appropriate log level.

### Log::log()

`method` Cake\\Log\\Log::**log**($msg, $level = LOG_ERR): bool
`method` Cake\\Log\\Log::**log**(string $msg, string|int $level = LOG_ERR): bool

## Using Monolog

Expand Down
10 changes: 5 additions & 5 deletions docs/en/development/debugging.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ The `Debugger.editorBasePath` configure option was added.

## Outputting Values

`static` Cake\\Error\\Debugger::**dump**($var, $depth = 3): void
`static` Cake\\Error\\Debugger::**dump**(mixed $var, int $maxDepth = 3): void

Dump prints out the contents of a variable. It will print out all
properties and methods (if any) of the supplied variable:
Expand Down Expand Up @@ -118,7 +118,7 @@ output masks.

## Logging With Stack Traces

`static` Cake\\Error\\Debugger::**log**($var, $level = 7, $depth = 3): void
`static` Cake\\Error\\Debugger::**log**(mixed $var, string|int $level = 'debug', int $maxDepth = 3): void

Creates a detailed stack trace log at the time of invocation. The
`log()` method prints out data similar to that done by
Expand All @@ -128,7 +128,7 @@ writable by the web server for `log()` to work correctly.

## Generating Stack Traces

`static` Cake\\Error\\Debugger::**trace**($options): array|string
`static` Cake\\Error\\Debugger::**trace**(array $options = []): array|string

Returns the current stack trace. Each line of the trace includes
the calling method, including which file and line the call
Expand All @@ -151,7 +151,7 @@ the order of currently running functions (stack frames).

## Getting an Excerpt From a File

`static` Cake\\Error\\Debugger::**excerpt**($file, $line, $context): array
`static` Cake\\Error\\Debugger::**excerpt**(string $file, int $line, int $context = 2): array

Grab an excerpt from the file at `$path` (which is an absolute
filepath), highlights line number `$line` with `$context` number of
Expand All @@ -176,7 +176,7 @@ Although this method is used internally, it can be handy if you're
creating your own error messages or log entries for custom
situations.

`static` Debugger::**getType**($var): string
`static` Cake\\Error\\Debugger::**getType**(mixed $var): string

Get the type of a variable. Objects will return their class name

Expand Down
2 changes: 1 addition & 1 deletion docs/en/development/errors.md
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ In addition, CakePHP uses the following exceptions:
These exception classes all extend `Exception`.
By extending Exception, you can create your own 'framework' errors.

`method` Class::**responseHeader**($header = null, $value = null)
`method` Cake\\Http\\Exception\\HttpException::**setHeader**(string $header, array|string|null $value = null): void

All Http and Cake exceptions extend the Exception class, which has a method
to add headers to the response. For instance when throwing a 405
Expand Down
14 changes: 7 additions & 7 deletions docs/en/development/routing.md
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ named. Nameless routes will not have the `_namePrefix` applied to them.

### Prefix Routing

`static` Cake\\Routing\\RouteBuilder::**prefix**($name, $callback)
`static` Cake\\Routing\\RouteBuilder::**prefix**(string $name, Closure|array $params = [], ?Closure $callback = null): static

Many applications require an administration section where
privileged users can make changes. This is often done through a
Expand Down Expand Up @@ -824,7 +824,7 @@ This would link to a controller with the namespace `App\Controller\Admin\MyPrefi

### Plugin Routing

`static` Cake\\Routing\\RouteBuilder::**plugin**($name, $options = [], $callback)
`static` Cake\\Routing\\RouteBuilder::**plugin**(string $name, Closure|array $options = [], ?Closure $callback = null): static

Routes for [Plugins](../plugins) should be created using the `plugin()`
method. This method creates a new routing scope for the plugin's routes:
Expand Down Expand Up @@ -987,7 +987,7 @@ echo Router::url([

### Routing File Extensions

`method` Cake\\Routing\\RouteBuilder::**setExtensions**(array|string $extensions)
`method` Cake\\Routing\\RouteBuilder::**setExtensions**(array|string $extensions): static

To handle different file extensions in your URLs, you can define the extensions
using the `Cake\Routing\RouteBuilder::setExtensions()` method:
Expand Down Expand Up @@ -1410,9 +1410,9 @@ Since `5` has a numeric key, it is treated as a passed argument.

## Generating URLs

`static` Cake\\Routing\\RouteBuilder::**url**($url = null, $full = false)
`static` Cake\\Routing\\Router::**url**(Psr\\Http\\Message\\UriInterface|array|string|null $url = null, bool $full = false): string

`static` Cake\\Routing\\RouteBuilder::**reverse**($params, $full = false)
`static` Cake\\Routing\\Router::**reverse**(Cake\\Http\\ServerRequest|array $params, bool $full = false): string

Generating URLs or Reverse routing is a feature in CakePHP that is used to
allow you to change your URL structure without having to modify all your code.
Expand Down Expand Up @@ -1793,7 +1793,7 @@ standard `plugin syntax`.

### Default Route Class

`static` Cake\\Routing\\RouteBuilder::**setRouteClass**($routeClass = null)
`method` Cake\\Routing\\RouteBuilder::**setRouteClass**(string $routeClass): static

If you want to use an alternate route class for your routes besides the
default `Route`, you can do so by calling `RouteBuilder::setRouteClass()`
Expand All @@ -1811,7 +1811,7 @@ Calling the method without an argument will return current default route class.

### Fallbacks Method

`method` Cake\\Routing\\RouteBuilder::**fallbacks**($routeClass = null)
`method` Cake\\Routing\\RouteBuilder::**fallbacks**(?string $routeClass = null): static

The fallbacks method is a simple shortcut for defining default routes. The
method uses the passed routing class for the defined rules or if no class is
Expand Down
Loading