Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into 4.5
Browse files Browse the repository at this point in the history
 Conflicts:
	system/Router/AutoRouterImproved.php
	system/Router/Router.php
  • Loading branch information
kenjis committed Feb 25, 2024
2 parents f40b371 + ad11363 commit e1df9f5
Show file tree
Hide file tree
Showing 61 changed files with 213 additions and 161 deletions.
3 changes: 3 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
]);

$overrides = [
'phpdoc_array_type' => true,
'phpdoc_no_alias_tag' => [
'replacements' => [
'type' => 'var',
Expand All @@ -62,6 +63,8 @@
'phpstan-param',
'phpstan-property',
'phpstan-return',
'phpstan-type',
'phpstan-var',
'property',
'property-read',
'property-write',
Expand Down
27 changes: 26 additions & 1 deletion .php-cs-fixer.no-header.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,32 @@
__DIR__ . '/admin/starter/builds',
]);

$overrides = [];
$overrides = [
'phpdoc_array_type' => true,
'phpdoc_align' => [
'align' => 'vertical',
'spacing' => 1,
'tags' => [
'method',
'param',
'phpstan-assert',
'phpstan-assert-if-true',
'phpstan-assert-if-false',
'phpstan-param',
'phpstan-property',
'phpstan-return',
'phpstan-type',
'phpstan-var',
'property',
'property-read',
'property-write',
'return',
'throws',
'type',
'var',
],
],
];

$options = [
'cacheFile' => 'build/.php-cs-fixer.no-header.cache',
Expand Down
24 changes: 24 additions & 0 deletions .php-cs-fixer.user-guide.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,30 @@
'import_symbols' => false,
'leading_backslash_in_global_namespace' => true,
],
'phpdoc_array_type' => true,
'phpdoc_align' => [
'align' => 'vertical',
'spacing' => 1,
'tags' => [
'method',
'param',
'phpstan-assert',
'phpstan-assert-if-true',
'phpstan-assert-if-false',
'phpstan-param',
'phpstan-property',
'phpstan-return',
'phpstan-type',
'phpstan-var',
'property',
'property-read',
'property-write',
'return',
'throws',
'type',
'var',
],
],
];

