Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style: enable phpdoc_array_type #8580

Merged
merged 1 commit into from
Feb 25, 2024
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
1 change: 1 addition & 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 Down
4 changes: 3 additions & 1 deletion .php-cs-fixer.no-header.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@
__DIR__ . '/admin/starter/builds',
]);

$overrides = [];
$overrides = [
'phpdoc_array_type' => true,
];

$options = [
'cacheFile' => 'build/.php-cs-fixer.no-header.cache',
Expand Down
1 change: 1 addition & 0 deletions .php-cs-fixer.user-guide.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
'import_symbols' => false,
'leading_backslash_in_global_namespace' => true,
],
'phpdoc_array_type' => true,
];

$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
2 changes: 1 addition & 1 deletion app/Config/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];
}
2 changes: 1 addition & 1 deletion system/API/ResponseTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,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 @@ -301,7 +301,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 @@ -334,7 +334,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/BaseModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,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 @@ -1005,7 +1005,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 @@ -35,7 +35,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 @@ -800,7 +800,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 @@ -63,7 +63,7 @@ class MigrateStatus extends BaseCommand
/**
* Namespaces to ignore when looking for migrations.
*
* @var string[]
* @var array<string>
*/
protected $ignoredNamespaces = [
'CodeIgniter',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ final class AutoRouteCollector
/**
* List of controllers in Defined Routes that should not be accessed via Auto-Routing.
*
* @var class-string[]
* @var array<class-string>
*/
private array $protectedControllers;

Expand Down
2 changes: 1 addition & 1 deletion system/Commands/Utilities/Routes/ControllerFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function __construct(string $namespace)
}

/**
* @return class-string[]
* @return array<class-string>
*/
public function find(): array
{
Expand Down
4 changes: 2 additions & 2 deletions system/Common.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,8 @@ function cookie(string $name, string $value = '', array $options = []): Cookie
/**
* Fetches the global `CookieStore` instance held by `Response`.
*
* @param Cookie[] $cookies If `getGlobal` is false, this is passed to CookieStore's constructor
* @param bool $getGlobal If false, creates a new instance of CookieStore
* @param array<Cookie> $cookies If `getGlobal` is false, this is passed to CookieStore's constructor
* @param bool $getGlobal If false, creates a new instance of CookieStore
*/
function cookies(array $cookies = [], bool $getGlobal = true): CookieStore
{
Expand Down
2 changes: 1 addition & 1 deletion system/Config/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class View extends BaseConfig
*
* All classes must implement CodeIgniter\View\ViewDecoratorInterface
*
* @var class-string<ViewDecoratorInterface>[]
* @var array<class-string<ViewDecoratorInterface>>
*/
public array $decorators = [];

Expand Down
6 changes: 3 additions & 3 deletions system/Cookie/CookieStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class CookieStore implements Countable, IteratorAggregate
/**
* Creates a CookieStore from an array of `Set-Cookie` headers.
*
* @param string[] $headers
* @param array<string> $headers
*
* @return static
*
Expand All @@ -44,7 +44,7 @@ class CookieStore implements Countable, IteratorAggregate
public static function fromCookieHeaders(array $headers, bool $raw = false)
{
/**
* @var Cookie[] $cookies
* @var array<Cookie> $cookies
*/
$cookies = array_filter(array_map(static function (string $header) use ($raw) {
try {
Expand All @@ -60,7 +60,7 @@ public static function fromCookieHeaders(array $headers, bool $raw = false)
}

/**
* @param Cookie[] $cookies
* @param array<Cookie> $cookies
*
* @throws CookieException
*/
Expand Down
2 changes: 1 addition & 1 deletion system/Cookie/Exceptions/CookieException.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public static function forInvalidCookieInstance(array $data)
/**
* Thrown when the queried Cookie object does not exist in the cookie collection.
*
* @param string[] $data
* @param array<string> $data
*
* @return static
*/
Expand Down
Loading
Loading