Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into 4.4
Browse files Browse the repository at this point in the history
 Conflicts:
	system/HTTP/URI.php
  • Loading branch information
kenjis committed Jul 6, 2023
2 parents ceb5976 + 1a83ef4 commit 54cf146
Show file tree
Hide file tree
Showing 43 changed files with 309 additions and 261 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/test-rector.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ on:
- '.github/workflows/test-rector.yml'
- composer.json
- rector.php
- '**.neon.dist'

push:
branches:
Expand All @@ -28,6 +29,7 @@ on:
- '.github/workflows/test-rector.yml'
- composer.json
- rector.php
- '**.neon.dist'

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
Expand Down
7 changes: 0 additions & 7 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
conditionalTags:
PhpParser\NodeVisitor\NodeConnectingVisitor:
phpstan.parser.richParserNodeVisitor: true

services:
-
class: Utils\PHPStan\CheckUseStatementsAfterLicenseRule
Expand Down Expand Up @@ -36,12 +32,9 @@ parameters:
- system/Test/Filters/CITestStreamFilter.php
- system/ThirdParty/*
- system/Validation/Views/single.php
parallel:
processTimeout: 300.0
scanDirectories:
- system/Helpers
dynamicConstantNames:
- APP_NAMESPACE
- CI_DEBUG
- ENVIRONMENT
- SODIUM_LIBRARY_VERSION
2 changes: 1 addition & 1 deletion system/CLI/CLI.php
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ public static function wait(int $seconds, bool $countdown = false)
/**
* if operating system === windows
*
* @deprecated v4.3 Use `is_windows()` instead
* @deprecated 4.3.0 Use `is_windows()` instead
*/
public static function isWindows(): bool
{
Expand Down
2 changes: 1 addition & 1 deletion system/Database/OCI8/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class Connection extends BaseConnection
public $lastInsertedTableName;

/**
* confirm DNS format.
* confirm DSN format.
*/
private function isValidDSN(): bool
{
Expand Down
4 changes: 2 additions & 2 deletions system/Filters/FilterInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ interface FilterInterface
*
* @param array|null $arguments
*
* @return mixed
* @return RequestInterface|ResponseInterface|string|void
*/
public function before(RequestInterface $request, $arguments = null);

Expand All @@ -43,7 +43,7 @@ public function before(RequestInterface $request, $arguments = null);
*
* @param array|null $arguments
*
* @return mixed
* @return ResponseInterface|void
*/
public function after(RequestInterface $request, ResponseInterface $response, $arguments = null);
}
8 changes: 4 additions & 4 deletions system/HTTP/CLIRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ public function isCLI(): bool
*
* @param array|string|null $index Index for item to fetch from $_GET.
* @param int|null $filter A filter name to apply.
* @param mixed|null $flags
* @param array|int|null $flags
*
* @return array|null
*/
Expand All @@ -235,7 +235,7 @@ public function getGet($index = null, $filter = null, $flags = null)
*
* @param array|string|null $index Index for item to fetch from $_POST.
* @param int|null $filter A filter name to apply
* @param mixed $flags
* @param array|int|null $flags
*
* @return array|null
*/
Expand All @@ -249,7 +249,7 @@ public function getPost($index = null, $filter = null, $flags = null)
*
* @param array|string|null $index Index for item to fetch from $_POST or $_GET
* @param int|null $filter A filter name to apply
* @param mixed $flags
* @param array|int|null $flags
*
* @return array|null
*/
Expand All @@ -263,7 +263,7 @@ public function getPostGet($index = null, $filter = null, $flags = null)
*
* @param array|string|null $index Index for item to be fetched from $_GET or $_POST
* @param int|null $filter A filter name to apply
* @param mixed $flags
* @param array|int|null $flags
*
* @return array|null
*/
Expand Down
2 changes: 1 addition & 1 deletion system/HTTP/CURLRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ public function setForm(array $params, bool $multipart = false)
/**
* Set JSON data to be sent.
*
* @param mixed $data
* @param array|bool|float|int|object|string|null $data
*
* @return $this
*/
Expand Down
4 changes: 2 additions & 2 deletions system/HTTP/Files/FileCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ protected function populateFiles()
* Given a file array, will create UploadedFile instances. Will
* loop over an array and create objects for each.
*
* @return array|UploadedFile
* @return UploadedFile|UploadedFile[]
*/
protected function createFileObject(array $array)
{
Expand Down Expand Up @@ -241,7 +241,7 @@ protected function fixFilesArray(array $data): array
* @param array $index The index sequence we are navigating down
* @param array $value The portion of the array to process
*
* @return mixed
* @return UploadedFile|null
*/
protected function getValueDotNotationSyntax(array $index, array $value)
{
Expand Down
4 changes: 2 additions & 2 deletions system/HTTP/MessageInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function getProtocolVersion(): string;
/**
* Sets the body of the current message.
*
* @param mixed $data
* @param string $data
*
* @return $this
*/
Expand All @@ -48,7 +48,7 @@ public function getBody();
/**
* Appends data to the body of the current message.
*
* @param mixed $data
* @param string $data
*
* @return $this
*/
Expand Down
2 changes: 1 addition & 1 deletion system/HTTP/MessageTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function setBody($data): self
/**
* Appends data to the body of the current message.
*
* @param mixed $data
* @param string $data
*
* @return $this
*/
Expand Down
2 changes: 1 addition & 1 deletion system/HTTP/ResponseTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ public function getXML()
* @param array|object|string $body
* @param string $format Valid: json, xml
*
* @return mixed
* @return false|string
*
* @throws InvalidArgumentException If the body property is not string or array.
*/
Expand Down
2 changes: 1 addition & 1 deletion system/HTTP/URI.php
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,7 @@ public function setQueryArray(array $query)
/**
* Adds a single new element to the query vars.
*
* @param mixed $value
* @param int|string $value
*
* @return $this
*/
Expand Down
2 changes: 1 addition & 1 deletion system/HTTP/UserAgent.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class UserAgent
/**
* HTTP Referer
*
* @var mixed
* @var bool|string|null
*/
protected $referrer;

Expand Down
2 changes: 1 addition & 1 deletion system/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -866,7 +866,7 @@ private function checkBuilderMethod(string $name): void
*
* @codeCoverageIgnore
*
* @deprecated since 4.1
* @deprecated 4.1.0
*/
public static function classToArray($data, $primaryKey = null, string $dateFormat = 'datetime', bool $onlyChanged = true): array
{
Expand Down
2 changes: 1 addition & 1 deletion system/Router/RouteCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ public function setAutoRoute(bool $value): RouteCollectionInterface
*
* This setting is passed to the Router class and handled there.
*
* @param callable|null $callable
* @param callable|string|null $callable
*/
public function set404Override($callable = null): RouteCollectionInterface
{
Expand Down
16 changes: 8 additions & 8 deletions system/Validation/Validation.php
Original file line number Diff line number Diff line change
Expand Up @@ -492,14 +492,14 @@ public function withRequest(RequestInterface $request): ValidationInterface
}

/**
* Sets an individual rule and custom error messages for a single field.
* Sets (or adds) an individual rule and custom error messages for a single
* field.
*
* The custom error message should be just the messages that apply to
* this field, like so:
*
* [
* 'rule' => 'message',
* 'rule' => 'message',
* 'rule1' => 'message1',
* 'rule2' => 'message2',
* ]
*
* @param array|string $rules The validation rules.
Expand Down Expand Up @@ -533,21 +533,21 @@ public function setRule(string $field, ?string $label, $rules, array $errors = [

/**
* Stores the rules that should be used to validate the items.
* Rules should be an array formatted like:
*
* Rules should be an array formatted like:
* [
* 'field' => 'rule1|rule2'
* ]
*
* The $errors array should be formatted like:
* [
* 'field' => [
* 'rule' => 'message',
* 'rule' => 'message
* 'rule1' => 'message1',
* 'rule2' => 'message2',
* ],
* ]
*
* @param array $errors // An array of custom error messages
* @param array $errors An array of custom error messages
*/
public function setRules(array $rules, array $errors = []): ValidationInterface
{
Expand Down
9 changes: 6 additions & 3 deletions system/View/Cell.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ public function __construct(CacheInterface $cache)
/**
* Render a cell, returning its body as a string.
*
* @param array|string|null $params
* @param string $library Cell class and method name.
* @param array|string|null $params Parameters to pass to the method.
* @param int $ttl Number of seconds to cache the cell.
* @param string|null $cacheName Cache item name.
*
* @throws ReflectionException
*/
Expand All @@ -76,6 +79,8 @@ public function render(string $library, $params = null, int $ttl = 0, ?string $c
? get_class($instance)
: null;

$params = $this->prepareParams($params);

// Is the output cached?
$cacheName = ! empty($cacheName)
? $cacheName
Expand All @@ -93,8 +98,6 @@ public function render(string $library, $params = null, int $ttl = 0, ?string $c
throw ViewException::forInvalidCellMethod($class, $method);
}

$params = $this->prepareParams($params);

$output = $instance instanceof BaseCell
? $this->renderCell($instance, $method, $params)
: $this->renderSimpleClass($instance, $method, $params, $class);
Expand Down
12 changes: 2 additions & 10 deletions tests/system/API/ResponseTraitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,8 @@
*/
final class ResponseTraitTest extends CIUnitTestCase
{
/**
* @var MockIncomingRequest|null
*/
private $request;

/**
* @var MockResponse|null
*/
private $response;

private ?MockIncomingRequest $request = null;
private ?MockResponse $response = null;
private ?FormatterInterface $formatter = null;

protected function setUp(): void
Expand Down
6 changes: 6 additions & 0 deletions user_guide_src/source/database/configuration/008.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,20 @@

use CodeIgniter\Database\Config;

/**
* Database Configuration
*/
class Database extends Config
{
// ...
public $development = [/* ... */];
public $test = [/* ... */];
public $production = [/* ... */];

public function __construct()
{
// ...

$this->defaultGroup = ENVIRONMENT;
}
}
Loading

0 comments on commit 54cf146

Please sign in to comment.