$options = [
Expand Down
2 changes: 1 addition & 1 deletion app/Config/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class Cache extends BaseConfig
* ['q'] = Enabled, but only take into account the specified list
* of query parameters.
*
* @var bool|string[]
* @var array<string>|bool
*/
public $cacheQueryString = false;

Expand Down
30 changes: 15 additions & 15 deletions app/Config/ContentSecurityPolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,28 +45,28 @@ class ContentSecurityPolicy extends BaseConfig
/**
* Will default to self if not overridden
*
* @var string|string[]|null
* @var array<string>|string|null
*/
public $defaultSrc;

/**
* Lists allowed scripts' URLs.
*
* @var string|string[]
* @var array<string>|string
*/
public $scriptSrc = 'self';

/**
* Lists allowed stylesheets' URLs.
*
* @var string|string[]
* @var array<string>|string
*/
public $styleSrc = 'self';

/**
* Defines the origins from which images can be loaded.
*
* @var string|string[]
* @var array<string>|string
*/
public $imageSrc = 'self';

Expand All @@ -75,36 +75,36 @@ class ContentSecurityPolicy extends BaseConfig
*
* Will default to self if not overridden
*
* @var string|string[]|null
* @var array<string>|string|null
*/
public $baseURI;

/**
* Lists the URLs for workers and embedded frame contents
*
* @var string|string[]
* @var array<string>|string
*/
public $childSrc = 'self';

/**
* Limits the origins that you can connect to (via XHR,
* WebSockets, and EventSource).
*
* @var string|string[]
* @var array<string>|string
*/
public $connectSrc = 'self';

/**
* Specifies the origins that can serve web fonts.
*
* @var string|string[]
* @var array<string>|string
*/
public $fontSrc;

/**
* Lists valid endpoints for submission from `<form>` tags.
*
* @var string|string[]
* @var array<string>|string
*/
public $formAction = 'self';

Expand All @@ -114,7 +114,7 @@ class ContentSecurityPolicy extends BaseConfig
* and `<applet>` tags. This directive can't be used in
* `<meta>` tags and applies only to non-HTML resources.
*
* @var string|string[]|null
* @var array<string>|string|null
*/
public $frameAncestors;

Expand All @@ -129,33 +129,33 @@ class ContentSecurityPolicy extends BaseConfig
/**
* Restricts the origins allowed to deliver video and audio.
*
* @var string|string[]|null
* @var array<string>|string|null
*/
public $mediaSrc;

/**
* Allows control over Flash and other plugins.
*
* @var string|string[]
* @var array<string>|string
*/
public $objectSrc = 'self';

/**
* @var string|string[]|null
* @var array<string>|string|null
*/
public $manifestSrc;

/**
* Limits the kinds of plugins a page may invoke.
*
* @var string|string[]|null
* @var array<string>|string|null
*/
public $pluginTypes;

/**
* List of actions allowed.
*
* @var string|string[]|null
* @var array<string>|string|null
*/
public $sandbox;

Expand Down
2 changes: 1 addition & 1 deletion app/Config/Format.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Format extends BaseConfig
* These formats are only checked when the data passed to the respond()
* method is an array.
*
* @var string[]
* @var array<string>
*/
public array $supportedResponseFormats = [
'application/json',
Expand Down
2 changes: 1 addition & 1 deletion app/Config/Toolbar.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Toolbar extends BaseConfig
* List of toolbar collectors that will be called when Debug Toolbar
* fires up and collects data from.
*
* @var string[]
* @var array<string>
*/
public array $collectors = [
Timers::class,
Expand Down
2 changes: 1 addition & 1 deletion app/Config/Validation.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Validation extends BaseConfig
* Stores the classes that contain the
* rules that are available.
*
* @var string[]
* @var array<string>
*/
public array $ruleSets = [
Rules::class,
Expand Down
6 changes: 3 additions & 3 deletions app/Config/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class View extends BaseView
* { title|esc(js) }
* { created_on|date(Y-m-d)|esc(attr) }
*
* @var array<string, string>
* @var array<string, string>
* @phpstan-var array<string, ParserCallableString>
*/
public $filters = [];
Expand All @@ -44,7 +44,7 @@ class View extends BaseView
* by the core Parser by creating aliases that will be replaced with
* any callable. Can be single or tag pair.
*
* @var array<string, array<string>|callable|string>
* @var array<string, array<string>|callable|string>
* @phpstan-var array<string, array<ParserCallableString>|ParserCallableString|ParserCallable>
*/
public $plugins = [];
Expand All @@ -56,7 +56,7 @@ class View extends BaseView
*
* All classes must implement CodeIgniter\View\ViewDecoratorInterface
*
* @var class-string<ViewDecoratorInterface>[]
* @var array<class-string<ViewDecoratorInterface>>
*/
public array $decorators = [];
}
4 changes: 2 additions & 2 deletions system/API/ResponseTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ trait ResponseTrait
* Either 'json' or 'xml'. If null is set, it will be determined through
* content negotiation.
*
* @var string|null
* @var string|null
* @phpstan-var 'html'|'json'|'xml'|null
*/
protected $format = 'json';
Expand Down Expand Up @@ -240,7 +240,7 @@ protected function failValidationError(string $description = 'Bad Request', ?str
/**
* Used when the data provided by the client cannot be validated on one or more fields.
*
* @param string|string[] $errors
* @param array<string>|string $errors
*
* @return ResponseInterface
*/
Expand Down
4 changes: 2 additions & 2 deletions system/Autoloader/FileLocator.php
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ public function findQualifiedNameFromPath(string $path)
* Scans the defined namespaces, returning a list of all files
* that are contained within the subpath specified by $path.
*
* @return string[] List of file paths
* @return array<string> List of file paths
*/
public function listFiles(string $path): array
{
Expand Down Expand Up @@ -339,7 +339,7 @@ public function listFiles(string $path): array
* Scans the provided namespace, returning a list of all files
* that are contained within the sub path specified by $path.
*
* @return string[] List of file paths
* @return array<string> List of file paths
*/
public function listNamespaceFiles(string $prefix, string $path): array
{
Expand Down
4 changes: 2 additions & 2 deletions system/Autoloader/FileLocatorInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,15 @@ public function findQualifiedNameFromPath(string $path);
* Scans the defined namespaces, returning a list of all files
* that are contained within the subpath specified by $path.
*
* @return string[] List of file paths
* @return array<string> List of file paths
*/
public function listFiles(string $path): array;

/**
* Scans the provided namespace, returning a list of all files
* that are contained within the sub path specified by $path.
*
* @return string[] List of file paths
* @return array<string> List of file paths
*/
public function listNamespaceFiles(string $prefix, string $path): array;
}
16 changes: 8 additions & 8 deletions system/BaseModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@
* - process various callbacks
* - allow intermingling calls to the db connection
*
* @phpstan-type row_array array<int|string, float|int|null|object|string>
* @phpstan-type row_array array<int|string, float|int|null|object|string>
* @phpstan-type event_data_beforeinsert array{data: row_array}
* @phpstan-type event_data_afterinsert array{id: int|string, data: row_array, result: bool}
* @phpstan-type event_data_beforefind array{id?: int|string, method: string, singleton: bool, limit?: int, offset?: int}
* @phpstan-type event_data_afterfind array{id: int|string|null|list<int|string>, data: row_array|list<row_array>|object|null, method: string, singleton: bool}
* @phpstan-type event_data_afterinsert array{id: int|string, data: row_array, result: bool}
* @phpstan-type event_data_beforefind array{id?: int|string, method: string, singleton: bool, limit?: int, offset?: int}
* @phpstan-type event_data_afterfind array{id: int|string|null|list<int|string>, data: row_array|list<row_array>|object|null, method: string, singleton: bool}
* @phpstan-type event_data_beforeupdate array{id: null|list<int|string>, data: row_array}
* @phpstan-type event_data_afterupdate array{id: null|list<int|string>, data: row_array|object, result: bool}
* @phpstan-type event_data_afterupdate array{id: null|list<int|string>, data: row_array|object, result: bool}
* @phpstan-type event_data_beforedelete array{id: null|list<int|string>, purge: bool}
* @phpstan-type event_data_afterdelete array{id: null|list<int|string>, data: null, purge: bool, result: bool}
* @phpstan-type event_data_afterdelete array{id: null|list<int|string>, data: null, purge: bool, result: bool}
*/
abstract class BaseModel
{
Expand Down Expand Up @@ -485,7 +485,7 @@ abstract protected function doUpdate($id = null, $row = null): bool;
* @param int $batchSize The size of the batch to run
* @param bool $returnSQL True means SQL is returned, false will execute the query
*
* @return false|int|string[] Number of rows affected or FALSE on failure, SQL array when testMode
* @return array<string>|false|int Number of rows affected or FALSE on failure, SQL array when testMode
*
* @throws DatabaseException
*/
Expand Down Expand Up @@ -1039,7 +1039,7 @@ public function update($id = null, $row = null): bool
* @param int $batchSize The size of the batch to run
* @param bool $returnSQL True means SQL is returned, false will execute the query
*
* @return false|int|string[] Number of rows affected or FALSE on failure, SQL array when testMode
* @return array<string>|false|int Number of rows affected or FALSE on failure, SQL array when testMode
*
* @throws DatabaseException
* @throws ReflectionException
Expand Down
2 changes: 1 addition & 1 deletion system/Cache/ResponseCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ final class ResponseCache
* array('q') = Enabled, but only take into account the specified list
* of query parameters.
*
* @var bool|string[]
* @var array<string>|bool
*/
private $cacheQueryString = false;

Expand Down
2 changes: 1 addition & 1 deletion system/CodeIgniter.php
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,7 @@ public function displayPerformanceMetrics(string $output): string
* @param RouteCollectionInterface|null $routes A collection interface to use in place
* of the config file.
*
* @return string|string[]|null Route filters, that is, the filters specified in the routes file
* @return array<string>|string|null Route filters, that is, the filters specified in the routes file
*
* @throws RedirectException
*/
Expand Down
2 changes: 1 addition & 1 deletion system/Commands/Database/MigrateStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class MigrateStatus extends BaseCommand
/**
* Namespaces to ignore when looking for migrations.
*
* @var string[]
* @var array<string>
*/
protected $ignoredNamespaces = [
'CodeIgniter',
Expand Down
2 changes: 1 addition & 1 deletion system/Commands/Translation/LocalizationFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ private function isSubDirectory(string $directory, string $rootDirectory): bool
}

/**
* @param SplFileInfo[] $files
* @param array<SplFileInfo> $files
*
* @return array<string, array|int>
* @phpstan-return array{'foundLanguageKeys': array<string, array<string, string>>, 'badLanguageKeys': array<int, array<int, string>>, 'countFiles': int}
Expand Down
Loading

0 comments on commit e1df9f5

Please sign in to comment.