From 120fc094b53405e5d7ec155986706c3725a3663c Mon Sep 17 00:00:00 2001 From: Nico Hoffmann Date: Sat, 14 Sep 2019 13:07:05 +0200 Subject: [PATCH 001/246] Return all language info from API #2054 --- config/api/collections.php | 1 - config/api/models/Language.php | 6 ++++-- config/api/models/System.php | 2 +- panel/src/store/modules/languages.js | 6 ++++-- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/config/api/collections.php b/config/api/collections.php index bafa483e3f..8ecf9279eb 100644 --- a/config/api/collections.php +++ b/config/api/collections.php @@ -35,7 +35,6 @@ 'languages' => [ 'model' => 'language', 'type' => Languages::class, - 'view' => 'compact' ], /** diff --git a/config/api/models/Language.php b/config/api/models/Language.php index f05626f5ec..035441e6b4 100644 --- a/config/api/models/Language.php +++ b/config/api/models/Language.php @@ -31,12 +31,14 @@ ], 'type' => Language::class, 'views' => [ - 'compact' => [ + 'default' => [ 'code', 'default', + 'direction', + 'locale', 'name', 'rules', - 'direction' + 'url' ] ] ]; diff --git a/config/api/models/System.php b/config/api/models/System.php index 76bc0fb4d4..b9e5147e2c 100644 --- a/config/api/models/System.php +++ b/config/api/models/System.php @@ -94,7 +94,7 @@ 'isInstalled', 'isLocal', 'kirbytext', - 'languages' => 'compact', + 'languages', 'license', 'multilang', 'requirements', diff --git a/panel/src/store/modules/languages.js b/panel/src/store/modules/languages.js index 28e293694f..aafe486bbd 100644 --- a/panel/src/store/modules/languages.js +++ b/panel/src/store/modules/languages.js @@ -12,10 +12,12 @@ export default { state.all = languages.map(language => { return { code: language.code, - name: language.name, default: language.default, direction: language.direction, - rules: language.rules + locale: language.locale, + name: language.name, + rules: language.rules, + url: language.url }; }); }, From 1c86b48ca05b07d4e6ae1ce1ce8a9db3846df6f6 Mon Sep 17 00:00:00 2001 From: Lukas Bestle Date: Fri, 20 Sep 2019 21:17:50 +0200 Subject: [PATCH 002/246] PHP CS: Consistent scalar types in docblocks --- .php_cs | 2 +- config/helpers.php | 12 +++++----- config/methods.php | 8 +++---- src/Api/Api.php | 10 ++++----- src/Cache/ApcuCache.php | 8 +++---- src/Cache/Cache.php | 10 ++++----- src/Cache/FileCache.php | 6 ++--- src/Cache/MemCached.php | 6 ++--- src/Cache/MemoryCache.php | 6 ++--- src/Cache/NullCache.php | 6 ++--- src/Cms/App.php | 4 ++-- src/Cms/Auth.php | 8 +++---- src/Cms/Collection.php | 2 +- src/Cms/Collections.php | 2 +- src/Cms/Content.php | 2 +- src/Cms/ContentLocks.php | 4 ++-- src/Cms/ContentTranslation.php | 4 ++-- src/Cms/Dir.php | 2 +- src/Cms/Field.php | 6 ++--- src/Cms/File.php | 4 ++-- src/Cms/FileActions.php | 2 +- src/Cms/FileFoundation.php | 6 ++--- src/Cms/FileModifications.php | 14 ++++++------ src/Cms/HasChildren.php | 12 +++++----- src/Cms/HasMethods.php | 2 +- src/Cms/Language.php | 10 ++++----- src/Cms/Media.php | 2 +- src/Cms/ModelWithContent.php | 14 ++++++------ src/Cms/Page.php | 38 ++++++++++++++++---------------- src/Cms/PageActions.php | 8 +++---- src/Cms/PageBlueprint.php | 2 +- src/Cms/PageSiblings.php | 8 +++---- src/Cms/Responder.php | 8 +++---- src/Cms/Site.php | 2 +- src/Cms/SiteBlueprint.php | 2 +- src/Cms/System.php | 26 +++++++++++----------- src/Cms/Template.php | 4 ++-- src/Cms/User.php | 14 ++++++------ src/Cms/UserActions.php | 2 +- src/Data/Data.php | 2 +- src/Data/Handler.php | 2 +- src/Data/PHP.php | 2 +- src/Database/Database.php | 16 +++++++------- src/Database/Query.php | 18 +++++++-------- src/Database/Sql.php | 12 +++++----- src/Exception/Exception.php | 4 ++-- src/Http/Cookie.php | 8 +++---- src/Http/Header.php | 28 +++++++++++------------ src/Http/Params.php | 4 ++-- src/Http/Remote.php | 2 +- src/Http/Request.php | 8 +++---- src/Http/Response.php | 8 +++---- src/Http/Server.php | 4 ++-- src/Http/Uri.php | 10 ++++----- src/Http/Url.php | 4 ++-- src/Http/Visitor.php | 2 +- src/Image/Exif.php | 4 ++-- src/Image/Image.php | 8 +++---- src/Session/FileSessionStore.php | 2 +- src/Session/Session.php | 28 +++++++++++------------ src/Session/SessionData.php | 8 +++---- src/Session/SessionStore.php | 2 +- src/Toolkit/A.php | 4 ++-- src/Toolkit/Collection.php | 12 +++++----- src/Toolkit/Dir.php | 16 +++++++------- src/Toolkit/F.php | 30 ++++++++++++------------- src/Toolkit/File.php | 6 ++--- src/Toolkit/I18n.php | 4 ++-- src/Toolkit/Iterator.php | 6 ++--- src/Toolkit/Mime.php | 2 +- src/Toolkit/Pagination.php | 18 +++++++-------- src/Toolkit/Str.php | 6 ++--- src/Toolkit/V.php | 8 +++---- src/Toolkit/View.php | 2 +- src/Toolkit/Xml.php | 4 ++-- tests/Session/SessionTest.php | 2 +- 76 files changed, 297 insertions(+), 297 deletions(-) diff --git a/.php_cs b/.php_cs index 5753edda5d..4b65001d8a 100644 --- a/.php_cs +++ b/.php_cs @@ -46,7 +46,7 @@ return PhpCsFixer\Config::create() // 'phpdoc_add_missing_param_annotation' => ['only_untyped' => false], // adds params in the wrong order // 'phpdoc_align' => ['align' => 'vertical'], // added in a second step 'phpdoc_indent' => true, - // 'phpdoc_scalar' => true, // added in a second step + 'phpdoc_scalar' => true, 'phpdoc_trim' => true, 'short_scalar_cast' => true, 'single_line_comment_style' => true, diff --git a/config/helpers.php b/config/helpers.php index f88d5ef422..56fc874f8a 100755 --- a/config/helpers.php +++ b/config/helpers.php @@ -55,7 +55,7 @@ function collection(string $name) * Checks / returns a CSRF token * * @param string $check Pass a token here to compare it to the one in the session - * @return string|boolean Either the token or a boolean check result + * @return string|bool Either the token or a boolean check result */ function csrf(string $check = null) { @@ -126,7 +126,7 @@ function css($url, $options = null) * to help with debugging. * * @param mixed $variable - * @param boolean $echo + * @param bool $echo * @return string */ function dump($variable, bool $echo = true): string @@ -161,7 +161,7 @@ function e($condition, $value, $alternative = null) * * @param string $string Untrusted data * @param string $context Location of output - * @param boolean $strict Whether to escape an extended set of characters (HTML attributes only) + * @param bool $strict Whether to escape an extended set of characters (HTML attributes only) * @return string Escaped data */ function esc($string, $context = 'html', $strict = false) @@ -206,7 +206,7 @@ function gist(string $url, string $file = null): string * Urls can be relative or absolute. * * @param string $url - * @param integer $code + * @param int $code * @return void */ function go(string $url = null, int $code = 302) @@ -589,7 +589,7 @@ function r($condition, $value, $alternative = null) * by the defined step * * @param string $date - * @param integer $step + * @param int $step * @return string|null */ function timestamp(string $date = null, int $step = null): ?string @@ -671,7 +671,7 @@ function smartypants(string $text = null): string * * @param string|array $name * @param array|object $data - * @param boolean $return + * @param bool $return * @return string */ function snippet($name, $data = [], bool $return = false) diff --git a/config/methods.php b/config/methods.php index 51ba2da5b5..8065ad1278 100644 --- a/config/methods.php +++ b/config/methods.php @@ -28,7 +28,7 @@ * Converts the field value into a proper boolean and inverts it * * @param \Kirby\Cms\Field $field - * @return boolean + * @return bool */ 'isFalse' => function (Field $field): bool { return $field->toBool() === false; @@ -38,7 +38,7 @@ * Converts the field value into a proper boolean * * @param \Kirby\Cms\Field $field - * @return boolean + * @return bool */ 'isTrue' => function (Field $field): bool { return $field->toBool() === true; @@ -49,7 +49,7 @@ * * @param string $validator * @param mixed ...$arguments A list of optional validator arguments - * @return boolean + * @return bool */ 'isValid' => function (Field $field, string $validator, ...$arguments): bool { return V::$validator($field->value, ...$arguments); @@ -305,7 +305,7 @@ * * @param \Kirby\Cms\Field $field * @param int $cahrs - * @param boolean $strip + * @param bool $strip * @param string $rep * @return \Kirby\Cms\Field */ diff --git a/src/Api/Api.php b/src/Api/Api.php index 1610de621d..18ceece1ff 100644 --- a/src/Api/Api.php +++ b/src/Api/Api.php @@ -38,7 +38,7 @@ class Api /** * Debugging flag * - * @var boolean + * @var bool */ protected $debug = false; @@ -268,7 +268,7 @@ public function data($key = null, ...$args) /** * Returns the debugging flag * - * @return boolean + * @return bool */ public function debug(): bool { @@ -279,7 +279,7 @@ public function debug(): bool * Checks if injected data exists for the given key * * @param string $key - * @return boolean + * @return bool */ public function hasData(string $key): bool { @@ -489,7 +489,7 @@ protected function setData(array $data = null) /** * Setter for the debug flag * - * @param boolean $debug + * @param bool $debug * @return self */ protected function setDebug(bool $debug = false) @@ -693,7 +693,7 @@ public function responseForException($e): array * Upload helper method * * @param Closure $callback - * @param boolean $single + * @param bool $single * @return array * * @throws Exception If request has no files diff --git a/src/Cache/ApcuCache.php b/src/Cache/ApcuCache.php index 96011c7804..ebae697cd3 100644 --- a/src/Cache/ApcuCache.php +++ b/src/Cache/ApcuCache.php @@ -19,7 +19,7 @@ class ApcuCache extends Cache * Determines if an item exists in the cache * * @param string $key - * @return boolean + * @return bool */ public function exists(string $key): bool { @@ -30,7 +30,7 @@ public function exists(string $key): bool * Flushes the entire cache and returns * whether the operation was successful * - * @return boolean + * @return bool */ public function flush(): bool { @@ -46,7 +46,7 @@ public function flush(): bool * whether the operation was successful * * @param string $key - * @return boolean + * @return bool */ public function remove(string $key): bool { @@ -77,7 +77,7 @@ public function retrieve(string $key) * @param string $key * @param mixed $value * @param int $minutes - * @return boolean + * @return bool */ public function set(string $key, $value, int $minutes = 0): bool { diff --git a/src/Cache/Cache.php b/src/Cache/Cache.php index 5e7e06ba29..981be0c5a3 100644 --- a/src/Cache/Cache.php +++ b/src/Cache/Cache.php @@ -45,7 +45,7 @@ public function __construct(array $options = []) * @param string $key * @param mixed $value * @param int $minutes - * @return boolean + * @return bool */ abstract public function set(string $key, $value, int $minutes = 0): bool; @@ -152,7 +152,7 @@ public function expires(string $key) * Checks if an item in the cache is expired * * @param string $key - * @return boolean + * @return bool */ public function expired(string $key): bool { @@ -204,7 +204,7 @@ public function modified(string $key) * Determines if an item exists in the cache * * @param string $key - * @return boolean + * @return bool */ public function exists(string $key): bool { @@ -217,7 +217,7 @@ public function exists(string $key): bool * this needs to be defined by the driver * * @param string $key - * @return boolean + * @return bool */ abstract public function remove(string $key): bool; @@ -226,7 +226,7 @@ abstract public function remove(string $key): bool; * whether the operation was successful; * this needs to be defined by the driver * - * @return boolean + * @return bool */ abstract public function flush(): bool; diff --git a/src/Cache/FileCache.php b/src/Cache/FileCache.php index 9f0d3738d4..1e50ff44ca 100644 --- a/src/Cache/FileCache.php +++ b/src/Cache/FileCache.php @@ -78,7 +78,7 @@ protected function file(string $key): string * @param string $key * @param mixed $value * @param int $minutes - * @return boolean + * @return bool */ public function set(string $key, $value, int $minutes = 0): bool { @@ -125,7 +125,7 @@ public function created(string $key) * whether the operation was successful * * @param string $key - * @return boolean + * @return bool */ public function remove(string $key): bool { @@ -142,7 +142,7 @@ public function remove(string $key): bool * Flushes the entire cache and returns * whether the operation was successful * - * @return boolean + * @return bool */ public function flush(): bool { diff --git a/src/Cache/MemCached.php b/src/Cache/MemCached.php index 4c459c56c6..82cff0998f 100644 --- a/src/Cache/MemCached.php +++ b/src/Cache/MemCached.php @@ -52,7 +52,7 @@ public function __construct(array $options = []) * @param string $key * @param mixed $value * @param int $minutes - * @return boolean + * @return bool */ public function set(string $key, $value, int $minutes = 0): bool { @@ -76,7 +76,7 @@ public function retrieve(string $key) * whether the operation was successful * * @param string $key - * @return boolean + * @return bool */ public function remove(string $key): bool { @@ -88,7 +88,7 @@ public function remove(string $key): bool * whether the operation was successful; * WARNING: Memcached only supports flushing the whole cache at once! * - * @return boolean + * @return bool */ public function flush(): bool { diff --git a/src/Cache/MemoryCache.php b/src/Cache/MemoryCache.php index bd4cac7d0a..7f2d098dac 100644 --- a/src/Cache/MemoryCache.php +++ b/src/Cache/MemoryCache.php @@ -31,7 +31,7 @@ class MemoryCache extends Cache * @param string $key * @param mixed $value * @param int $minutes - * @return boolean + * @return bool */ public function set(string $key, $value, int $minutes = 0): bool { @@ -56,7 +56,7 @@ public function retrieve(string $key) * whether the operation was successful * * @param string $key - * @return boolean + * @return bool */ public function remove(string $key): bool { @@ -72,7 +72,7 @@ public function remove(string $key): bool * Flushes the entire cache and returns * whether the operation was successful * - * @return boolean + * @return bool */ public function flush(): bool { diff --git a/src/Cache/NullCache.php b/src/Cache/NullCache.php index c0c47dd480..a33fc9cdd1 100644 --- a/src/Cache/NullCache.php +++ b/src/Cache/NullCache.php @@ -25,7 +25,7 @@ class NullCache extends Cache * @param string $key * @param mixed $value * @param int $minutes - * @return boolean + * @return bool */ public function set(string $key, $value, int $minutes = 0): bool { @@ -49,7 +49,7 @@ public function retrieve(string $key) * whether the operation was successful * * @param string $key - * @return boolean + * @return bool */ public function remove(string $key): bool { @@ -60,7 +60,7 @@ public function remove(string $key): bool * Flushes the entire cache and returns * whether the operation was successful * - * @return boolean + * @return bool */ public function flush(): bool { diff --git a/src/Cms/App.php b/src/Cms/App.php index df6746db74..4468601a67 100644 --- a/src/Cms/App.php +++ b/src/Cms/App.php @@ -475,7 +475,7 @@ public function email($preset = [], array $props = []) * * @param string $path * @param mixed $parent - * @param boolean $drafts + * @param bool $drafts * @return \Kirby\Cms\File|null */ public function file(string $path, $parent = null, bool $drafts = true) @@ -758,7 +758,7 @@ public function markdown(string $text = null, bool $inline = false): string /** * Check for a multilang setup * - * @return boolean + * @return bool */ public function multilang(): bool { diff --git a/src/Cms/Auth.php b/src/Cms/Auth.php index e90d38f52d..30bfd7ba02 100644 --- a/src/Cms/Auth.php +++ b/src/Cms/Auth.php @@ -165,7 +165,7 @@ public function ipHash(): string * Check if logins are blocked for the current ip or email * * @param string $email - * @return boolean + * @return bool */ public function isBlocked(string $email): bool { @@ -195,7 +195,7 @@ public function isBlocked(string $email): bool * * @param string $email * @param string $password - * @param boolean $long + * @param bool $long * @return \Kirby\Cms\User * * @throws PermissionException If the rate limit was exceeded or if any other error occured with debug mode off @@ -334,7 +334,7 @@ public function log(): array /** * Logout the current user * - * @return boolean + * @return bool */ public function logout(): bool { @@ -354,7 +354,7 @@ public function logout(): bool * Tracks a login * * @param string $email - * @return boolean + * @return bool */ public function track(string $email): bool { diff --git a/src/Cms/Collection.php b/src/Cms/Collection.php index 7f6e0deed8..498d879d06 100644 --- a/src/Cms/Collection.php +++ b/src/Cms/Collection.php @@ -165,7 +165,7 @@ public function groupBy($field, bool $i = true) * is in the collection * * @param string|object $id - * @return boolean + * @return bool */ public function has($id): bool { diff --git a/src/Cms/Collections.php b/src/Cms/Collections.php index 5f09e4d523..7064eabd3a 100644 --- a/src/Cms/Collections.php +++ b/src/Cms/Collections.php @@ -89,7 +89,7 @@ public function get(string $name, array $data = []) * Checks if a collection exists * * @param string $name - * @return boolean + * @return bool */ public function has(string $name): bool { diff --git a/src/Cms/Content.php b/src/Cms/Content.php index 52eb39e987..c05afac80c 100644 --- a/src/Cms/Content.php +++ b/src/Cms/Content.php @@ -172,7 +172,7 @@ public function get(string $key = null) * Checks if a content field is set * * @param string $key - * @return boolean + * @return bool */ public function has(string $key): bool { diff --git a/src/Cms/ContentLocks.php b/src/Cms/ContentLocks.php index 2c4c3eea7c..2e4e73a2fb 100644 --- a/src/Cms/ContentLocks.php +++ b/src/Cms/ContentLocks.php @@ -121,7 +121,7 @@ public function get(ModelWithContent $model): array * Returns the file handle to a `.lock` file * * @param string $file - * @param boolean $create Whether to create the file if it does not exist + * @param bool $create Whether to create the file if it does not exist * @return resource|null File handle */ protected function handle(string $file, bool $create = false) @@ -167,7 +167,7 @@ public static function id(ModelWithContent $model): string * * @param \Kirby\Cms\ModelWithContent $model * @param array $data - * @return boolean + * @return bool */ public function set(ModelWithContent $model, array $data): bool { diff --git a/src/Cms/ContentTranslation.php b/src/Cms/ContentTranslation.php index 3bc478694b..e51bfc040c 100644 --- a/src/Cms/ContentTranslation.php +++ b/src/Cms/ContentTranslation.php @@ -119,7 +119,7 @@ public function contentFile(): string /** * Checks if the translation file exists * - * @return boolean + * @return bool */ public function exists(): bool { @@ -140,7 +140,7 @@ public function id(): string * Checks if the this is the default translation * of the model * - * @return boolean + * @return bool */ public function isDefault(): bool { diff --git a/src/Cms/Dir.php b/src/Cms/Dir.php index 434c4941d4..efcd3bd7eb 100644 --- a/src/Cms/Dir.php +++ b/src/Cms/Dir.php @@ -27,7 +27,7 @@ class Dir extends \Kirby\Toolkit\Dir * @param string $dir * @param string $contentExtension * @param array $contentIgnore - * @param boolean $multilang + * @param bool $multilang * @return array */ public static function inventory(string $dir, string $contentExtension = 'txt', array $contentIgnore = null, bool $multilang = false): array diff --git a/src/Cms/Field.php b/src/Cms/Field.php index 02e8747de2..dce51b973a 100644 --- a/src/Cms/Field.php +++ b/src/Cms/Field.php @@ -130,7 +130,7 @@ public function __toString(): string /** * Checks if the field exists in the content data array * - * @return boolean + * @return bool */ public function exists(): bool { @@ -140,7 +140,7 @@ public function exists(): bool /** * Checks if the field content is empty * - * @return boolean + * @return bool */ public function isEmpty(): bool { @@ -150,7 +150,7 @@ public function isEmpty(): bool /** * Checks if the field content is not empty * - * @return boolean + * @return bool */ public function isNotEmpty(): bool { diff --git a/src/Cms/File.php b/src/Cms/File.php index 50bdd73dd0..46e2c0b337 100644 --- a/src/Cms/File.php +++ b/src/Cms/File.php @@ -392,7 +392,7 @@ public function modified(string $format = null, string $handler = null) * Timestamp of the last modification * of the content file * - * @return integer + * @return int */ protected function modifiedContent(): int { @@ -403,7 +403,7 @@ protected function modifiedContent(): int * Timestamp of the last modification * of the source file * - * @return integer + * @return int */ protected function modifiedFile(): int { diff --git a/src/Cms/FileActions.php b/src/Cms/FileActions.php index 4aef8cfc00..8db169c77f 100644 --- a/src/Cms/FileActions.php +++ b/src/Cms/FileActions.php @@ -82,7 +82,7 @@ public function changeName(string $name, bool $sanitize = true) /** * Changes the file's sorting number in the meta file * - * @param integer $sort + * @param int $sort * @return self */ public function changeSort(int $sort) diff --git a/src/Cms/FileFoundation.php b/src/Cms/FileFoundation.php index be70c66112..792f8c678c 100644 --- a/src/Cms/FileFoundation.php +++ b/src/Cms/FileFoundation.php @@ -82,7 +82,7 @@ public function asset() /** * Checks if the file exists on disk * - * @return boolean + * @return bool */ public function exists(): bool { @@ -117,7 +117,7 @@ public function html(array $attr = []): string /** * Checks if the file is a resizable image * - * @return boolean + * @return bool */ public function isResizable(): bool { @@ -136,7 +136,7 @@ public function isResizable(): bool * Checks if a preview can be displayed for the file * in the panel or in the frontend * - * @return boolean + * @return bool */ public function isViewable(): bool { diff --git a/src/Cms/FileModifications.php b/src/Cms/FileModifications.php index 2a50ce2ebf..00b0bba36d 100644 --- a/src/Cms/FileModifications.php +++ b/src/Cms/FileModifications.php @@ -18,7 +18,7 @@ trait FileModifications /** * Blurs the image by the given amount of pixels * - * @param boolean $pixels + * @param bool $pixels * @return \Kirby\Cms\FileVersion|\Kirby\Cms\File */ public function blur($pixels = true) @@ -39,8 +39,8 @@ public function bw() /** * Crops the image by the given width and height * - * @param integer $width - * @param integer $height + * @param int $width + * @param int $height * @param string|array $options * @return \Kirby\Cms\FileVersion|\Kirby\Cms\File */ @@ -71,7 +71,7 @@ public function crop(int $width, int $height = null, $options = null) /** * Sets the JPEG compression quality * - * @param integer $quality + * @param int $quality * @return \Kirby\Cms\FileVersion|\Kirby\Cms\File */ public function quality(int $quality) @@ -83,9 +83,9 @@ public function quality(int $quality) * Resizes the file with the given width and height * while keeping the aspect ratio. * - * @param integer $width - * @param integer $height - * @param integer $quality + * @param int $width + * @param int $height + * @param int $quality * @return \Kirby\Cms\FileVersion|\Kirby\Cms\File */ public function resize(int $width = null, int $height = null, int $quality = null) diff --git a/src/Cms/HasChildren.php b/src/Cms/HasChildren.php index 0e01be5766..0bd0469043 100644 --- a/src/Cms/HasChildren.php +++ b/src/Cms/HasChildren.php @@ -157,7 +157,7 @@ public function grandChildren() /** * Checks if the model has any children * - * @return boolean + * @return bool */ public function hasChildren(): bool { @@ -167,7 +167,7 @@ public function hasChildren(): bool /** * Checks if the model has any drafts * - * @return boolean + * @return bool */ public function hasDrafts(): bool { @@ -176,7 +176,7 @@ public function hasDrafts(): bool /** * @deprecated 3.0.0 Use `Page::hasUnlistedChildren` instead - * @return boolean + * @return bool */ public function hasInvisibleChildren(): bool { @@ -186,7 +186,7 @@ public function hasInvisibleChildren(): bool /** * Checks if the page has any listed children * - * @return boolean + * @return bool */ public function hasListedChildren(): bool { @@ -196,7 +196,7 @@ public function hasListedChildren(): bool /** * Checks if the page has any unlisted children * - * @return boolean + * @return bool */ public function hasUnlistedChildren(): bool { @@ -205,7 +205,7 @@ public function hasUnlistedChildren(): bool /** * @deprecated 3.0.0 Use `Page::hasListedChildren` instead - * @return boolean + * @return bool */ public function hasVisibleChildren(): bool { diff --git a/src/Cms/HasMethods.php b/src/Cms/HasMethods.php index 9fd7065c86..2042eabe10 100644 --- a/src/Cms/HasMethods.php +++ b/src/Cms/HasMethods.php @@ -39,7 +39,7 @@ public function callMethod(string $method, array $args = []) * * @internal * @param string $method - * @return boolean + * @return bool */ public function hasMethod(string $method): bool { diff --git a/src/Cms/Language.php b/src/Cms/Language.php index a5f96a8de1..e40c598b5b 100644 --- a/src/Cms/Language.php +++ b/src/Cms/Language.php @@ -129,7 +129,7 @@ public function code(): string * * @param string $from * @param string $to - * @return boolean + * @return bool */ protected static function converter(string $from, string $to): bool { @@ -201,7 +201,7 @@ public static function create(array $props) * all its translation files * * @internal - * @return boolean + * @return bool */ public function delete(): bool { @@ -270,7 +270,7 @@ public function direction(): string /** * Check if the language file exists * - * @return boolean + * @return bool */ public function exists(): bool { @@ -281,7 +281,7 @@ public function exists(): bool * Checks if this is the default language * for the site. * - * @return boolean + * @return bool */ public function isDefault(): bool { @@ -430,7 +430,7 @@ protected function setCode(string $code) } /** - * @param boolean $default + * @param bool $default * @return self */ protected function setDefault(bool $default = false) diff --git a/src/Cms/Media.php b/src/Cms/Media.php index 544749abb4..804ac3ccd1 100644 --- a/src/Cms/Media.php +++ b/src/Cms/Media.php @@ -59,7 +59,7 @@ public static function link(Model $model = null, string $hash, string $filename) * * @param string $src * @param string $dest - * @return boolean + * @return bool */ public static function publish(string $src, string $dest): bool { diff --git a/src/Cms/ModelWithContent.php b/src/Cms/ModelWithContent.php index 7d342327b8..82b94cfa7a 100644 --- a/src/Cms/ModelWithContent.php +++ b/src/Cms/ModelWithContent.php @@ -194,8 +194,8 @@ abstract public function contentFileName(): string; * Decrement a given field value * * @param string $field - * @param integer $by - * @param integer $min + * @param int $by + * @param int $min * @return self */ public function decrement(string $field, int $by = 1, int $min = 0) @@ -231,8 +231,8 @@ public function errors(): array * Increment a given field value * * @param string $field - * @param integer $by - * @param integer $max + * @param int $by + * @param int $max * @return self */ public function increment(string $field, int $by = 1, int $max = null) @@ -249,7 +249,7 @@ public function increment(string $field, int $by = 1, int $max = null) /** * Checks if the data has any errors * - * @return boolean + * @return bool */ public function isValid(): bool { @@ -618,7 +618,7 @@ public function translations() * * @param array $input * @param string $languageCode - * @param boolean $validate + * @param bool $validate * @return self */ public function update(array $input = null, string $languageCode = null, bool $validate = false) @@ -657,7 +657,7 @@ public function update(array $input = null, string $languageCode = null, bool $v * @internal * @param array $data * @param string $languageCode - * @return boolean + * @return bool */ public function writeContent(array $data, string $languageCode = null): bool { diff --git a/src/Cms/Page.php b/src/Cms/Page.php index c6dc55a7f0..7b230f8eed 100644 --- a/src/Cms/Page.php +++ b/src/Cms/Page.php @@ -104,7 +104,7 @@ class Page extends ModelWithContent /** * The sorting number * - * @var integer|null + * @var int|null */ protected $num; @@ -352,7 +352,7 @@ public function controller($data = [], $contentType = 'html'): array * Returns a number indicating how deep the page * is nested within the content folder * - * @return integer + * @return int */ public function depth(): int { @@ -456,7 +456,7 @@ public static function factory($props) * Checks if the intended template * for the page exists. * - * @return boolean + * @return bool */ public function hasTemplate(): bool { @@ -563,7 +563,7 @@ public function isActive(): bool * Checks if the page is a direct or indirect ancestor of the given $page object * * @param Page $child - * @return boolean + * @return bool */ public function isAncestorOf(Page $child): bool { @@ -575,7 +575,7 @@ public function isAncestorOf(Page $child): bool * pages cache. This will also check if one * of the ignore rules from the config kick in. * - * @return boolean + * @return bool */ public function isCacheable(): bool { @@ -628,7 +628,7 @@ public function isCacheable(): bool * Checks if the page is a child of the given page * * @param \Kirby\Cms\Page|string $parent - * @return boolean + * @return bool */ public function isChildOf($parent): bool { @@ -643,7 +643,7 @@ public function isChildOf($parent): bool * Checks if the page is a descendant of the given page * * @param \Kirby\Cms\Page|string $parent - * @return boolean + * @return bool */ public function isDescendantOf($parent): bool { @@ -661,7 +661,7 @@ public function isDescendantOf($parent): bool /** * Checks if the page is a descendant of the currently active page * - * @return boolean + * @return bool */ public function isDescendantOfActive(): bool { @@ -675,7 +675,7 @@ public function isDescendantOfActive(): bool /** * Checks if the current page is a draft * - * @return boolean + * @return bool */ public function isDraft(): bool { @@ -695,7 +695,7 @@ public function isErrorPage(): bool /** * Check if the page can be read by the current user * - * @return boolean + * @return bool */ public function isReadable(): bool { @@ -725,7 +725,7 @@ public function isHomePage(): bool * home and error page to stop certain * actions. That's why there's a shortcut. * - * @return boolean + * @return bool */ public function isHomeOrErrorPage(): bool { @@ -744,7 +744,7 @@ public function isInvisible(): bool /** * Checks if the page has a sorting number * - * @return boolean + * @return bool */ public function isListed(): bool { @@ -776,7 +776,7 @@ public function isOpen(): bool /** * Checks if the page is sortable * - * @return boolean + * @return bool */ public function isSortable(): bool { @@ -786,7 +786,7 @@ public function isSortable(): bool /** * Checks if the page has no sorting number * - * @return boolean + * @return bool */ public function isUnlisted(): bool { @@ -808,7 +808,7 @@ public function isVisible(): bool * * @internal * @param string $token - * @return boolean + * @return bool */ public function isVerified(string $token = null) { @@ -884,7 +884,7 @@ public function modified(string $format = null, string $handler = null) /** * Returns the sorting number * - * @return integer|null + * @return int|null */ public function num(): ?int { @@ -1099,7 +1099,7 @@ public function previewUrl(): ?string * * @param array $data * @param string $contentType - * @param integer $code + * @param int $code * @return string */ public function render(array $data = [], $contentType = 'html'): string @@ -1241,7 +1241,7 @@ protected function setDirname(string $dirname = null) /** * Sets the draft flag * - * @param boolean $isDraft + * @param bool $isDraft * @return self */ protected function setIsDraft(bool $isDraft = null) @@ -1253,7 +1253,7 @@ protected function setIsDraft(bool $isDraft = null) /** * Sets the sorting number * - * @param integer $num + * @param int $num * @return self */ protected function setNum(int $num = null) diff --git a/src/Cms/PageActions.php b/src/Cms/PageActions.php index d180c461a5..32675a0508 100644 --- a/src/Cms/PageActions.php +++ b/src/Cms/PageActions.php @@ -160,7 +160,7 @@ protected function changeSlugForLanguage(string $slug, string $languageCode = nu * to either draft, listed or unlisted * * @param string $status "draft", "listed" or "unlisted" - * @param integer $position Optional sorting number + * @param int $position Optional sorting number * @return self */ public function changeStatus(string $status, int $position = null) @@ -462,8 +462,8 @@ public function createChild(array $props) * Create the sorting number for the page * depending on the blueprint settings * - * @param integer $num - * @return integer + * @param int $num + * @return int */ public function createNum(int $num = null): int { @@ -756,7 +756,7 @@ public function unpublish() * * @param array $input * @param string $language - * @param boolean $validate + * @param bool $validate * @return self */ public function update(array $input = null, string $language = null, bool $validate = false) diff --git a/src/Cms/PageBlueprint.php b/src/Cms/PageBlueprint.php index 7256bc51f0..32e629d2e5 100644 --- a/src/Cms/PageBlueprint.php +++ b/src/Cms/PageBlueprint.php @@ -185,7 +185,7 @@ public function options(): array * button in the panel and redirects it to a * different URL if necessary. * - * @return string|boolean + * @return string|bool */ public function preview() { diff --git a/src/Cms/PageSiblings.php b/src/Cms/PageSiblings.php index 16af4c37a6..6bd58bbdcd 100644 --- a/src/Cms/PageSiblings.php +++ b/src/Cms/PageSiblings.php @@ -15,7 +15,7 @@ trait PageSiblings { /** * @deprecated 3.0.0 Use `Page::hasNextUnlisted` instead - * @return boolean + * @return bool */ public function hasNextInvisible(): bool { @@ -46,7 +46,7 @@ public function hasNextUnlisted(): bool /** * @deprecated 3.0.0 Use `Page::hasNextListed` instead - * @return boolean + * @return bool */ public function hasNextVisible(): bool { @@ -55,7 +55,7 @@ public function hasNextVisible(): bool /** * @deprecated 3.0.0 Use `Page::hasPrevUnlisted` instead - * @return boolean + * @return bool */ public function hasPrevInvisible(): bool { @@ -86,7 +86,7 @@ public function hasPrevUnlisted(): bool /** * @deprecated 3.0.0 Use `Page::hasPrevListed instead` - * @return boolean + * @return bool */ public function hasPrevVisible(): bool { diff --git a/src/Cms/Responder.php b/src/Cms/Responder.php index bcb5896853..0ed5169d70 100644 --- a/src/Cms/Responder.php +++ b/src/Cms/Responder.php @@ -19,7 +19,7 @@ class Responder /** * HTTP status code * - * @var integer + * @var int */ protected $code = null; @@ -73,8 +73,8 @@ public function body(string $body = null) /** * Setter and getter for the status code * - * @param integer $code - * @return integer|self + * @param int $code + * @return int|self */ public function code(int $code = null) { @@ -156,7 +156,7 @@ public function json(array $json = null) * Shortcut to create a redirect response * * @param string|null $location - * @param integer|null $code + * @param int|null $code * @return self */ public function redirect(?string $location = null, ?int $code = null) diff --git a/src/Cms/Site.php b/src/Cms/Site.php index 6be57371a1..e0d10847ec 100644 --- a/src/Cms/Site.php +++ b/src/Cms/Site.php @@ -273,7 +273,7 @@ public function errorPageId(): string /** * Checks if the site exists on disk * - * @return boolean + * @return bool */ public function exists(): bool { diff --git a/src/Cms/SiteBlueprint.php b/src/Cms/SiteBlueprint.php index a98910d876..72d84be25c 100644 --- a/src/Cms/SiteBlueprint.php +++ b/src/Cms/SiteBlueprint.php @@ -45,7 +45,7 @@ public function __construct(array $props) * button in the panel and redirects it to a * different URL if necessary. * - * @return string|boolean + * @return string|bool */ public function preview() { diff --git a/src/Cms/System.php b/src/Cms/System.php index ff5f2427c9..5db6087bb9 100644 --- a/src/Cms/System.php +++ b/src/Cms/System.php @@ -79,7 +79,7 @@ public function status(): array /** * Check for a writable accounts folder * - * @return boolean + * @return bool */ public function accounts(): bool { @@ -89,7 +89,7 @@ public function accounts(): bool /** * Check for a writable content folder * - * @return boolean + * @return bool */ public function content(): bool { @@ -99,7 +99,7 @@ public function content(): bool /** * Check for an existing curl extension * - * @return boolean + * @return bool */ public function curl(): bool { @@ -165,7 +165,7 @@ public function init() * option must be explicitly set to true * to get the installer up and running. * - * @return boolean + * @return bool */ public function isInstallable(): bool { @@ -175,7 +175,7 @@ public function isInstallable(): bool /** * Check if Kirby is already installed * - * @return boolean + * @return bool */ public function isInstalled(): bool { @@ -185,7 +185,7 @@ public function isInstalled(): bool /** * Check if this is a local installation * - * @return boolean + * @return bool */ public function isLocal(): bool { @@ -218,7 +218,7 @@ public function isLocal(): bool /** * Check if all tests pass * - * @return boolean + * @return bool */ public function isOk(): bool { @@ -318,7 +318,7 @@ public function license() /** * Check for an existing mbstring extension * - * @return boolean + * @return bool */ public function mbString(): bool { @@ -328,7 +328,7 @@ public function mbString(): bool /** * Check for a writable media folder * - * @return boolean + * @return bool */ public function media(): bool { @@ -338,7 +338,7 @@ public function media(): bool /** * Check for a valid PHP version * - * @return boolean + * @return bool */ public function php(): bool { @@ -352,7 +352,7 @@ public function php(): bool * * @param string $license * @param string $email - * @return boolean + * @return bool */ public function register(string $license = null, string $email = null): bool { @@ -404,7 +404,7 @@ public function register(string $license = null, string $email = null): bool /** * Check for a valid server environment * - * @return boolean + * @return bool */ public function server(): bool { @@ -424,7 +424,7 @@ public function server(): bool /** * Check for a writable sessions folder * - * @return boolean + * @return bool */ public function sessions(): bool { diff --git a/src/Cms/Template.php b/src/Cms/Template.php index c4b0690c41..b7df18edab 100644 --- a/src/Cms/Template.php +++ b/src/Cms/Template.php @@ -74,7 +74,7 @@ public function __toString(): string /** * Checks if the template exists * - * @return boolean + * @return bool */ public function exists(): bool { @@ -190,7 +190,7 @@ public function type(): string /** * Checks if the template uses the default type * - * @return boolean + * @return bool */ public function hasDefaultType(): bool { diff --git a/src/Cms/User.php b/src/Cms/User.php index c28d60a2e3..3101e16a11 100644 --- a/src/Cms/User.php +++ b/src/Cms/User.php @@ -248,7 +248,7 @@ public function email(): ?string /** * Checks if the user exists * - * @return boolean + * @return bool */ public function exists(): bool { @@ -342,7 +342,7 @@ public function is(User $user = null): bool /** * Checks if this user has the admin role * - * @return boolean + * @return bool */ public function isAdmin(): bool { @@ -353,7 +353,7 @@ public function isAdmin(): bool * Checks if the current user is the virtual * Kirby user * - * @return boolean + * @return bool */ public function isKirby(): bool { @@ -363,7 +363,7 @@ public function isKirby(): bool /** * Checks if the current user is this user * - * @return boolean + * @return bool */ public function isLoggedIn(): bool { @@ -374,7 +374,7 @@ public function isLoggedIn(): bool * Checks if the user is the last one * with the admin role * - * @return boolean + * @return bool */ public function isLastAdmin(): bool { @@ -384,7 +384,7 @@ public function isLastAdmin(): bool /** * Checks if the user is the last user * - * @return boolean + * @return bool */ public function isLastUser(): bool { @@ -857,7 +857,7 @@ public function username(): ?string * Compares the given password with the stored one * * @param string $password - * @return boolean + * @return bool * * @throws NotFoundException If the user has no password * @throws InvalidArgumentException If the entered password is not valid diff --git a/src/Cms/UserActions.php b/src/Cms/UserActions.php index 97dc0efd90..3f533dbfc6 100644 --- a/src/Cms/UserActions.php +++ b/src/Cms/UserActions.php @@ -293,7 +293,7 @@ protected function updateCredentials(array $credentials): bool * Writes the account information to disk * * @param array $credentials - * @return boolean + * @return bool */ protected function writeCredentials(array $credentials): bool { diff --git a/src/Data/Data.php b/src/Data/Data.php index eadc9fb5f6..76c4e1d6c9 100644 --- a/src/Data/Data.php +++ b/src/Data/Data.php @@ -116,7 +116,7 @@ public static function read(string $file, string $type = null): array * @param string $file * @param array $data * @param string $type - * @return boolean + * @return bool */ public static function write(string $file = null, array $data = [], string $type = null): bool { diff --git a/src/Data/Handler.php b/src/Data/Handler.php index d47bf57901..71340a0996 100644 --- a/src/Data/Handler.php +++ b/src/Data/Handler.php @@ -56,7 +56,7 @@ public static function read(string $file): array * * @param string $file * @param array $data - * @return boolean + * @return bool */ public static function write(string $file = null, array $data = []): bool { diff --git a/src/Data/PHP.php b/src/Data/PHP.php index 7251e3b546..15667b3516 100644 --- a/src/Data/PHP.php +++ b/src/Data/PHP.php @@ -76,7 +76,7 @@ public static function read(string $file): array * * @param string $file * @param array $data - * @return boolean + * @return bool */ public static function write(string $file = null, array $data = []): bool { diff --git a/src/Database/Database.php b/src/Database/Database.php index 30bd1f751d..1de9bd299f 100644 --- a/src/Database/Database.php +++ b/src/Database/Database.php @@ -64,7 +64,7 @@ class Database /** * Set to true to throw exceptions on failed queries * - * @var boolean + * @var bool */ protected $fail = false; @@ -232,7 +232,7 @@ public function connection() /** * Sets the exception mode for the next query * - * @param boolean $fail + * @param bool $fail * @return \Kirby\Database\Database */ public function fail(bool $fail = true) @@ -358,7 +358,7 @@ public function name(): ?string * * @param string $query * @param array $bindings - * @return boolean + * @return bool */ protected function hit(string $query, array $bindings = []): bool { @@ -455,7 +455,7 @@ public function query(string $query, array $bindings = [], array $params = []) * * @param string $query * @param array $bindings - * @return boolean + * @return bool */ public function execute(string $query, array $bindings = []): bool { @@ -491,7 +491,7 @@ public function table(string $table) * Checks if a table exists in the current database * * @param string $table - * @return boolean + * @return bool */ public function validateTable(string $table): bool { @@ -515,7 +515,7 @@ public function validateTable(string $table): bool * * @param string $table * @param string $column - * @return boolean + * @return bool */ public function validateColumn(string $table, string $column): bool { @@ -544,7 +544,7 @@ public function validateColumn(string $table, string $column): bool * * @param string $table * @param array $columns - * @return boolean + * @return bool */ public function createTable($table, $columns = []): bool { @@ -566,7 +566,7 @@ public function createTable($table, $columns = []): bool * Drops a table * * @param string $table - * @return boolean + * @return bool */ public function dropTable($table): bool { diff --git a/src/Database/Query.php b/src/Database/Query.php index 660044f26f..c1e66847d3 100644 --- a/src/Database/Query.php +++ b/src/Database/Query.php @@ -87,7 +87,7 @@ class Query /** * Boolean for if exceptions should be thrown on failing queries * - * @var boolean + * @var bool */ protected $fail = false; @@ -129,21 +129,21 @@ class Query /** * The offset, which should be applied to the select query * - * @var integer + * @var int */ protected $offset = 0; /** * The limit, which should be applied to the select query * - * @var integer + * @var int */ protected $limit; /** * Boolean to enable query debugging * - * @var boolean + * @var bool */ protected $debug = false; @@ -184,7 +184,7 @@ protected function reset() * If enabled, the query will return an array with all important info about * the query instead of actually executing the query and returning results * - * @param boolean $debug + * @param bool $debug * @return \Kirby\Database\Query */ public function debug(bool $debug = true) @@ -196,7 +196,7 @@ public function debug(bool $debug = true) /** * Enables distinct select clauses. * - * @param boolean $distinct + * @param bool $distinct * @return \Kirby\Database\Query */ public function distinct(bool $distinct = true) @@ -209,7 +209,7 @@ public function distinct(bool $distinct = true) * Enables failing queries. * If enabled queries will no longer fail silently but throw an exception * - * @param boolean $fail + * @param bool $fail * @return \Kirby\Database\Query */ public function fail(bool $fail = true) @@ -880,7 +880,7 @@ public function insert($values = null) * * @param array $values You can pass values here or set them with ->values() before * @param mixed $where You can pass a where clause here or set it with ->where() before - * @return boolean + * @return bool */ public function update($values = null, $where = null) { @@ -891,7 +891,7 @@ public function update($values = null, $where = null) * Fires a delete query * * @param mixed $where You can pass a where clause here or set it with ->where() before - * @return boolean + * @return bool */ public function delete($where = null) { diff --git a/src/Database/Sql.php b/src/Database/Sql.php index 5bd0a3f0db..09e18fce7b 100644 --- a/src/Database/Sql.php +++ b/src/Database/Sql.php @@ -112,7 +112,7 @@ public function columnDefault(array $column): array * * @param string $table * @param string $column - * @param boolean $enforceQualified + * @param bool $enforceQualified * @return string|null */ public function columnName(string $table, string $column, bool $enforceQualified = false): ?string @@ -483,8 +483,8 @@ public function joins(array $joins = null): array /** * Creates a limit and offset query instruction * - * @param integer $offset - * @param integer|null $limit + * @param int $offset + * @param int|null $limit * @return array */ public function limit(int $offset = 0, int $limit = null): array @@ -780,7 +780,7 @@ public function update(array $params = []): array * * @param string $table * @param string $column - * @return boolean + * @return bool */ public function validateColumn(string $table, string $column): bool { @@ -797,8 +797,8 @@ public function validateColumn(string $table, string $column): bool * @param string $table Table name * @param mixed $values A value string or array of values * @param string $separator A separator which should be used to join values - * @param boolean $set If true builds a set list of values for update clauses - * @param boolean $enforceQualified Always use fully qualified column names + * @param bool $set If true builds a set list of values for update clauses + * @param bool $enforceQualified Always use fully qualified column names */ public function values(string $table, $values, string $separator = ', ', bool $set = true, bool $enforceQualified = false): array { diff --git a/src/Exception/Exception.php b/src/Exception/Exception.php index 303a7665b1..f6bc58834f 100644 --- a/src/Exception/Exception.php +++ b/src/Exception/Exception.php @@ -42,7 +42,7 @@ class Exception extends \Exception /** * Whether the exception message could be translated into the user's language * - * @var boolean + * @var bool */ protected $isTranslated = true; @@ -194,7 +194,7 @@ final public function getHttpCode(): int * Returns whether the exception message could * be translated into the user's language * - * @return boolean + * @return bool */ final public function isTranslated(): bool { diff --git a/src/Http/Cookie.php b/src/Http/Cookie.php index 8e2f03c6e7..136863369b 100644 --- a/src/Http/Cookie.php +++ b/src/Http/Cookie.php @@ -36,7 +36,7 @@ class Cookie * @param string $value The cookie content * @param array $options Array of options: * lifetime, path, domain, secure, httpOnly - * @return boolean true: cookie was created, + * @return bool true: cookie was created, * false: cookie creation failed */ public static function set(string $key, string $value, array $options = []): bool @@ -91,7 +91,7 @@ public static function lifetime(int $minutes): int * @param string $value The cookie content * @param array $options Array of options: * path, domain, secure, httpOnly - * @return boolean true: cookie was created, + * @return bool true: cookie was created, * false: cookie creation failed */ public static function forever(string $key, string $value, array $options = []): bool @@ -128,7 +128,7 @@ public static function get(string $key = null, string $default = null) * Checks if a cookie exists * * @param string $key - * @return boolean + * @return bool */ public static function exists(string $key): bool { @@ -191,7 +191,7 @@ protected static function parse(string $string) * * * @param string $key The name of the cookie - * @return boolean true: the cookie has been removed, + * @return bool true: the cookie has been removed, * false: the cookie could not be removed */ public static function remove(string $key): bool diff --git a/src/Http/Header.php b/src/Http/Header.php index f0d7327bf3..46f91382ec 100644 --- a/src/Http/Header.php +++ b/src/Http/Header.php @@ -58,7 +58,7 @@ class Header * * @param string $mime * @param string $charset - * @param boolean $send + * @param bool $send * @return string|void */ public static function contentType(string $mime, string $charset = 'UTF-8', bool $send = true) @@ -108,7 +108,7 @@ public static function create($key, string $value = null): string * * @param string $mime * @param string $charset - * @param boolean $send + * @param bool $send * @return string|void */ public static function type(string $mime, string $charset = 'UTF-8', bool $send = true) @@ -124,7 +124,7 @@ public static function type(string $mime, string $charset = 'UTF-8', bool $send * as 3 digits followed by a space and a message, e.g. '999 Custom Status'. * * @param int|string $code The HTTP status code - * @param boolean $send If set to false the header will be returned instead + * @param bool $send If set to false the header will be returned instead * @return string|void */ public static function status($code = null, bool $send = true) @@ -154,7 +154,7 @@ public static function status($code = null, bool $send = true) /** * Sends a 200 header * - * @param boolean $send + * @param bool $send * @return string|void */ public static function success(bool $send = true) @@ -165,7 +165,7 @@ public static function success(bool $send = true) /** * Sends a 201 header * - * @param boolean $send + * @param bool $send * @return string|void */ public static function created(bool $send = true) @@ -176,7 +176,7 @@ public static function created(bool $send = true) /** * Sends a 202 header * - * @param boolean $send + * @param bool $send * @return string|void */ public static function accepted(bool $send = true) @@ -187,7 +187,7 @@ public static function accepted(bool $send = true) /** * Sends a 400 header * - * @param boolean $send + * @param bool $send * @return string|void */ public static function error(bool $send = true) @@ -198,7 +198,7 @@ public static function error(bool $send = true) /** * Sends a 403 header * - * @param boolean $send + * @param bool $send * @return string|void */ public static function forbidden(bool $send = true) @@ -209,7 +209,7 @@ public static function forbidden(bool $send = true) /** * Sends a 404 header * - * @param boolean $send + * @param bool $send * @return string|void */ public static function notfound(bool $send = true) @@ -220,7 +220,7 @@ public static function notfound(bool $send = true) /** * Sends a 404 header * - * @param boolean $send + * @param bool $send * @return string|void */ public static function missing(bool $send = true) @@ -231,7 +231,7 @@ public static function missing(bool $send = true) /** * Sends a 410 header * - * @param boolean $send + * @param bool $send * @return string|void */ public static function gone(bool $send = true) @@ -242,7 +242,7 @@ public static function gone(bool $send = true) /** * Sends a 500 header * - * @param boolean $send + * @param bool $send * @return string|void */ public static function panic(bool $send = true) @@ -253,7 +253,7 @@ public static function panic(bool $send = true) /** * Sends a 503 header * - * @param boolean $send + * @param bool $send * @return string|void */ public static function unavailable(bool $send = true) @@ -266,7 +266,7 @@ public static function unavailable(bool $send = true) * * @param string $url * @param int $code - * @param boolean $send + * @param bool $send * @return string|void */ public static function redirect(string $url, int $code = 302, bool $send = true) diff --git a/src/Http/Params.php b/src/Http/Params.php index 71d7bb36c9..5d0fa44c8a 100644 --- a/src/Http/Params.php +++ b/src/Http/Params.php @@ -116,8 +116,8 @@ public static function separator(): string * Converts the params object to a params string * which can then be used in the URL builder again * - * @param boolean $leadingSlash - * @param boolean $trailingSlash + * @param bool $leadingSlash + * @param bool $trailingSlash * @return string|null */ public function toString($leadingSlash = false, $trailingSlash = false): string diff --git a/src/Http/Remote.php b/src/Http/Remote.php index 686b5780e4..b5dbce7d87 100644 --- a/src/Http/Remote.php +++ b/src/Http/Remote.php @@ -113,7 +113,7 @@ public static function __callStatic(string $method, array $arguments = []) /** * Returns the http status code * - * @return integer|null + * @return int|null */ public function code(): ?int { diff --git a/src/Http/Request.php b/src/Http/Request.php index 7b77e8e32b..7655c29f92 100644 --- a/src/Http/Request.php +++ b/src/Http/Request.php @@ -145,7 +145,7 @@ public function __debugInfo(): array /** * Detects ajax requests * @deprecated 3.1.0 No longer reliable, especially with the fetch api. - * @return boolean + * @return bool */ public function ajax(): bool { @@ -191,7 +191,7 @@ public function body() /** * Checks if the request has been made from the command line * - * @return boolean + * @return bool */ public function cli(): bool { @@ -317,7 +317,7 @@ public function headers(): array * matches the name of the request method. * * @param string $method - * @return boolean + * @return bool */ public function is(string $method): bool { @@ -363,7 +363,7 @@ public function query() /** * Checks for a valid SSL connection * - * @return boolean + * @return bool */ public function ssl(): bool { diff --git a/src/Http/Response.php b/src/Http/Response.php index 1c9d3097b5..25c2b056ff 100644 --- a/src/Http/Response.php +++ b/src/Http/Response.php @@ -60,7 +60,7 @@ class Response * * @param string $body * @param string $type - * @param integer $code + * @param int $code * @param array $headers * @param string $charset */ @@ -217,8 +217,8 @@ public function headers(): array * header and automatic conversion of arrays. * * @param string|array $body - * @param integer $code - * @param boolean $pretty + * @param int $code + * @param bool $pretty * @param array $headers * @return self */ @@ -242,7 +242,7 @@ public static function json($body = '', ?int $code = null, ?bool $pretty = null, * given location. * * @param string $location - * @param integer $code + * @param int $code * @return self */ public static function redirect(?string $location = null, ?int $code = null) diff --git a/src/Http/Server.php b/src/Http/Server.php index 132f4740aa..b5353c4436 100644 --- a/src/Http/Server.php +++ b/src/Http/Server.php @@ -34,7 +34,7 @@ public static function address(): string /** * Checks if the request is being served by the CLI * - * @return boolean + * @return bool */ public static function cli(): bool { @@ -131,7 +131,7 @@ public static function port(bool $forwarded = false): int /** * Checks for a https request * - * @return boolean + * @return bool */ public static function https(): bool { diff --git a/src/Http/Uri.php b/src/Http/Uri.php index ab46bea639..8d77c91173 100644 --- a/src/Http/Uri.php +++ b/src/Http/Uri.php @@ -90,7 +90,7 @@ class Uri protected $scheme = 'http'; /** - * @var boolean + * @var bool */ protected $slash = false; @@ -237,7 +237,7 @@ public function clone(array $props = []) /** * @param array $props - * @param boolean $forwarded + * @param bool $forwarded * @return self */ public static function current(array $props = [], bool $forwarded = false) @@ -289,7 +289,7 @@ public function domain(): ?string } /** - * @return boolean + * @return bool */ public function hasFragment(): bool { @@ -297,7 +297,7 @@ public function hasFragment(): bool } /** - * @return boolean + * @return bool */ public function hasPath(): bool { @@ -305,7 +305,7 @@ public function hasPath(): bool } /** - * @return boolean + * @return bool */ public function hasQuery(): bool { diff --git a/src/Http/Url.php b/src/Http/Url.php index fd3396ebf9..da21800419 100644 --- a/src/Http/Url.php +++ b/src/Http/Url.php @@ -112,7 +112,7 @@ public static function index(array $props = [], bool $forwarded = false): string * Checks if an URL is absolute * * @param string $url - * @return boolean + * @return bool */ public static function isAbsolute(string $url = null): bool { @@ -194,7 +194,7 @@ public static function last(): string * * @param string $url * @param int $length - * @param boolean $base + * @param bool $base * @param string $rep * @return string */ diff --git a/src/Http/Visitor.php b/src/Http/Visitor.php index a9204eed75..8ee49b8051 100644 --- a/src/Http/Visitor.php +++ b/src/Http/Visitor.php @@ -170,7 +170,7 @@ public function acceptedMimeTypes() * Checks if the user accepts the given mime type * * @param string $mimeType - * @return boolean + * @return bool */ public function acceptsMimeType(string $mimeType): bool { diff --git a/src/Image/Exif.php b/src/Image/Exif.php index ef8393a74c..08aeef8cb7 100644 --- a/src/Image/Exif.php +++ b/src/Image/Exif.php @@ -173,7 +173,7 @@ public function iso() /** * Checks if this is a color picture * - * @return boolean|null + * @return bool|null */ public function isColor() { @@ -183,7 +183,7 @@ public function isColor() /** * Checks if this is a bw picture * - * @return boolean|null + * @return bool|null */ public function isBW(): bool { diff --git a/src/Image/Image.php b/src/Image/Image.php index 2c30272604..c367e86db4 100644 --- a/src/Image/Image.php +++ b/src/Image/Image.php @@ -126,7 +126,7 @@ public function exif() /** * Sends an appropriate header for the asset * - * @param boolean $send + * @param bool $send * @return \Kirby\Http\Response|string */ public function header(bool $send = true) @@ -168,7 +168,7 @@ public function imagesize(): array /** * Checks if the dimensions of the asset are portrait * - * @return boolean + * @return bool */ public function isPortrait(): bool { @@ -178,7 +178,7 @@ public function isPortrait(): bool /** * Checks if the dimensions of the asset are landscape * - * @return boolean + * @return bool */ public function isLandscape(): bool { @@ -188,7 +188,7 @@ public function isLandscape(): bool /** * Checks if the dimensions of the asset are square * - * @return boolean + * @return bool */ public function isSquare(): bool { diff --git a/src/Session/FileSessionStore.php b/src/Session/FileSessionStore.php index 6a03bf2d66..d37767c30e 100644 --- a/src/Session/FileSessionStore.php +++ b/src/Session/FileSessionStore.php @@ -91,7 +91,7 @@ public function createId(int $expiryTime): string * * @param int $expiryTime Timestamp * @param string $id Session ID - * @return boolean true: session exists, + * @return bool true: session exists, * false: session doesn't exist */ public function exists(int $expiryTime, string $id): bool diff --git a/src/Session/Session.php b/src/Session/Session.php index cfd99a521e..a8b5fbba18 100644 --- a/src/Session/Session.php +++ b/src/Session/Session.php @@ -180,7 +180,7 @@ public function mode(string $mode = null) /** * Gets the session start time * - * @return integer Timestamp + * @return int Timestamp */ public function startTime(): int { @@ -191,8 +191,8 @@ public function startTime(): int * Gets or sets the session expiry time * Setting the expiry time also updates the duration and regenerates the session token * - * @param string|integer $expiryTime Optional new expiry timestamp or time string to set - * @return integer Timestamp + * @param string|int $expiryTime Optional new expiry timestamp or time string to set + * @return int Timestamp */ public function expiryTime($expiryTime = null): int { @@ -226,8 +226,8 @@ public function expiryTime($expiryTime = null): int * Gets or sets the session duration * Setting the duration also updates the expiry time and regenerates the session token * - * @param integer $duration Optional new duration in seconds to set - * @return integer Number of seconds + * @param int $duration Optional new duration in seconds to set + * @return int Number of seconds */ public function duration(int $duration = null): int { @@ -252,8 +252,8 @@ public function duration(int $duration = null): int /** * Gets or sets the session timeout * - * @param integer|false $timeout Optional new timeout to set or false to disable timeout - * @return integer|false Number of seconds or false for "no timeout" + * @param int|false $timeout Optional new timeout to set or false to disable timeout + * @return int|false Number of seconds or false for "no timeout" */ public function timeout($timeout = null) { @@ -288,8 +288,8 @@ public function timeout($timeout = null) * Gets or sets the renewable flag * Automatically renews the session if renewing gets enabled * - * @param boolean $renewable Optional new renewable flag to set - * @return boolean + * @param bool $renewable Optional new renewable flag to set + * @return bool */ public function renewable(bool $renewable = null): bool { @@ -478,7 +478,7 @@ public function regenerateToken() * Returns whether the session token needs to be retransmitted to the client * Only relevant in header and manual modes * - * @return boolean + * @return bool */ public function needsRetransmission(): bool { @@ -584,9 +584,9 @@ protected function parseToken(string $token, bool $withoutKey = false) /** * Makes sure that the given value is a valid timestamp * - * @param string|integer $time Timestamp or date string (must be supported by `strtotime()`) - * @param integer $now Timestamp to use as a base for the calculation of relative dates - * @return integer Timestamp value + * @param string|int $time Timestamp or date string (must be supported by `strtotime()`) + * @param int $now Timestamp to use as a base for the calculation of relative dates + * @return int Timestamp value */ protected static function timeToTimestamp($time, int $now = null): int { @@ -762,7 +762,7 @@ protected function autoRenew() * Checks if the session can be renewed and if the last renewal * was more than half a session duration ago * - * @return boolean + * @return bool */ protected function needsRenewal(): bool { diff --git a/src/Session/SessionData.php b/src/Session/SessionData.php index 37acaddeee..77d4039331 100644 --- a/src/Session/SessionData.php +++ b/src/Session/SessionData.php @@ -62,8 +62,8 @@ public function set($key, $value = null) * Increments one or multiple session values by a specified amount * * @param string|array $key The key to increment or an array with multiple keys - * @param integer $by Increment by which amount? - * @param integer $max Maximum amount (value is not incremented further) + * @param int $by Increment by which amount? + * @param int $max Maximum amount (value is not incremented further) * @return void */ public function increment($key, int $by = 1, $max = null) @@ -116,8 +116,8 @@ public function increment($key, int $by = 1, $max = null) * Decrements one or multiple session values by a specified amount * * @param string|array $key The key to decrement or an array with multiple keys - * @param integer $by Decrement by which amount? - * @param integer $min Minimum amount (value is not decremented further) + * @param int $by Decrement by which amount? + * @param int $min Minimum amount (value is not decremented further) * @return void */ public function decrement($key, int $by = 1, $min = null) diff --git a/src/Session/SessionStore.php b/src/Session/SessionStore.php index b916e9a509..ba7fda7978 100644 --- a/src/Session/SessionStore.php +++ b/src/Session/SessionStore.php @@ -27,7 +27,7 @@ abstract public function createId(int $expiryTime): string; * * @param int $expiryTime Timestamp * @param string $id Session ID - * @return boolean true: session exists, + * @return bool true: session exists, * false: session doesn't exist */ abstract public function exists(int $expiryTime, string $id): bool; diff --git a/src/Toolkit/A.php b/src/Toolkit/A.php index ba15bd4df8..ec04b90e06 100644 --- a/src/Toolkit/A.php +++ b/src/Toolkit/A.php @@ -132,7 +132,7 @@ public static function join($value, $separator = ', ') * * @param array $array1 * @param array $array2 - * @param boolean $mode Behavior for elements with numeric keys; + * @param bool $mode Behavior for elements with numeric keys; * A::MERGE_APPEND: elements are appended, keys are reset; * A::MERGE_OVERWRITE: elements are overwritten, keys are preserved * A::MERGE_REPLACE: non-associative arrays are completely replaced @@ -501,7 +501,7 @@ public static function sort(array $array, string $field, string $direction = 'de * * * @param array $array The array to analyze - * @return boolean true: The array is associative false: It's not + * @return bool true: The array is associative false: It's not */ public static function isAssociative(array $array): bool { diff --git a/src/Toolkit/Collection.php b/src/Toolkit/Collection.php index 68c511421d..a0fbd70065 100644 --- a/src/Toolkit/Collection.php +++ b/src/Toolkit/Collection.php @@ -439,7 +439,7 @@ public function get($key, $default = null) * * @param array|object $item * @param string $attribute - * @param boolean $split + * @param bool $split * @param mixed $related * @return mixed */ @@ -545,7 +545,7 @@ public function groupBy($field, bool $i = true) /** * Checks if the number of elements is zero * - * @return boolean + * @return bool */ public function isEmpty(): bool { @@ -555,7 +555,7 @@ public function isEmpty(): bool /** * Checks if the number of elements is even * - * @return boolean + * @return bool */ public function isEven(): bool { @@ -565,7 +565,7 @@ public function isEven(): bool /** * Checks if the number of elements is more than zero * - * @return boolean + * @return bool */ public function isNotEmpty(): bool { @@ -575,7 +575,7 @@ public function isNotEmpty(): bool /** * Checks if the number of elements is odd * - * @return boolean + * @return bool */ public function isOdd(): bool { @@ -619,7 +619,7 @@ public function map(callable $callback) /** * Returns the nth element from the collection * - * @param integer $n + * @param int $n * @return mixed */ public function nth(int $n) diff --git a/src/Toolkit/Dir.php b/src/Toolkit/Dir.php index e8ba48d865..043462f686 100644 --- a/src/Toolkit/Dir.php +++ b/src/Toolkit/Dir.php @@ -149,7 +149,7 @@ public static function index(string $dir, bool $recursive = false, array $ignore * Checks if the folder has any contents * * @param string $dir - * @return boolean + * @return bool */ public static function isEmpty(string $dir): bool { @@ -160,7 +160,7 @@ public static function isEmpty(string $dir): bool * Checks if the directory is readable * * @param string $dir - * @return boolean + * @return bool */ public static function isReadable(string $dir): bool { @@ -171,7 +171,7 @@ public static function isReadable(string $dir): bool * Checks if the directory is writable * * @param string $dir - * @return boolean + * @return bool */ public static function isWritable(string $dir): bool { @@ -183,7 +183,7 @@ public static function isWritable(string $dir): bool * * @param string $source * @param string $link - * @return boolean + * @return bool */ public static function link(string $source, string $link): bool { @@ -208,8 +208,8 @@ public static function link(string $source, string $link): bool * Creates a new directory * * @param string $dir The path for the new directory - * @param boolean $recursive Create all parent directories, which don't exist - * @return boolean True: the dir has been created, false: creating failed + * @param bool $recursive Create all parent directories, which don't exist + * @return bool True: the dir has been created, false: creating failed */ public static function make(string $dir, bool $recursive = true): bool { @@ -268,7 +268,7 @@ public static function modified(string $dir, string $format = null, string $hand * * @param string $old The current path of the directory * @param string $new The desired path where the dir should be moved to - * @return boolean true: the directory has been moved, false: moving failed + * @return bool true: the directory has been moved, false: moving failed */ public static function move(string $old, string $new): bool { @@ -334,7 +334,7 @@ public static function read(string $dir, array $ignore = null, bool $absolute = * Removes a folder including all containing files and folders * * @param string $dir - * @return boolean + * @return bool */ public static function remove(string $dir): bool { diff --git a/src/Toolkit/F.php b/src/Toolkit/F.php index d959339b8f..c37839a2a1 100644 --- a/src/Toolkit/F.php +++ b/src/Toolkit/F.php @@ -110,7 +110,7 @@ class F * * @param string $file The path for the file * @param mixed $content Either a string or an array. Arrays will be converted to JSON. - * @return boolean + * @return bool */ public static function append(string $file, $content): bool { @@ -133,8 +133,8 @@ public static function base64(string $file): string * * @param string $source * @param string $target - * @param boolean $force - * @return boolean + * @param bool $force + * @return bool */ public static function copy(string $source, string $target, bool $force = false): bool { @@ -175,7 +175,7 @@ public static function dirname(string $file): string * * @param string $file * @param string $in - * @return boolean + * @return bool */ public static function exists(string $file, string $in = null): bool { @@ -270,7 +270,7 @@ public static function filename(string $name): string * Invalidate opcode cache for file. * * @param string $file The path of the file - * @return boolean + * @return bool */ public static function invalidateOpcodeCache(string $file): bool { @@ -286,7 +286,7 @@ public static function invalidateOpcodeCache(string $file): bool * * @param string $file Full path to the file * @param string $value An extension or mime type - * @return boolean + * @return bool */ public static function is(string $file, string $value): bool { @@ -307,7 +307,7 @@ public static function is(string $file, string $value): bool * Checks if the file is readable * * @param string $file - * @return boolean + * @return bool */ public static function isReadable(string $file): bool { @@ -318,7 +318,7 @@ public static function isReadable(string $file): bool * Checks if the file is writable * * @param string $file - * @return boolean + * @return bool */ public static function isWritable(string $file): bool { @@ -335,7 +335,7 @@ public static function isWritable(string $file): bool * @param string $source * @param string $link * @param string $method - * @return boolean + * @return bool */ public static function link(string $source, string $link, string $method = 'link'): bool { @@ -442,8 +442,8 @@ public static function modified(string $file, string $format = null, string $han * * @param string $oldRoot The current path for the file * @param string $newRoot The path to the new location - * @param boolean $force Force move if the target file exists - * @return boolean + * @param bool $force Force move if the target file exists + * @return bool */ public static function move(string $oldRoot, string $newRoot, bool $force = false): bool { @@ -611,7 +611,7 @@ public static function relativepath(string $file, string $in = null): string * * * @param string $file The path for the file - * @return boolean + * @return bool */ public static function remove(string $file): bool { @@ -728,7 +728,7 @@ public static function type(string $file) * * @param string $file * @param string $to - * @return boolean + * @return bool */ public static function unzip(string $file, string $to): bool { @@ -767,8 +767,8 @@ public static function uri(string $file) * * @param string $file The path for the new file * @param mixed $content Either a string, an object or an array. Arrays and objects will be serialized. - * @param boolean $append true: append the content to an exisiting file if available. false: overwrite. - * @return boolean + * @param bool $append true: append the content to an exisiting file if available. false: overwrite. + * @return bool */ public static function write(string $file, $content, bool $append = false): bool { diff --git a/src/Toolkit/File.php b/src/Toolkit/File.php index 857a416c31..d68aab8694 100644 --- a/src/Toolkit/File.php +++ b/src/Toolkit/File.php @@ -57,7 +57,7 @@ public function base64(): string * Copy a file to a new location. * * @param string $target - * @param boolean $force + * @param bool $force * @return self */ public function copy(string $target, bool $force = false) @@ -147,7 +147,7 @@ public function is(string $value): bool /** * Checks if the file is readable * - * @return boolean + * @return bool */ public function isReadable(): bool { @@ -157,7 +157,7 @@ public function isReadable(): bool /** * Checks if the file is writable * - * @return boolean + * @return bool */ public function isWritable(): bool { diff --git a/src/Toolkit/I18n.php b/src/Toolkit/I18n.php index 97a2dd258c..8e44cdfda6 100644 --- a/src/Toolkit/I18n.php +++ b/src/Toolkit/I18n.php @@ -67,7 +67,7 @@ public static function fallback(): string * depending on the given number * * @param int $count - * @param boolean $none If true, 'none' will be returned if the count is 0 + * @param bool $none If true, 'none' will be returned if the count is 0 * @return string */ public static function form(int $count, bool $none = false): string @@ -194,7 +194,7 @@ public static function translations(): array * Translate amounts * * @param string $key - * @param integer $count + * @param int $count * @param string $locale * @return mixed */ diff --git a/src/Toolkit/Iterator.php b/src/Toolkit/Iterator.php index a39e156b7f..c38e526dac 100644 --- a/src/Toolkit/Iterator.php +++ b/src/Toolkit/Iterator.php @@ -95,7 +95,7 @@ public function rewind() /** * Checks if the current element is valid * - * @return boolean + * @return bool */ public function valid(): bool { @@ -138,7 +138,7 @@ public function keyOf($needle) * Checks by key if an element is included * * @param mixed $key - * @return boolean + * @return bool */ public function has($key): bool { @@ -149,7 +149,7 @@ public function has($key): bool * Checks if the current key is set * * @param mixed $key the key to check - * @return boolean + * @return bool */ public function __isset($key): bool { diff --git a/src/Toolkit/Mime.php b/src/Toolkit/Mime.php index 93f044d726..293bdcbca1 100644 --- a/src/Toolkit/Mime.php +++ b/src/Toolkit/Mime.php @@ -223,7 +223,7 @@ public static function fromSvg(string $file) * * @param string $mime * @param string $pattern - * @return boolean + * @return bool */ public static function isAccepted(string $mime, string $pattern): bool { diff --git a/src/Toolkit/Pagination.php b/src/Toolkit/Pagination.php index b23210ecad..c695cf0e9b 100644 --- a/src/Toolkit/Pagination.php +++ b/src/Toolkit/Pagination.php @@ -18,21 +18,21 @@ class Pagination /** * The current page * - * @var integer + * @var int */ protected $page; /** * Total number of items * - * @var integer + * @var int */ protected $total; /** * The number of items per page * - * @var integer + * @var int */ protected $limit; @@ -256,7 +256,7 @@ public function offset(): int * Checks if the given page exists * * @param int $page - * @return boolean + * @return bool */ public function hasPage(int $page): bool { @@ -274,7 +274,7 @@ public function hasPage(int $page): bool /** * Checks if there are any pages at all * - * @return boolean + * @return bool */ public function hasPages(): bool { @@ -284,7 +284,7 @@ public function hasPages(): bool /** * Checks if there's a previous page * - * @return boolean + * @return bool */ public function hasPrevPage(): bool { @@ -304,7 +304,7 @@ public function prevPage() /** * Checks if there's a next page * - * @return boolean + * @return bool */ public function hasNextPage(): bool { @@ -324,7 +324,7 @@ public function nextPage() /** * Checks if the current page is the first page * - * @return boolean + * @return bool */ public function isFirstPage(): bool { @@ -334,7 +334,7 @@ public function isFirstPage(): bool /** * Checks if the current page is the last page * - * @return boolean + * @return bool */ public function isLastPage(): bool { diff --git a/src/Toolkit/Str.php b/src/Toolkit/Str.php index 1554e185ee..fcb3a74c6e 100644 --- a/src/Toolkit/Str.php +++ b/src/Toolkit/Str.php @@ -337,7 +337,7 @@ public static function endsWith(string $string, string $needle, bool $caseInsens * * @param string $string The string to be shortened * @param int $chars The final number of characters the string should have - * @param boolean $strip True: remove the HTML tags from the string first + * @param bool $strip True: remove the HTML tags from the string first * @param string $rep The element, which should be added if the string is too long. Ellipsis is the default. * @return string The shortened string */ @@ -401,7 +401,7 @@ public static function from(string $string, string $needle, bool $caseInsensitiv * Checks if the given string is a URL * * @param string|null $string - * @return boolean + * @return bool */ public static function isURL(string $string = null): bool { @@ -458,7 +458,7 @@ public static function ltrim(string $string, string $trim = ' '): string * Get a character pool with various possible combinations * * @param string|array $type - * @param boolean $array + * @param bool $array * @return string|array */ public static function pool($type, bool $array = true) diff --git a/src/Toolkit/V.php b/src/Toolkit/V.php index b5b6eed49c..f8b130a558 100644 --- a/src/Toolkit/V.php +++ b/src/Toolkit/V.php @@ -105,8 +105,8 @@ public static function validators(): array * @param mixed $value * @param array $rules * @param array $messages - * @param boolean $fail - * @return boolean|array + * @param bool $fail + * @return bool|array */ public static function value($value, array $rules, array $messages = [], bool $fail = true) { @@ -144,7 +144,7 @@ public static function value($value, array $rules, array $messages = [], bool $f * * @param array $input * @param array $rules - * @return boolean + * @return bool */ public static function input(array $input, array $rules): bool { @@ -181,7 +181,7 @@ public static function input(array $input, array $rules): bool * * @param string $method * @param array $arguments - * @return boolean + * @return bool */ public static function __callStatic(string $method, array $arguments): bool { diff --git a/src/Toolkit/View.php b/src/Toolkit/View.php index a40559e0e1..c11b5e026c 100644 --- a/src/Toolkit/View.php +++ b/src/Toolkit/View.php @@ -56,7 +56,7 @@ public function data(): array /** * Checks if the template file exists * - * @return boolean + * @return bool */ public function exists(): bool { diff --git a/src/Toolkit/Xml.php b/src/Toolkit/Xml.php index fdf000c933..ec3855fa0f 100644 --- a/src/Toolkit/Xml.php +++ b/src/Toolkit/Xml.php @@ -58,7 +58,7 @@ class Xml * * @param string $props The source array * @param string $name The name of the root element - * @param boolean $head Include the xml declaration head or not + * @param bool $head Include the xml declaration head or not * @param int $level The indendation level * @return string The XML string */ @@ -137,7 +137,7 @@ public static function decode(string $string = null): string * * * @param string $string - * @param boolean $html True: convert to html first + * @param bool $html True: convert to html first * @return string */ public static function encode(string $string = null, bool $html = true): string diff --git a/tests/Session/SessionTest.php b/tests/Session/SessionTest.php index b146b6207c..65f9ae1032 100644 --- a/tests/Session/SessionTest.php +++ b/tests/Session/SessionTest.php @@ -1291,7 +1291,7 @@ public function testInitNonRenewable() /** * Asserts the state of the write mode of the given session * - * @param boolean $expected Whether the write mode should be true or false right now + * @param bool $expected Whether the write mode should be true or false right now * @param Session $session * @return void */ From 14efe02bff964f9bb6ad1925b798bb6f2dd6d75b Mon Sep 17 00:00:00 2001 From: Lukas Bestle Date: Mon, 23 Sep 2019 18:59:51 +0200 Subject: [PATCH 003/246] PHP CS: Left-align docblocks --- .php_cs | 2 +- config/helpers.php | 26 ++-- src/Cache/Cache.php | 2 +- src/Cms/AppUsers.php | 2 +- src/Cms/Collection.php | 20 +-- src/Cms/Collections.php | 6 +- src/Cms/Content.php | 14 +- src/Cms/Field.php | 4 +- src/Cms/File.php | 4 +- src/Cms/FileBlueprint.php | 2 +- src/Cms/FileFoundation.php | 6 +- src/Cms/Filename.php | 8 +- src/Cms/HasMethods.php | 4 +- src/Cms/NestCollection.php | 2 +- src/Cms/Site.php | 6 +- src/Data/Data.php | 20 +-- src/Data/Handler.php | 10 +- src/Data/Json.php | 2 +- src/Data/PHP.php | 12 +- src/Data/Txt.php | 10 +- src/Data/Yaml.php | 4 +- src/Http/Cookie.php | 46 +++---- src/Http/Request.php | 4 +- src/Http/Request/Data.php | 4 +- src/Http/Response.php | 10 +- src/Http/Route.php | 8 +- src/Http/Router.php | 12 +- src/Http/Server.php | 12 +- src/Http/Uri.php | 12 +- src/Http/Visitor.php | 10 +- src/Image/Dimensions.php | 56 ++++---- src/Image/Image.php | 8 +- src/Image/Location.php | 6 +- src/Session/AutoSession.php | 47 +++---- src/Session/FileSessionStore.php | 46 +++---- src/Session/Session.php | 53 ++++---- src/Session/SessionData.php | 28 ++-- src/Session/SessionStore.php | 34 ++--- src/Session/Sessions.php | 34 ++--- src/Text/Markdown.php | 4 +- src/Text/SmartyPants.php | 2 +- src/Toolkit/A.php | 90 ++++++------- src/Toolkit/Collection.php | 54 ++++---- src/Toolkit/Dir.php | 32 ++--- src/Toolkit/Escape.php | 12 +- src/Toolkit/F.php | 56 ++++---- src/Toolkit/File.php | 20 +-- src/Toolkit/Html.php | 10 +- src/Toolkit/Iterator.php | 12 +- src/Toolkit/Query.php | 6 +- src/Toolkit/Str.php | 176 ++++++++++++------------- src/Toolkit/V.php | 16 +-- src/Toolkit/View.php | 2 +- src/Toolkit/Xml.php | 18 +-- tests/Session/FileSessionStoreTest.php | 8 +- tests/Session/SessionTest.php | 4 +- 56 files changed, 545 insertions(+), 573 deletions(-) diff --git a/.php_cs b/.php_cs index 4b65001d8a..07cd80f9d3 100644 --- a/.php_cs +++ b/.php_cs @@ -44,7 +44,7 @@ return PhpCsFixer\Config::create() 'no_useless_return' => true, 'ordered_imports' => ['sort_algorithm' => 'alpha'], // 'phpdoc_add_missing_param_annotation' => ['only_untyped' => false], // adds params in the wrong order - // 'phpdoc_align' => ['align' => 'vertical'], // added in a second step + 'phpdoc_align' => ['align' => 'left'], 'phpdoc_indent' => true, 'phpdoc_scalar' => true, 'phpdoc_trim' => true, diff --git a/config/helpers.php b/config/helpers.php index 56fc874f8a..86bc5effa7 100755 --- a/config/helpers.php +++ b/config/helpers.php @@ -159,10 +159,10 @@ function e($condition, $value, $alternative = null) /** * Escape context specific output * - * @param string $string Untrusted data - * @param string $context Location of output - * @param bool $strict Whether to escape an extended set of characters (HTML attributes only) - * @return string Escaped data + * @param string $string Untrusted data + * @param string $context Location of output + * @param bool $strict Whether to escape an extended set of characters (HTML attributes only) + * @return string Escaped data */ function esc($string, $context = 'html', $strict = false) { @@ -177,9 +177,9 @@ function esc($string, $context = 'html', $strict = false) /** * Shortcut for $kirby->request()->get() * - * @param mixed $key The key to look for. Pass false or null to return the entire request array. - * @param mixed $default Optional default value, which should be returned if no element has been found - * @return mixed + * @param mixed $key The key to look for. Pass false or null to return the entire request array. + * @param mixed $default Optional default value, which should be returned if no element has been found + * @return mixed */ function get($key = null, $default = null) { @@ -721,9 +721,9 @@ function svg(string $file) /** * Returns translate string for key from translation file * - * @param string|array $key - * @param string|null $fallback - * @return mixed + * @param string|array $key + * @param string|null $fallback + * @return mixed */ function t($key, string $fallback = null) { @@ -733,9 +733,9 @@ function t($key, string $fallback = null) /** * Translates a count * - * @param string|array $key - * @param int $count - * @return mixed + * @param string|array $key + * @param int $count + * @return mixed */ function tc($key, int $count) { diff --git a/src/Cache/Cache.php b/src/Cache/Cache.php index 981be0c5a3..729d61b353 100644 --- a/src/Cache/Cache.php +++ b/src/Cache/Cache.php @@ -52,7 +52,7 @@ abstract public function set(string $key, $value, int $minutes = 0): bool; /** * Adds the prefix to the key if given * - * @param string $key + * @param string $key * @return string */ protected function key(string $key): string diff --git a/src/Cms/AppUsers.php b/src/Cms/AppUsers.php index 54135d57e1..98697f27ad 100644 --- a/src/Cms/AppUsers.php +++ b/src/Cms/AppUsers.php @@ -77,7 +77,7 @@ protected function setUsers(array $users = null) * Returns a specific user by id * or the current user if no id is given * - * @param string $id + * @param string $id * @return \Kirby\Cms\User|null */ public function user(string $id = null) diff --git a/src/Cms/Collection.php b/src/Cms/Collection.php index 498d879d06..f072b2d3ef 100644 --- a/src/Cms/Collection.php +++ b/src/Cms/Collection.php @@ -38,8 +38,8 @@ class Collection extends BaseCollection /** * Magic getter function * - * @param string $key - * @param mixed $arguments + * @param string $key + * @param mixed $arguments * @return mixed */ public function __call(string $key, $arguments) @@ -101,8 +101,8 @@ public function add($object) /** * Appends an element to the data array * - * @param mixed $key Optional collection key, will be determined from the item if not given - * @param mixed $item + * @param mixed $key Optional collection key, will be determined from the item if not given + * @param mixed $item * @return \Kirby\Cms\Collection */ public function append(...$args) @@ -181,7 +181,7 @@ public function has($id): bool * The method will automatically detect objects * or ids and then search accordingly. * - * @param string|object $object + * @param string|object $object * @return int */ public function indexOf($object): int @@ -196,7 +196,7 @@ public function indexOf($object): int /** * Returns a Collection without the given element(s) * - * @param mixed ...$keys any number of keys, passed as individual arguments + * @param mixed ...$keys any number of keys, passed as individual arguments * @return \Kirby\Cms\Collection */ public function not(...$keys) @@ -216,7 +216,7 @@ public function not(...$keys) /** * Add pagination and return a sliced set of data. * - * @param mixed ...$arguments + * @param mixed ...$arguments * @return \Kirby\Cms\Collection */ public function paginate(...$arguments) @@ -240,8 +240,8 @@ public function parent() /** * Prepends an element to the data array * - * @param mixed $key Optional collection key, will be determined from the item if not given - * @param mixed $item + * @param mixed $key Optional collection key, will be determined from the item if not given + * @param mixed $item * @return Kirby\Cms\Collection */ public function prepend(...$args) @@ -321,7 +321,7 @@ public function search(string $query = null, $params = []) * to an array. This can also take a callback * function to further modify the array result. * - * @param Closure $map + * @param Closure $map * @return array */ public function toArray(Closure $map = null): array diff --git a/src/Cms/Collections.php b/src/Cms/Collections.php index 7064eabd3a..8a42ce2fda 100644 --- a/src/Cms/Collections.php +++ b/src/Cms/Collections.php @@ -42,8 +42,8 @@ class Collections * Magic caller to enable something like * `$collections->myCollection()` * - * @param string $name - * @param array $arguments + * @param string $name + * @param array $arguments * @return \Kirby\Cms\Collection|null */ public function __call(string $name, array $arguments = []) @@ -109,7 +109,7 @@ public function has(string $name): bool * Loads collection from php file in a * given directory or from plugin extension. * - * @param string $name + * @param string $name * @return mixed */ public function load(string $name) diff --git a/src/Cms/Content.php b/src/Cms/Content.php index c05afac80c..e55d84af56 100644 --- a/src/Cms/Content.php +++ b/src/Cms/Content.php @@ -69,7 +69,7 @@ public function __construct(array $data = [], $parent = null) * Same as `self::data()` to improve * `var_dump` output * - * @see self::data() + * @see self::data() * @return array */ public function __debugInfo(): array @@ -146,7 +146,7 @@ public function fields(): array * Returns either a single field object * or all registered fields * - * @param string $key + * @param string $key * @return \Kirby\Cms\Field|array */ public function get(string $key = null) @@ -197,7 +197,7 @@ public function keys(): array * without the fields, specified by the * passed key(s) * - * @param string ...$keys + * @param string ...$keys * @return self */ public function not(...$keys) @@ -238,8 +238,8 @@ public function setParent(Model $parent) /** * Returns the raw data array * - * @see self::data() - * @return array + * @see self::data() + * @return array */ public function toArray(): array { @@ -250,8 +250,8 @@ public function toArray(): array * Updates the content and returns * a cloned object * - * @param array $content - * @param bool $overwrite + * @param array $content + * @param bool $overwrite * @return self */ public function update(array $content = null, bool $overwrite = false) diff --git a/src/Cms/Field.php b/src/Cms/Field.php index dce51b973a..5ce8e7be89 100644 --- a/src/Cms/Field.php +++ b/src/Cms/Field.php @@ -95,7 +95,7 @@ public function __call(string $method, array $arguments = []) * * @param object $parent * @param string $key - * @param mixed $value + * @param mixed $value */ public function __construct($parent = null, string $key, $value) { @@ -232,7 +232,7 @@ public function toString(): string * the modified field will be returned. Otherwise it * will return the field value. * - * @param string|Closure $value + * @param string|Closure $value * @return mixed */ public function value($value = null) diff --git a/src/Cms/File.php b/src/Cms/File.php index 46e2c0b337..5d9b971c16 100644 --- a/src/Cms/File.php +++ b/src/Cms/File.php @@ -369,8 +369,8 @@ public function meta() /** * Get the file's last modification time. * - * @param string $format - * @param string|null $handler date or strftime + * @param string $format + * @param string|null $handler date or strftime * @return mixed */ public function modified(string $format = null, string $handler = null) diff --git a/src/Cms/FileBlueprint.php b/src/Cms/FileBlueprint.php index e570e42fe9..2af1e4ca44 100644 --- a/src/Cms/FileBlueprint.php +++ b/src/Cms/FileBlueprint.php @@ -44,7 +44,7 @@ public function accept(): array } /** - * @param mixed $accept + * @param mixed $accept * @return array */ protected function normalizeAccept($accept = null): array diff --git a/src/Cms/FileFoundation.php b/src/Cms/FileFoundation.php index 792f8c678c..cc1b4f90fc 100644 --- a/src/Cms/FileFoundation.php +++ b/src/Cms/FileFoundation.php @@ -102,7 +102,7 @@ public function extension(): string /** * Converts the file to html * - * @param array $attr + * @param array $attr * @return string */ public function html(array $attr = []): string @@ -165,8 +165,8 @@ public function kirby() /** * Get the file's last modification time. * - * @param string $format - * @param string|null $handler date or strftime + * @param string $format + * @param string|null $handler date or strftime * @return mixed */ public function modified(string $format = null, string $handler = null) diff --git a/src/Cms/Filename.php b/src/Cms/Filename.php index a34c110ce4..d4fa70814d 100644 --- a/src/Cms/Filename.php +++ b/src/Cms/Filename.php @@ -68,7 +68,7 @@ class Filename * * @param string $filename * @param string $template - * @param array $attributes + * @param array $attributes */ public function __construct(string $filename, string $template, array $attributes = []) { @@ -118,7 +118,7 @@ public function attributesToArray(): array * to a string, that can be used in the * new filename * - * @param string $prefix The prefix will be used in the filename creation + * @param string $prefix The prefix will be used in the filename creation * @return string */ public function attributesToString(string $prefix = null): string @@ -265,7 +265,7 @@ public function quality() * to lowercase and `jpeg` will be * replaced with `jpg` * - * @param string $extension + * @param string $extension * @return string */ protected function sanitizeExtension(string $extension): string @@ -279,7 +279,7 @@ protected function sanitizeExtension(string $extension): string * Sanitizes the name with Kirby's * Str::slug function * - * @param string $name + * @param string $name * @return string */ protected function sanitizeName(string $name): string diff --git a/src/Cms/HasMethods.php b/src/Cms/HasMethods.php index 2042eabe10..4a1a6bc963 100644 --- a/src/Cms/HasMethods.php +++ b/src/Cms/HasMethods.php @@ -25,8 +25,8 @@ trait HasMethods * passed arguments * * @internal - * @param string $method - * @param array $args + * @param string $method + * @param array $args * @return mixed */ public function callMethod(string $method, array $args = []) diff --git a/src/Cms/NestCollection.php b/src/Cms/NestCollection.php index e3bf7c5d2c..2251dcb8cc 100644 --- a/src/Cms/NestCollection.php +++ b/src/Cms/NestCollection.php @@ -21,7 +21,7 @@ class NestCollection extends BaseCollection * to an array. This can also take a callback * function to further modify the array result. * - * @param Closure $map + * @param Closure $map * @return array */ public function toArray(Closure $map = null): array diff --git a/src/Cms/Site.php b/src/Cms/Site.php index e0d10847ec..cf1334cbc0 100644 --- a/src/Cms/Site.php +++ b/src/Cms/Site.php @@ -391,7 +391,7 @@ public function modified(string $format = null, string $handler = null) * prop, the home page will be returned if * it can be found. (see `Site::homePage()`) * - * @param string $path + * @param string $path * @return \Kirby\Cms\Page|null */ public function page(string $path = null) @@ -645,8 +645,8 @@ public function urlForLanguage(string $languageCode = null, array $options = nul * returns the current page * * @internal - * @param string|\Kirby\Cms\Page $page - * @param string|null $languageCode + * @param string|\Kirby\Cms\Page $page + * @param string|null $languageCode * @return \Kirby\Cms\Page */ public function visit($page, string $languageCode = null) diff --git a/src/Data/Data.php b/src/Data/Data.php index 76c4e1d6c9..a53a085711 100644 --- a/src/Data/Data.php +++ b/src/Data/Data.php @@ -50,7 +50,7 @@ class Data /** * Handler getter * - * @param string $type + * @param string $type * @return \Kirby\Data\Handler */ public static function handler(string $type) @@ -73,8 +73,8 @@ public static function handler(string $type) /** * Decodes data with the specified handler * - * @param string $data - * @param string $type + * @param string $data + * @param string $type * @return array */ public static function decode(string $data = null, string $type): array @@ -85,8 +85,8 @@ public static function decode(string $data = null, string $type): array /** * Encodes data with the specified handler * - * @param array $data - * @param string $type + * @param array $data + * @param string $type * @return string */ public static function encode(array $data = null, string $type): string @@ -99,8 +99,8 @@ public static function encode(array $data = null, string $type): string * the data handler is automatically chosen by * the extension if not specified * - * @param string $file - * @param string $type + * @param string $file + * @param string $type * @return array */ public static function read(string $file, string $type = null): array @@ -113,9 +113,9 @@ public static function read(string $file, string $type = null): array * the data handler is automatically chosen by * the extension if not specified * - * @param string $file - * @param array $data - * @param string $type + * @param string $file + * @param array $data + * @param string $type * @return bool */ public static function write(string $file = null, array $data = [], string $type = null): bool diff --git a/src/Data/Handler.php b/src/Data/Handler.php index 71340a0996..6cf6a351d4 100644 --- a/src/Data/Handler.php +++ b/src/Data/Handler.php @@ -23,7 +23,7 @@ abstract class Handler * * Needs to throw an Exception if the file can't be parsed. * - * @param string $string + * @param string $string * @return array */ abstract public static function decode($string): array; @@ -31,7 +31,7 @@ abstract public static function decode($string): array; /** * Converts an array to an encoded string * - * @param mixed $data + * @param mixed $data * @return string */ abstract public static function encode($data): string; @@ -39,7 +39,7 @@ abstract public static function encode($data): string; /** * Reads data from a file * - * @param string $file + * @param string $file * @return array */ public static function read(string $file): array @@ -54,8 +54,8 @@ public static function read(string $file): array /** * Writes data to a file * - * @param string $file - * @param array $data + * @param string $file + * @param array $data * @return bool */ public static function write(string $file = null, array $data = []): bool diff --git a/src/Data/Json.php b/src/Data/Json.php index 8eb553ea96..88d741fe46 100644 --- a/src/Data/Json.php +++ b/src/Data/Json.php @@ -18,7 +18,7 @@ class Json extends Handler /** * Converts an array to an encoded JSON string * - * @param mixed $data + * @param mixed $data * @return string */ public static function encode($data): string diff --git a/src/Data/PHP.php b/src/Data/PHP.php index 15667b3516..93f8871582 100644 --- a/src/Data/PHP.php +++ b/src/Data/PHP.php @@ -19,8 +19,8 @@ class PHP extends Handler /** * Converts an array to PHP file content * - * @param mixed $data - * @param string $indent For internal use only + * @param mixed $data + * @param string $indent For internal use only * @return string */ public static function encode($data, $indent = ''): string @@ -48,7 +48,7 @@ public static function encode($data, $indent = ''): string /** * PHP arrays don't have to be decoded * - * @param array $array + * @param array $array * @return array */ public static function decode($array): array @@ -59,7 +59,7 @@ public static function decode($array): array /** * Reads data from a file * - * @param string $file + * @param string $file * @return array */ public static function read(string $file): array @@ -74,8 +74,8 @@ public static function read(string $file): array /** * Creates a PHP file with the given data * - * @param string $file - * @param array $data + * @param string $file + * @param array $data * @return bool */ public static function write(string $file = null, array $data = []): bool diff --git a/src/Data/Txt.php b/src/Data/Txt.php index 3d8e744c04..d76c1d2460 100644 --- a/src/Data/Txt.php +++ b/src/Data/Txt.php @@ -18,7 +18,7 @@ class Txt extends Handler /** * Converts an array to an encoded Kirby txt string * - * @param mixed $data + * @param mixed $data * @return string */ public static function encode($data): string @@ -41,7 +41,7 @@ public static function encode($data): string /** * Helper for converting the value * - * @param array|string $value + * @param array|string $value * @return string */ protected static function encodeValue($value): string @@ -63,8 +63,8 @@ protected static function encodeValue($value): string /** * Helper for converting the key and value to the result string * - * @param string $key - * @param string $value + * @param string $key + * @param string $value * @return string */ protected static function encodeResult(string $key, string $value): string @@ -86,7 +86,7 @@ protected static function encodeResult(string $key, string $value): string /** * Parses a Kirby txt string and returns a multi-dimensional array * - * @param string $string + * @param string $string * @return array */ public static function decode($string): array diff --git a/src/Data/Yaml.php b/src/Data/Yaml.php index 2e7cda27e8..0b5f321c0a 100644 --- a/src/Data/Yaml.php +++ b/src/Data/Yaml.php @@ -19,7 +19,7 @@ class Yaml extends Handler /** * Converts an array to an encoded YAML string * - * @param mixed $data + * @param mixed $data * @return string */ public static function encode($data): string @@ -42,7 +42,7 @@ public static function encode($data): string /** * Parses an encoded YAML string and returns a multi-dimensional array * - * @param string $yaml + * @param string $yaml * @return array */ public static function decode($yaml): array diff --git a/src/Http/Cookie.php b/src/Http/Cookie.php index 136863369b..41285e5fc2 100644 --- a/src/Http/Cookie.php +++ b/src/Http/Cookie.php @@ -32,12 +32,12 @@ class Cookie * * * - * @param string $key The name of the cookie - * @param string $value The cookie content - * @param array $options Array of options: - * lifetime, path, domain, secure, httpOnly - * @return bool true: cookie was created, - * false: cookie creation failed + * @param string $key The name of the cookie + * @param string $value The cookie content + * @param array $options Array of options: + * lifetime, path, domain, secure, httpOnly + * @return bool true: cookie was created, + * false: cookie creation failed */ public static function set(string $key, string $value, array $options = []): bool { @@ -61,7 +61,7 @@ public static function set(string $key, string $value, array $options = []): boo /** * Calculates the lifetime for a cookie * - * @param int $minutes Number of minutes or timestamp + * @param int $minutes Number of minutes or timestamp * @return int */ public static function lifetime(int $minutes): int @@ -87,12 +87,12 @@ public static function lifetime(int $minutes): int * * * - * @param string $key The name of the cookie - * @param string $value The cookie content - * @param array $options Array of options: - * path, domain, secure, httpOnly - * @return bool true: cookie was created, - * false: cookie creation failed + * @param string $key The name of the cookie + * @param string $value The cookie content + * @param array $options Array of options: + * path, domain, secure, httpOnly + * @return bool true: cookie was created, + * false: cookie creation failed */ public static function forever(string $key, string $value, array $options = []): bool { @@ -110,10 +110,10 @@ public static function forever(string $key, string $value, array $options = []): * * * - * @param string|null $key The name of the cookie - * @param string|null $default The default value, which should be returned - * if the cookie has not been found - * @return mixed The found value + * @param string|null $key The name of the cookie + * @param string|null $default The default value, which should be returned + * if the cookie has not been found + * @return mixed The found value */ public static function get(string $key = null, string $default = null) { @@ -127,7 +127,7 @@ public static function get(string $key = null, string $default = null) /** * Checks if a cookie exists * - * @param string $key + * @param string $key * @return bool */ public static function exists(string $key): bool @@ -139,7 +139,7 @@ public static function exists(string $key): bool * Creates a HMAC for the cookie value * Used as a cookie signature to prevent easy tampering with cookie data * - * @param string $value + * @param string $value * @return string */ protected static function hmac(string $value): string @@ -151,7 +151,7 @@ protected static function hmac(string $value): string * Parses the hashed value from a cookie * and tries to extract the value * - * @param string $string + * @param string $string * @return mixed */ protected static function parse(string $string) @@ -190,9 +190,9 @@ protected static function parse(string $string) * * * - * @param string $key The name of the cookie - * @return bool true: the cookie has been removed, - * false: the cookie could not be removed + * @param string $key The name of the cookie + * @return bool true: the cookie has been removed, + * false: the cookie could not be removed */ public static function remove(string $key): bool { diff --git a/src/Http/Request.php b/src/Http/Request.php index 7655c29f92..ca9ff9f0d5 100644 --- a/src/Http/Request.php +++ b/src/Http/Request.php @@ -232,7 +232,7 @@ public function domain(): string * Fetches a single file array * from the Files object by key * - * @param string $key + * @param string $key * @return array|null */ public function file(string $key) @@ -316,7 +316,7 @@ public function headers(): array * Checks if the given method name * matches the name of the request method. * - * @param string $method + * @param string $method * @return bool */ public function is(string $method): bool diff --git a/src/Http/Request/Data.php b/src/Http/Request/Data.php index aaf6558ac6..0a6bc7f82d 100644 --- a/src/Http/Request/Data.php +++ b/src/Http/Request/Data.php @@ -44,8 +44,8 @@ abstract public function data(): array; * of the data array by key or multiple values by * passing an array of keys. * - * @param string|array $key - * @param mixed|null $default + * @param string|array $key + * @param mixed|null $default * @return mixed */ public function get($key, $default = null) diff --git a/src/Http/Response.php b/src/Http/Response.php index 25c2b056ff..ca7596a497 100644 --- a/src/Http/Response.php +++ b/src/Http/Response.php @@ -58,11 +58,11 @@ class Response /** * Creates a new response object * - * @param string $body - * @param string $type + * @param string $body + * @param string $type * @param int $code - * @param array $headers - * @param string $charset + * @param array $headers + * @param string $charset */ public function __construct($body = '', ?string $type = null, ?int $code = null, ?array $headers = null, ?string $charset = null) { @@ -194,7 +194,7 @@ public static function file(string $file) /** * Getter for single headers * - * @param string $key Name of the header + * @param string $key Name of the header * @return string|null */ public function header(string $key): ?string diff --git a/src/Http/Route.php b/src/Http/Route.php index 7f5c33edb6..eff1891758 100644 --- a/src/Http/Route.php +++ b/src/Http/Route.php @@ -90,7 +90,7 @@ public function __call(string $key, array $arguments = null) * * @param string|array $pattern * @param string|array $method - * @param Closure $action + * @param Closure $action * @param array $attributes */ public function __construct($pattern, $method = 'GET', Closure $action, array $attributes = []) @@ -177,7 +177,7 @@ public function pattern(): string * Converts the pattern into a full regular * expression by replacing all the wildcards * - * @param string $pattern + * @param string $pattern * @return string */ public function regex(string $pattern): string @@ -201,8 +201,8 @@ public function regex(string $pattern): string * Tries to match the path with the regular expression and * extracts all arguments for the Route action * - * @param string $pattern - * @param string $path + * @param string $pattern + * @param string $path * @return array|false */ public function parse(string $pattern, string $path) diff --git a/src/Http/Router.php b/src/Http/Router.php index 7a71fb1d06..90903f4251 100644 --- a/src/Http/Router.php +++ b/src/Http/Router.php @@ -81,9 +81,9 @@ public function __construct(array $routes = []) * the appropriate arguments and a Result * object. * - * @param string $path - * @param string $method - * @param Closure|null $callback + * @param string $path + * @param string $method + * @param Closure|null $callback * @return mixed */ public function call(string $path = null, string $method = 'GET', Closure $callback = null) @@ -126,9 +126,9 @@ public function call(string $path = null, string $method = 'GET', Closure $callb * find matches and return all the found * arguments in the path. * - * @param string $path - * @param string $method - * @param array $ignore + * @param string $path + * @param string $method + * @param array $ignore * @return \Kirby\Http\Route|null */ public function find(string $path, string $method, array $ignore = null) diff --git a/src/Http/Server.php b/src/Http/Server.php index b5353c4436..1ccf919eeb 100644 --- a/src/Http/Server.php +++ b/src/Http/Server.php @@ -66,10 +66,10 @@ public static function cli(): bool * // returns the whole server array * * - * @param mixed $key The key to look for. Pass false or null to - * return the entire server array. - * @param mixed $default Optional default value, which should be - * returned if no element has been found + * @param mixed $key The key to look for. Pass false or null to + * return the entire server array. + * @param mixed $default Optional default value, which should be + * returned if no element has been found * @return mixed */ public static function get($key = null, $default = null) @@ -86,8 +86,8 @@ public static function get($key = null, $default = null) /** * Help to sanitize some _SERVER keys * - * @param string $key - * @param mixed $value + * @param string $key + * @param mixed $value * @return mixed */ public static function sanitize(string $key, $value) diff --git a/src/Http/Uri.php b/src/Http/Uri.php index 8d77c91173..cf82e93faa 100644 --- a/src/Http/Uri.php +++ b/src/Http/Uri.php @@ -373,7 +373,7 @@ public function isAbsolute(): bool } /** - * @param string|null $fragment + * @param string|null $fragment * @return self */ public function setFragment(string $fragment = null) @@ -383,7 +383,7 @@ public function setFragment(string $fragment = null) } /** - * @param string $host + * @param string $host * @return self */ public function setHost(string $host = null) @@ -393,7 +393,7 @@ public function setHost(string $host = null) } /** - * @param Kirby\Http\Params|string|array|null $params + * @param Kirby\Http\Params|string|array|null $params * @return self */ public function setParams($params = null) @@ -403,7 +403,7 @@ public function setParams($params = null) } /** - * @param string|null $password + * @param string|null $password * @return self */ public function setPassword(string $password = null) @@ -453,7 +453,7 @@ public function setQuery($query = null) } /** - * @param string $scheme + * @param string $scheme * @return self */ public function setScheme(string $scheme = null) @@ -480,7 +480,7 @@ public function setSlash(bool $slash = false) } /** - * @param string|null $username + * @param string|null $username * @return self */ public function setUsername(string $username = null) diff --git a/src/Http/Visitor.php b/src/Http/Visitor.php index 8ee49b8051..c5c6adcee9 100644 --- a/src/Http/Visitor.php +++ b/src/Http/Visitor.php @@ -66,7 +66,7 @@ public function __construct(array $arguments = []) * provided or returns the user's * accepted language otherwise * - * @param string|null $acceptedLanguage + * @param string|null $acceptedLanguage * @return \Kirby\Toolkit\Obj|\Kirby\Http\Visitor|null */ public function acceptedLanguage(string $acceptedLanguage = null) @@ -133,7 +133,7 @@ public function acceptsLanguage(string $code): bool * provided or returns the user's * accepted mime type otherwise * - * @param string|null $acceptedMimeType + * @param string|null $acceptedMimeType * @return \Kirby\Toolkit\Obj|\Kirby\Http\Visitor */ public function acceptedMimeType(string $acceptedMimeType = null) @@ -169,7 +169,7 @@ public function acceptedMimeTypes() /** * Checks if the user accepts the given mime type * - * @param string $mimeType + * @param string $mimeType * @return bool */ public function acceptsMimeType(string $mimeType): bool @@ -182,7 +182,7 @@ public function acceptsMimeType(string $mimeType): bool * or returns the ip of the current * visitor otherwise * - * @param string|null $ip + * @param string|null $ip * @return string|Visitor|null */ public function ip(string $ip = null) @@ -199,7 +199,7 @@ public function ip(string $ip = null) * or returns the user agent string of * the current visitor otherwise * - * @param string|null $userAgent + * @param string|null $userAgent * @return string|Visitor|null */ public function userAgent(string $userAgent = null) diff --git a/src/Image/Dimensions.php b/src/Image/Dimensions.php index cd820145f0..ed20b885f2 100644 --- a/src/Image/Dimensions.php +++ b/src/Image/Dimensions.php @@ -65,9 +65,9 @@ public function __toString(): string /** * Crops the dimensions by width and height * - * @param int $width - * @param int $height - * @return self + * @param int $width + * @param int $height + * @return self */ public function crop(int $width, int $height = null) { @@ -107,9 +107,9 @@ public function height() * * * - * @param int $box the max width and/or height - * @param bool $force If true, the dimensions will be - * upscaled to fit the box if smaller + * @param int $box the max width and/or height + * @param bool $force If true, the dimensions will be + * upscaled to fit the box if smaller * @return self object with recalculated dimensions */ public function fit(int $box, bool $force = false) @@ -159,10 +159,10 @@ public function fit(int $box, bool $force = false) * * * - * @param int $fit the max height - * @param bool $force If true, the dimensions will be - * upscaled to fit the box if smaller - * @return self object with recalculated dimensions + * @param int $fit the max height + * @param bool $force If true, the dimensions will be + * upscaled to fit the box if smaller + * @return self object with recalculated dimensions */ public function fitHeight(int $fit = null, bool $force = false) { @@ -172,11 +172,11 @@ public function fitHeight(int $fit = null, bool $force = false) /** * Helper for fitWidth and fitHeight methods * - * @param string $ref reference (width or height) - * @param int $fit the max width - * @param bool $force If true, the dimensions will be - * upscaled to fit the box if smaller - * @return self object with recalculated dimensions + * @param string $ref reference (width or height) + * @param int $fit the max width + * @param bool $force If true, the dimensions will be + * upscaled to fit the box if smaller + * @return self object with recalculated dimensions */ protected function fitSize(string $ref, int $fit = null, bool $force = false) { @@ -212,10 +212,10 @@ protected function fitSize(string $ref, int $fit = null, bool $force = false) * * * - * @param int $fit the max width - * @param bool $force If true, the dimensions will be - * upscaled to fit the box if smaller - * @return self object with recalculated dimensions + * @param int $fit the max width + * @param bool $force If true, the dimensions will be + * upscaled to fit the box if smaller + * @return self object with recalculated dimensions */ public function fitWidth(int $fit = null, bool $force = false) { @@ -225,10 +225,10 @@ public function fitWidth(int $fit = null, bool $force = false) /** * Recalculates the dimensions by the width and height * - * @param int $width the max height - * @param int $height the max width - * @param bool $force - * @return self + * @param int $width the max height + * @param int $height the max width + * @param bool $force + * @return self */ public function fitWidthAndHeight(int $width = null, int $height = null, bool $force = false) { @@ -362,10 +362,10 @@ public function ratio(): float } /** - * @param int $width - * @param int $height - * @param bool $force - * @return self + * @param int $width + * @param int $height + * @param bool $force + * @return self */ public function resize(int $width = null, int $height = null, bool $force = false) { @@ -385,7 +385,7 @@ public function square(): bool /** * Resize and crop * - * @param array $options + * @param array $options * @return self */ public function thumb(array $options = []) diff --git a/src/Image/Image.php b/src/Image/Image.php index c367e86db4..a3be19ea01 100644 --- a/src/Image/Image.php +++ b/src/Image/Image.php @@ -42,8 +42,8 @@ class Image extends File /** * Constructor * - * @param string $root - * @param string|null $url + * @param string $root + * @param string|null $url */ public function __construct(string $root = null, string $url = null) { @@ -126,7 +126,7 @@ public function exif() /** * Sends an appropriate header for the asset * - * @param bool $send + * @param bool $send * @return \Kirby\Http\Response|string */ public function header(bool $send = true) @@ -147,7 +147,7 @@ public function height(): int } /** - * @param array $attr + * @param array $attr * @return string */ public function html(array $attr = []): string diff --git a/src/Image/Location.php b/src/Image/Location.php index 3b02735d07..2c4e386312 100644 --- a/src/Image/Location.php +++ b/src/Image/Location.php @@ -68,8 +68,8 @@ public function lng() /** * Converts the gps coordinates * - * @param string|array $coord - * @param string $hemi + * @param string|array $coord + * @param string $hemi * @return float */ protected function gps($coord, string $hemi): float @@ -87,7 +87,7 @@ protected function gps($coord, string $hemi): float /** * Converts coordinates to floats * - * @param string $part + * @param string $part * @return float */ protected function num(string $part): float diff --git a/src/Session/AutoSession.php b/src/Session/AutoSession.php index 82c9c8ed10..f6a420c69a 100644 --- a/src/Session/AutoSession.php +++ b/src/Session/AutoSession.php @@ -21,19 +21,13 @@ class AutoSession /** * Creates a new AutoSession instance * - * @param \Kirby\Session\SessionStore|string $store SessionStore object or a path to the storage directory (uses the FileSessionStore) - * @param array $options Optional additional options: - * - `durationNormal`: Duration of normal sessions in seconds - * Defaults to 2 hours - * - `durationLong`: Duration of "remember me" sessions in seconds - * Defaults to 2 weeks - * - `timeout`: Activity timeout in seconds (integer or false for none) - * *Only* used for normal sessions - * Defaults to `1800` (half an hour) - * - `cookieName`: Name to use for the session cookie - * Defaults to `kirby_session` - * - `gcInterval`: How often should the garbage collector be run? - * Integer or `false` for never; defaults to `100` + * @param \Kirby\Session\SessionStore|string $store SessionStore object or a path to the storage directory (uses the FileSessionStore) + * @param array $options Optional additional options: + * - `durationNormal`: Duration of normal sessions in seconds; defaults to 2 hours + * - `durationLong`: Duration of "remember me" sessions in seconds; defaults to 2 weeks + * - `timeout`: Activity timeout in seconds (integer or false for none); *only* used for normal sessions; defaults to `1800` (half an hour) + * - `cookieName`: Name to use for the session cookie; defaults to `kirby_session` + * - `gcInterval`: How often should the garbage collector be run?; integer or `false` for never; defaults to `100` */ public function __construct($store, array $options = []) { @@ -56,15 +50,10 @@ public function __construct($store, array $options = []) /** * Returns the automatic session * - * @param array $options Optional additional options: - * - `detect`: Whether to allow sessions in the `Authorization` HTTP header (`true`) - * or only in the session cookie (`false`) - * Defaults to `false` - * - `createMode`: When creating a new session, should it be set as a cookie or is it going - * to be transmitted manually to be used in a header? - * Defaults to `cookie` - * - `long`: Whether the session is a long "remember me" session or a normal session - * Defaults to `false` + * @param array $options Optional additional options: + * - `detect`: Whether to allow sessions in the `Authorization` HTTP header (`true`) or only in the session cookie (`false`); defaults to `false` + * - `createMode`: When creating a new session, should it be set as a cookie or is it going to be transmitted manually to be used in a header?; defaults to `cookie` + * - `long`: Whether the session is a long "remember me" session or a normal session; defaults to `false` * @return \Kirby\Session\Session */ public function get(array $options = []) @@ -139,15 +128,11 @@ public function get(array $options = []) * Useful for custom applications like a password reset link * Does *not* affect the automatic session * - * @param array $options Optional additional options: - * - `startTime`: Time the session starts being valid (date string or timestamp) - * Defaults to `now` - * - `expiryTime`: Time the session expires (date string or timestamp) - * Defaults to `+ 2 hours` - * - `timeout`: Activity timeout in seconds (integer or false for none) - * Defaults to `1800` (half an hour) - * - `renewable`: Should it be possible to extend the expiry date? - * Defaults to `true` + * @param array $options Optional additional options: + * - `startTime`: Time the session starts being valid (date string or timestamp); defaults to `now` + * - `expiryTime`: Time the session expires (date string or timestamp); defaults to `+ 2 hours` + * - `timeout`: Activity timeout in seconds (integer or false for none); defaults to `1800` (half an hour) + * - `renewable`: Should it be possible to extend the expiry date?; defaults to `true` * @return \Kirby\Session\Session */ public function createManually(array $options = []) diff --git a/src/Session/FileSessionStore.php b/src/Session/FileSessionStore.php index d37767c30e..aeaee141ea 100644 --- a/src/Session/FileSessionStore.php +++ b/src/Session/FileSessionStore.php @@ -55,8 +55,8 @@ public function __construct(string $path) * Needs to make sure that the session does not already exist * and needs to reserve it by locking it exclusively. * - * @param int $expiryTime Timestamp - * @return string Randomly generated session ID (without timestamp) + * @param int $expiryTime Timestamp + * @return string Randomly generated session ID (without timestamp) */ public function createId(int $expiryTime): string { @@ -89,10 +89,10 @@ public function createId(int $expiryTime): string /** * Checks if the given session exists * - * @param int $expiryTime Timestamp - * @param string $id Session ID - * @return bool true: session exists, - * false: session doesn't exist + * @param int $expiryTime Timestamp + * @param string $id Session ID + * @return bool true: session exists, + * false: session doesn't exist */ public function exists(int $expiryTime, string $id): bool { @@ -108,8 +108,8 @@ public function exists(int $expiryTime, string $id): bool * * Needs to throw an Exception on error. * - * @param int $expiryTime Timestamp - * @param string $id Session ID + * @param int $expiryTime Timestamp + * @param string $id Session ID * @return void */ public function lock(int $expiryTime, string $id) @@ -146,8 +146,8 @@ public function lock(int $expiryTime, string $id) * * Needs to throw an Exception on error. * - * @param int $expiryTime Timestamp - * @param string $id Session ID + * @param int $expiryTime Timestamp + * @param string $id Session ID * @return void */ public function unlock(int $expiryTime, string $id) @@ -187,8 +187,8 @@ public function unlock(int $expiryTime, string $id) * * Needs to throw an Exception on error. * - * @param int $expiryTime Timestamp - * @param string $id Session ID + * @param int $expiryTime Timestamp + * @param string $id Session ID * @return string */ public function get(int $expiryTime, string $id): string @@ -250,9 +250,9 @@ public function get(int $expiryTime, string $id): string * Needs to make sure that the session exists. * Needs to throw an Exception on error. * - * @param int $expiryTime Timestamp - * @param string $id Session ID - * @param string $data Session data to write + * @param int $expiryTime Timestamp + * @param string $id Session ID + * @param string $data Session data to write * @return void */ public function set(int $expiryTime, string $id, string $data) @@ -303,8 +303,8 @@ public function set(int $expiryTime, string $id, string $data) * * Needs to throw an Exception on error. * - * @param int $expiryTime Timestamp - * @param string $id Session ID + * @param int $expiryTime Timestamp + * @param string $id Session ID * @return void */ public function destroy(int $expiryTime, string $id) @@ -392,8 +392,8 @@ public function __destruct() /** * Returns the combined name based on expiry time and ID * - * @param int $expiryTime Timestamp - * @param string $id Session ID + * @param int $expiryTime Timestamp + * @param string $id Session ID * @return string */ protected function name(int $expiryTime, string $id): string @@ -404,7 +404,7 @@ protected function name(int $expiryTime, string $id): string /** * Returns the full path to the session file * - * @param string $name Combined name + * @param string $name Combined name * @return string */ protected function path(string $name): string @@ -415,8 +415,8 @@ protected function path(string $name): string /** * Returns a PHP file handle for a session * - * @param string $name Combined name - * @return resource File handle + * @param string $name Combined name + * @return resource File handle */ protected function handle(string $name) { @@ -457,7 +457,7 @@ protected function handle(string $name) /** * Closes an open file handle * - * @param string $name Combined name + * @param string $name Combined name * @return void */ protected function closeHandle(string $name) diff --git a/src/Session/Session.php b/src/Session/Session.php index a8b5fbba18..3bdb0e8818 100644 --- a/src/Session/Session.php +++ b/src/Session/Session.php @@ -49,19 +49,14 @@ class Session /** * Creates a new Session instance * - * @param \Kirby\Session\Sessions $sessions Parent sessions object - * @param string|null $token Session token or null for a new session - * @param array $options Optional additional options: - * - `mode`: Token transmission mode (cookie or manual) - * Defaults to `cookie` - * - `startTime`: Time the session starts being valid (date string or timestamp) - * Defaults to `now` - * - `expiryTime`: Time the session expires (date string or timestamp) - * Defaults to `+ 2 hours` - * - `timeout`: Activity timeout in seconds (integer or false for none) - * Defaults to `1800` (half an hour) - * - `renewable`: Should it be possible to extend the expiry date? - * Defaults to `true` + * @param \Kirby\Session\Sessions $sessions Parent sessions object + * @param string|null $token Session token or null for a new session + * @param array $options Optional additional options: + * - `mode`: Token transmission mode (cookie or manual); defaults to `cookie` + * - `startTime`: Time the session starts being valid (date string or timestamp); defaults to `now` + * - `expiryTime`: Time the session expires (date string or timestamp); defaults to `+ 2 hours` + * - `timeout`: Activity timeout in seconds (integer or false for none); defaults to `1800` (half an hour) + * - `renewable`: Should it be possible to extend the expiry date?; defaults to `true` */ public function __construct(Sessions $sessions, $token, array $options) { @@ -156,8 +151,8 @@ public function token() * Gets or sets the transmission mode * Setting only works for new sessions that haven't been transmitted yet * - * @param string $mode Optional new transmission mode - * @return string Transmission mode + * @param string $mode Optional new transmission mode + * @return string Transmission mode */ public function mode(string $mode = null) { @@ -191,8 +186,8 @@ public function startTime(): int * Gets or sets the session expiry time * Setting the expiry time also updates the duration and regenerates the session token * - * @param string|int $expiryTime Optional new expiry timestamp or time string to set - * @return int Timestamp + * @param string|int $expiryTime Optional new expiry timestamp or time string to set + * @return int Timestamp */ public function expiryTime($expiryTime = null): int { @@ -226,8 +221,8 @@ public function expiryTime($expiryTime = null): int * Gets or sets the session duration * Setting the duration also updates the expiry time and regenerates the session token * - * @param int $duration Optional new duration in seconds to set - * @return int Number of seconds + * @param int $duration Optional new duration in seconds to set + * @return int Number of seconds */ public function duration(int $duration = null): int { @@ -252,8 +247,8 @@ public function duration(int $duration = null): int /** * Gets or sets the session timeout * - * @param int|false $timeout Optional new timeout to set or false to disable timeout - * @return int|false Number of seconds or false for "no timeout" + * @param int|false $timeout Optional new timeout to set or false to disable timeout + * @return int|false Number of seconds or false for "no timeout" */ public function timeout($timeout = null) { @@ -288,7 +283,7 @@ public function timeout($timeout = null) * Gets or sets the renewable flag * Automatically renews the session if renewing gets enabled * - * @param bool $renewable Optional new renewable flag to set + * @param bool $renewable Optional new renewable flag to set * @return bool */ public function renewable(bool $renewable = null): bool @@ -315,8 +310,8 @@ public function data() /** * Magic call method that proxies all calls to session data methods * - * @param string $name Method name (one of set, increment, decrement, get, pull, remove, clear) - * @param array $arguments Method arguments + * @param string $name Method name (one of set, increment, decrement, get, pull, remove, clear) + * @param array $arguments Method arguments * @return mixed */ public function __call(string $name, array $arguments) @@ -542,8 +537,8 @@ public function prepareForWriting() /** * Parses a token string into its parts and sets them as instance vars * - * @param string $token Session token - * @param bool $withoutKey If true, $token is passed without key + * @param string $token Session token + * @param bool $withoutKey If true, $token is passed without key * @return void */ protected function parseToken(string $token, bool $withoutKey = false) @@ -584,9 +579,9 @@ protected function parseToken(string $token, bool $withoutKey = false) /** * Makes sure that the given value is a valid timestamp * - * @param string|int $time Timestamp or date string (must be supported by `strtotime()`) - * @param int $now Timestamp to use as a base for the calculation of relative dates - * @return int Timestamp value + * @param string|int $time Timestamp or date string (must be supported by `strtotime()`) + * @param int $now Timestamp to use as a base for the calculation of relative dates + * @return int Timestamp value */ protected static function timeToTimestamp($time, int $now = null): int { diff --git a/src/Session/SessionData.php b/src/Session/SessionData.php index 77d4039331..a6aaf5ed3a 100644 --- a/src/Session/SessionData.php +++ b/src/Session/SessionData.php @@ -37,8 +37,8 @@ public function __construct(Session $session, array $data) /** * Sets one or multiple session values by key * - * @param string|array $key The key to define or a key-value array with multiple values - * @param mixed $value The value for the passed key (only if one $key is passed) + * @param string|array $key The key to define or a key-value array with multiple values + * @param mixed $value The value for the passed key (only if one $key is passed) * @return void */ public function set($key, $value = null) @@ -61,9 +61,9 @@ public function set($key, $value = null) /** * Increments one or multiple session values by a specified amount * - * @param string|array $key The key to increment or an array with multiple keys - * @param int $by Increment by which amount? - * @param int $max Maximum amount (value is not incremented further) + * @param string|array $key The key to increment or an array with multiple keys + * @param int $by Increment by which amount? + * @param int $max Maximum amount (value is not incremented further) * @return void */ public function increment($key, int $by = 1, $max = null) @@ -115,9 +115,9 @@ public function increment($key, int $by = 1, $max = null) /** * Decrements one or multiple session values by a specified amount * - * @param string|array $key The key to decrement or an array with multiple keys - * @param int $by Decrement by which amount? - * @param int $min Minimum amount (value is not decremented further) + * @param string|array $key The key to decrement or an array with multiple keys + * @param int $by Decrement by which amount? + * @param int $min Minimum amount (value is not decremented further) * @return void */ public function decrement($key, int $by = 1, $min = null) @@ -169,8 +169,8 @@ public function decrement($key, int $by = 1, $min = null) /** * Returns one or all session values by key * - * @param string|null $key The key to get or null for the entire data array - * @param mixed $default Optional default value to return if the key is not defined + * @param string|null $key The key to get or null for the entire data array + * @param mixed $default Optional default value to return if the key is not defined * @return mixed */ public function get($key = null, $default = null) @@ -190,8 +190,8 @@ public function get($key = null, $default = null) /** * Retrieves a value and removes it afterwards * - * @param string $key The key to get - * @param mixed $default Optional default value to return if the key is not defined + * @param string $key The key to get + * @param mixed $default Optional default value to return if the key is not defined * @return mixed */ public function pull(string $key, $default = null) @@ -208,7 +208,7 @@ public function pull(string $key, $default = null) /** * Removes one or multiple session values by key * - * @param string|array $key The key to remove or an array with multiple keys + * @param string|array $key The key to remove or an array with multiple keys * @return void */ public function remove($key) @@ -245,7 +245,7 @@ public function clear() * Reloads the data array with the current session data * Only used internally * - * @param array $data Currently stored session data + * @param array $data Currently stored session data * @return void */ public function reload(array $data) diff --git a/src/Session/SessionStore.php b/src/Session/SessionStore.php index ba7fda7978..a3a96110f3 100644 --- a/src/Session/SessionStore.php +++ b/src/Session/SessionStore.php @@ -17,18 +17,18 @@ abstract class SessionStore * Needs to make sure that the session does not already exist * and needs to reserve it by locking it exclusively. * - * @param int $expiryTime Timestamp - * @return string Randomly generated session ID (without timestamp) + * @param int $expiryTime Timestamp + * @return string Randomly generated session ID (without timestamp) */ abstract public function createId(int $expiryTime): string; /** * Checks if the given session exists * - * @param int $expiryTime Timestamp - * @param string $id Session ID - * @return bool true: session exists, - * false: session doesn't exist + * @param int $expiryTime Timestamp + * @param string $id Session ID + * @return bool true: session exists, + * false: session doesn't exist */ abstract public function exists(int $expiryTime, string $id): bool; @@ -37,8 +37,8 @@ abstract public function exists(int $expiryTime, string $id): bool; * * Needs to throw an Exception on error. * - * @param int $expiryTime Timestamp - * @param string $id Session ID + * @param int $expiryTime Timestamp + * @param string $id Session ID * @return void */ abstract public function lock(int $expiryTime, string $id); @@ -48,8 +48,8 @@ abstract public function lock(int $expiryTime, string $id); * * Needs to throw an Exception on error. * - * @param int $expiryTime Timestamp - * @param string $id Session ID + * @param int $expiryTime Timestamp + * @param string $id Session ID * @return void */ abstract public function unlock(int $expiryTime, string $id); @@ -59,8 +59,8 @@ abstract public function unlock(int $expiryTime, string $id); * * Needs to throw an Exception on error. * - * @param int $expiryTime Timestamp - * @param string $id Session ID + * @param int $expiryTime Timestamp + * @param string $id Session ID * @return string */ abstract public function get(int $expiryTime, string $id): string; @@ -71,9 +71,9 @@ abstract public function get(int $expiryTime, string $id): string; * Needs to make sure that the session exists. * Needs to throw an Exception on error. * - * @param int $expiryTime Timestamp - * @param string $id Session ID - * @param string $data Session data to write + * @param int $expiryTime Timestamp + * @param string $id Session ID + * @param string $data Session data to write * @return void */ abstract public function set(int $expiryTime, string $id, string $data); @@ -83,8 +83,8 @@ abstract public function set(int $expiryTime, string $id, string $data); * * Needs to throw an Exception on error. * - * @param int $expiryTime Timestamp - * @param string $id Session ID + * @param int $expiryTime Timestamp + * @param string $id Session ID * @return void */ abstract public function destroy(int $expiryTime, string $id); diff --git a/src/Session/Sessions.php b/src/Session/Sessions.php index 8f53ce999e..d947080ebb 100644 --- a/src/Session/Sessions.php +++ b/src/Session/Sessions.php @@ -30,14 +30,11 @@ class Sessions /** * Creates a new Sessions instance * - * @param \Kirby\Session\SessionStore|string $store SessionStore object or a path to the storage directory (uses the FileSessionStore) - * @param array $options Optional additional options: - * - `mode`: Default token transmission mode (cookie, header or manual) - * Defaults to `cookie` - * - `cookieName`: Name to use for the session cookie - * Defaults to `kirby_session` - * - `gcInterval`: How often should the garbage collector be run? - * Integer or `false` for never; defaults to `100` + * @param \Kirby\Session\SessionStore|string $store SessionStore object or a path to the storage directory (uses the FileSessionStore) + * @param array $options Optional additional options: + * - `mode`: Default token transmission mode (cookie, header or manual); defaults to `cookie` + * - `cookieName`: Name to use for the session cookie; defaults to `kirby_session` + * - `gcInterval`: How often should the garbage collector be run?; integer or `false` for never; defaults to `100` */ public function __construct($store, array $options = []) { @@ -93,17 +90,12 @@ public function __construct($store, array $options = []) /** * Creates a new empty session * - * @param array $options Optional additional options: - * - `mode`: Token transmission mode (cookie or manual) - * Defaults to default mode of the Sessions instance - * - `startTime`: Time the session starts being valid (date string or timestamp) - * Defaults to `now` - * - `expiryTime`: Time the session expires (date string or timestamp) - * Defaults to `+ 2 hours` - * - `timeout`: Activity timeout in seconds (integer or false for none) - * Defaults to `1800` (half an hour) - * - `renewable`: Should it be possible to extend the expiry date? - * Defaults to `true` + * @param array $options Optional additional options: + * - `mode`: Token transmission mode (cookie or manual); defaults to default mode of the Sessions instance + * - `startTime`: Time the session starts being valid (date string or timestamp); defaults to `now` + * - `expiryTime`: Time the session expires (date string or timestamp); defaults to `+ 2 hours` + * - `timeout`: Activity timeout in seconds (integer or false for none); defaults to `1800` (half an hour) + * - `renewable`: Should it be possible to extend the expiry date?; defaults to `true` * @return \Kirby\Session\Session */ public function create(array $options = []) @@ -119,8 +111,8 @@ public function create(array $options = []) /** * Returns the specified Session object * - * @param string $token Session token, either including or without the key - * @param string $mode Optional transmission mode override + * @param string $token Session token, either including or without the key + * @param string $mode Optional transmission mode override * @return \Kirby\Session\Session */ public function get(string $token, string $mode = null) diff --git a/src/Text/Markdown.php b/src/Text/Markdown.php index db3814f65d..98c07c471b 100644 --- a/src/Text/Markdown.php +++ b/src/Text/Markdown.php @@ -56,8 +56,8 @@ public function __construct(array $options = []) /** * Parses the given text and returns the HTML * - * @param string $text - * @param bool $inline + * @param string $text + * @param bool $inline * @return string */ public function parse(string $text, bool $inline = false): string diff --git a/src/Text/SmartyPants.php b/src/Text/SmartyPants.php index 3c6374aad4..50d70cb9be 100644 --- a/src/Text/SmartyPants.php +++ b/src/Text/SmartyPants.php @@ -115,7 +115,7 @@ public function __construct(array $options = []) /** * Parses the given text * - * @param string $text + * @param string $text * @return string */ public function parse(string $text): string diff --git a/src/Toolkit/A.php b/src/Toolkit/A.php index ec04b90e06..9d03da57a4 100644 --- a/src/Toolkit/A.php +++ b/src/Toolkit/A.php @@ -51,11 +51,11 @@ public static function append(array $array, array $append): array * // result: ['cat' => 'miao', 'dog' => 'wuff']; * * - * @param array $array The source array - * @param mixed $key The key to look for - * @param mixed $default Optional default value, which should be - * returned if no element has been found - * @return mixed + * @param array $array The source array + * @param mixed $key The key to look for + * @param mixed $default Optional default value, which should be + * returned if no element has been found + * @return mixed */ public static function get($array, $key, $default = null) { @@ -130,12 +130,12 @@ public static function join($value, $separator = ', ') /** * Merges arrays recursively * - * @param array $array1 - * @param array $array2 - * @param bool $mode Behavior for elements with numeric keys; - * A::MERGE_APPEND: elements are appended, keys are reset; - * A::MERGE_OVERWRITE: elements are overwritten, keys are preserved - * A::MERGE_REPLACE: non-associative arrays are completely replaced + * @param array $array1 + * @param array $array2 + * @param bool $mode Behavior for elements with numeric keys; + * A::MERGE_APPEND: elements are appended, keys are reset; + * A::MERGE_OVERWRITE: elements are overwritten, keys are preserved + * A::MERGE_REPLACE: non-associative arrays are completely replaced * @return array */ public static function merge($array1, $array2, $mode = A::MERGE_APPEND) @@ -196,10 +196,10 @@ public static function merge($array1, $array2, $mode = A::MERGE_APPEND) * // result: ['homer', 'marge', 'lisa']; * * - * @param array $array The source array - * @param string $key The key name of the column to extract - * @return array The result array with all values - * from that column. + * @param array $array The source array + * @param string $key The key name of the column to extract + * @return array The result array with all values + * from that column. */ public static function pluck(array $array, string $key) { @@ -243,8 +243,8 @@ public static function prepend(array $array, array $prepend): array * // ]; * * - * @param array $array The source array - * @return array The shuffled result array + * @param array $array The source array + * @return array The shuffled result array */ public static function shuffle(array $array): array { @@ -275,8 +275,8 @@ public static function shuffle(array $array): array * // first: 'miao' * * - * @param array $array The source array - * @return mixed The first element + * @param array $array The source array + * @return mixed The first element */ public static function first(array $array) { @@ -297,8 +297,8 @@ public static function first(array $array) * // last: 'tweet' * * - * @param array $array The source array - * @return mixed The last element + * @param array $array The source array + * @return mixed The last element */ public static function last(array $array) { @@ -326,12 +326,12 @@ public static function last(array $array) * // ]; * * - * @param array $array The source array - * @param int $limit The number of elements the array should - * contain after filling it up. - * @param mixed $fill The element, which should be used to - * fill the array - * @return array The filled-up result array + * @param array $array The source array + * @param int $limit The number of elements the array should + * contain after filling it up. + * @param mixed $fill The element, which should be used to + * fill the array + * @return array The filled-up result array */ public static function fill(array $array, int $limit, $fill = 'placeholder'): array { @@ -394,10 +394,10 @@ public static function move(array $array, int $from, int $to): array * // ]; * * - * @param array $array The source array - * @param array $required An array of required keys - * @return array An array of missing fields. If this - * is empty, nothing is missing. + * @param array $array The source array + * @param array $required An array of required keys + * @return array An array of missing fields. If this + * is empty, nothing is missing. */ public static function missing(array $array, array $required = []): array { @@ -451,13 +451,13 @@ public static function missing(array $array, array $required = []): array * * * - * @param array $array The source array - * @param string $field The name of the column - * @param string $direction desc (descending) or asc (ascending) - * @param int $method A PHP sort method flag or 'natural' for - * natural sorting, which is not supported in - * PHP by sort flags - * @return array The sorted array + * @param array $array The source array + * @param string $field The name of the column + * @param string $direction desc (descending) or asc (ascending) + * @param int $method A PHP sort method flag or 'natural' for + * natural sorting, which is not supported in + * PHP by sort flags + * @return array The sorted array */ public static function sort(array $array, string $field, string $direction = 'desc', $method = SORT_REGULAR): array { @@ -500,8 +500,8 @@ public static function sort(array $array, string $field, string $direction = 'de * // returns: true * * - * @param array $array The array to analyze - * @return bool true: The array is associative false: It's not + * @param array $array The array to analyze + * @return bool true: The array is associative false: It's not */ public static function isAssociative(array $array): bool { @@ -511,9 +511,9 @@ public static function isAssociative(array $array): bool /** * Returns the average value of an array * - * @param array $array The source array - * @param int $decimals The number of decimals to return - * @return float The average value + * @param array $array The source array + * @param int $decimals The number of decimals to return + * @return float The average value */ public static function average(array $array, int $decimals = 0): float { @@ -568,8 +568,8 @@ public static function extend(...$arrays): array * ]); * * - * @param array $array - * @param array $update + * @param array $array + * @param array $update * @return array */ public static function update(array $array, array $update): array diff --git a/src/Toolkit/Collection.php b/src/Toolkit/Collection.php index a0fbd70065..47e37682d4 100644 --- a/src/Toolkit/Collection.php +++ b/src/Toolkit/Collection.php @@ -35,8 +35,8 @@ class Collection extends Iterator implements Countable /** * Magic getter function * - * @param string $key - * @param mixed $arguments + * @param string $key + * @param mixed $arguments * @return mixed */ public function __call(string $key, $arguments) @@ -67,7 +67,7 @@ public function __debugInfo(): array /** * Low-level getter for elements * - * @param mixed $key + * @param mixed $key * @return mixed */ public function __get($key) @@ -82,8 +82,8 @@ public function __get($key) /** * Low-level setter for elements * - * @param string $key string or array - * @param mixed $value + * @param string $key string or array + * @param mixed $value */ public function __set(string $key, $value) { @@ -114,8 +114,8 @@ public function __unset($key) /** * Appends an element * - * @param mixed $key - * @param mixed $item + * @param mixed $key + * @param mixed $item * @return \Kirby\Toolkit\Collection */ public function append(...$args) @@ -133,9 +133,9 @@ public function append(...$args) * Creates chunks of the same size. * The last chunk may be smaller * - * @param int $size Number of elements per chunk - * @return \Kirby\Toolkit\Collection A new collection with an element for each chunk and - * a sub collection in each chunk + * @param int $size Number of elements per chunk + * @return \Kirby\Toolkit\Collection A new collection with an element for each chunk and + * a sub collection in each chunk */ public function chunk(int $size) { @@ -175,7 +175,7 @@ public function clone() /** * Getter and setter for the data * - * @param array $data + * @param array $data * @return array|Collection */ public function data(array $data = null) @@ -422,8 +422,8 @@ public function flip() /** * Getter * - * @param mixed $key - * @param mixed $default + * @param mixed $key + * @param mixed $default * @return mixed */ public function get($key, $default = null) @@ -596,7 +596,7 @@ public function last() /** * Returns a new object with a limited number of elements * - * @param int $limit The number of elements to return + * @param int $limit The number of elements to return * @return \Kirby\Toolkit\Collection */ public function limit(int $limit) @@ -607,7 +607,7 @@ public function limit(int $limit) /** * Map a function to each element * - * @param callable $callback + * @param callable $callback * @return \Kirby\Toolkit\Collection */ public function map(callable $callback) @@ -645,7 +645,7 @@ public function not(...$keys) /** * Returns a new object starting from the given offset * - * @param int $offset The index to start from + * @param int $offset The index to start from * @return \Kirby\Toolkit\Collection */ public function offset(int $offset) @@ -710,8 +710,8 @@ public function pluck(string $field, string $split = null, bool $unique = false) /** * Prepends an element to the data array * - * @param mixed $key - * @param mixed $item + * @param mixed $key + * @param mixed $item * @return self */ public function prepend(...$args) @@ -790,8 +790,8 @@ public function remove($key) /** * Adds a new element to the collection * - * @param mixed $key string or array - * @param mixed $value + * @param mixed $key string or array + * @param mixed $value * @return self */ public function set($key, $value = null) @@ -830,8 +830,8 @@ public function shuffle() /** * Returns a slice of the object * - * @param int $offset The optional index to start the slice from - * @param int $limit The optional number of elements to return + * @param int $offset The optional index to start the slice from + * @param int $limit The optional number of elements to return * @return \Kirby\Toolkit\Collection */ public function slice(int $offset = 0, int $limit = null) @@ -868,10 +868,10 @@ public static function sortArgs(string $sortBy): array /** * Sorts the elements by any number of fields * - * @param $field string|callable Field name or value callback to sort by - * @param $direction string asc or desc - * @param $method int The sort flag, SORT_REGULAR, SORT_NUMERIC etc. - * @return Collection + * @param string|callable $field Field name or value callback to sort by + * @param string $direction asc or desc + * @param int $method The sort flag, SORT_REGULAR, SORT_NUMERIC etc. + * @return Collection */ public function sortBy() { @@ -1030,7 +1030,7 @@ public function values(): array /** * Alias for $this->not() * - * @param string ...$keys any number of keys, passed as individual arguments + * @param string ...$keys any number of keys, passed as individual arguments * @return \Kirby\Toolkit\Collection */ public function without(...$keys) diff --git a/src/Toolkit/Dir.php b/src/Toolkit/Dir.php index 043462f686..f079b0c115 100644 --- a/src/Toolkit/Dir.php +++ b/src/Toolkit/Dir.php @@ -207,9 +207,9 @@ public static function link(string $source, string $link): bool /** * Creates a new directory * - * @param string $dir The path for the new directory - * @param bool $recursive Create all parent directories, which don't exist - * @return bool True: the dir has been created, false: creating failed + * @param string $dir The path for the new directory + * @param bool $recursive Create all parent directories, which don't exist + * @return bool True: the dir has been created, false: creating failed */ public static function make(string $dir, bool $recursive = true): bool { @@ -240,10 +240,10 @@ public static function make(string $dir, bool $recursive = true): bool * Recursively check when the dir and all * subfolders have been modified for the last time. * - * @param string $dir The path of the directory - * @param string $format - * @param string $handler - * @return int + * @param string $dir The path of the directory + * @param string $format + * @param string $handler + * @return int */ public static function modified(string $dir, string $format = null, string $handler = 'date') { @@ -266,9 +266,9 @@ public static function modified(string $dir, string $format = null, string $hand /** * Moves a directory to a new location * - * @param string $old The current path of the directory - * @param string $new The desired path where the dir should be moved to - * @return bool true: the directory has been moved, false: moving failed + * @param string $old The current path of the directory + * @param string $new The desired path where the dir should be moved to + * @return bool true: the directory has been moved, false: moving failed */ public static function move(string $old, string $new): bool { @@ -302,10 +302,10 @@ public static function niceSize(string $dir) * Reads all files from a directory and returns them as an array. * It skips unwanted invisible stuff. * - * @param string $dir The path of directory - * @param array $ignore Optional array with filenames, which should be ignored - * @param bool $absolute If true, the full path for each item will be returned - * @return array An array of filenames + * @param string $dir The path of directory + * @param array $ignore Optional array with filenames, which should be ignored + * @param bool $absolute If true, the full path for each item will be returned + * @return array An array of filenames */ public static function read(string $dir, array $ignore = null, bool $absolute = false): array { @@ -370,8 +370,8 @@ public static function remove(string $dir): bool /** * Gets the size of the directory and all subfolders and files * - * @param string $dir The path of the directory - * @return mixed + * @param string $dir The path of the directory + * @return mixed */ public static function size(string $dir) { diff --git a/src/Toolkit/Escape.php b/src/Toolkit/Escape.php index 0a156764f5..9647696669 100644 --- a/src/Toolkit/Escape.php +++ b/src/Toolkit/Escape.php @@ -38,7 +38,7 @@ class Escape *
content
*
content
* - * @param string $string + * @param string $string * @return string */ public static function attr($string) @@ -59,7 +59,7 @@ public static function attr($string) * * text * - * @param string $string + * @param string $string * @return string */ public static function css($string) @@ -79,7 +79,7 @@ public static function css($string) * ...ESCAPE UNTRUSTED DATA BEFORE PUTTING HERE... *
...ESCAPE UNTRUSTED DATA BEFORE PUTTING HERE...
* - * @param string $string + * @param string $string * @return string */ public static function html($string) @@ -97,7 +97,7 @@ public static function html($string) * *
* - * @param string $string + * @param string $string * @return string */ public static function js($string) @@ -113,7 +113,7 @@ public static function js($string) * * link * - * @param string $string + * @param string $string * @return string */ public static function url($string) @@ -135,7 +135,7 @@ public static function url($string) * < is replaced with < * > is replaced with > * - * @param string $string + * @param string $string * @return string */ public static function xml($string) diff --git a/src/Toolkit/F.php b/src/Toolkit/F.php index c37839a2a1..79efb74138 100644 --- a/src/Toolkit/F.php +++ b/src/Toolkit/F.php @@ -108,8 +108,8 @@ class F /** * Appends new content to an existing file * - * @param string $file The path for the file - * @param mixed $content Either a string or an array. Arrays will be converted to JSON. + * @param string $file The path for the file + * @param mixed $content Either a string or an array. Arrays will be converted to JSON. * @return bool */ public static function append(string $file, $content): bool @@ -131,9 +131,9 @@ public static function base64(string $file): string /** * Copy a file to a new location. * - * @param string $source - * @param string $target - * @param bool $force + * @param string $source + * @param string $target + * @param bool $force * @return bool */ public static function copy(string $source, string $target, bool $force = false): bool @@ -162,7 +162,7 @@ public static function copy(string $source, string $target, bool $force = false) * * * - * @param string $file The path + * @param string $file The path * @return string */ public static function dirname(string $file): string @@ -190,8 +190,8 @@ public static function exists(string $file, string $in = null): bool /** * Gets the extension of a file * - * @param string $file The filename or path - * @param string $extension Set an optional extension to overwrite the current one + * @param string $file The filename or path + * @param string $extension Set an optional extension to overwrite the current one * @return string */ public static function extension(string $file = null, string $extension = null): string @@ -258,7 +258,7 @@ public static function extensions(string $type = null) * * * - * @param string $name The path + * @param string $name The path * @return string */ public static function filename(string $name): string @@ -269,7 +269,7 @@ public static function filename(string $name): string /** * Invalidate opcode cache for file. * - * @param string $file The path of the file + * @param string $file The path of the file * @return bool */ public static function invalidateOpcodeCache(string $file): bool @@ -414,9 +414,9 @@ public static function mimeToType(string $mime) /** * Get the file's last modification time. * - * @param string $file - * @param string $format - * @param string $handler date or strftime + * @param string $file + * @param string $format + * @param string $handler date or strftime * @return mixed */ public static function modified(string $file, string $format = null, string $handler = 'date') @@ -440,9 +440,9 @@ public static function modified(string $file, string $format = null, string $han /** * Moves a file to a new location * - * @param string $oldRoot The current path for the file - * @param string $newRoot The path to the new location - * @param bool $force Force move if the target file exists + * @param string $oldRoot The current path for the file + * @param string $newRoot The path to the new location + * @param bool $force Force move if the target file exists * @return bool */ public static function move(string $oldRoot, string $newRoot, bool $force = false): bool @@ -472,7 +472,7 @@ public static function move(string $oldRoot, string $newRoot, bool $force = fals /** * Extracts the name from a file path or filename without extension * - * @param string $name The path or filename + * @param string $name The path or filename * @return string */ public static function name(string $name): string @@ -483,7 +483,7 @@ public static function name(string $name): string /** * Converts an integer size into a human readable format * - * @param mixed $size The file size or a file path + * @param mixed $size The file size or a file path * @return string|int */ public static function niceSize($size): string @@ -508,7 +508,7 @@ public static function niceSize($size): string /** * Reads the content of a file * - * @param string $file The path for the file + * @param string $file The path for the file * @return string|false */ public static function read(string $file) @@ -520,9 +520,9 @@ public static function read(string $file) * Changes the name of the file without * touching the extension * - * @param string $file - * @param string $newName - * @param bool $overwrite Force overwrite existing files + * @param string $file + * @param string $newName + * @param bool $overwrite Force overwrite existing files * @return string|false */ public static function rename(string $file, string $newName, bool $overwrite = false) @@ -610,7 +610,7 @@ public static function relativepath(string $file, string $in = null): string * * * - * @param string $file The path for the file + * @param string $file The path for the file * @return bool */ public static function remove(string $file): bool @@ -642,7 +642,7 @@ public static function remove(string $file): bool * * * - * @param string $string The file name + * @param string $string The file name * @return string */ public static function safeName(string $string): string @@ -675,7 +675,7 @@ public static function similar(string $path, string $pattern = '*'): array /** * Returns the size of a file. * - * @param mixed $file The path + * @param mixed $file The path * @return int */ public static function size(string $file): int @@ -765,9 +765,9 @@ public static function uri(string $file) /** * Creates a new file * - * @param string $file The path for the new file - * @param mixed $content Either a string, an object or an array. Arrays and objects will be serialized. - * @param bool $append true: append the content to an exisiting file if available. false: overwrite. + * @param string $file The path for the new file + * @param mixed $content Either a string, an object or an array. Arrays and objects will be serialized. + * @param bool $append true: append the content to an exisiting file if available. false: overwrite. * @return bool */ public static function write(string $file, $content, bool $append = false): bool diff --git a/src/Toolkit/File.php b/src/Toolkit/File.php index d68aab8694..4a4ac900bf 100644 --- a/src/Toolkit/File.php +++ b/src/Toolkit/File.php @@ -56,8 +56,8 @@ public function base64(): string /** * Copy a file to a new location. * - * @param string $target - * @param bool $force + * @param string $target + * @param bool $force * @return self */ public function copy(string $target, bool $force = false) @@ -177,8 +177,8 @@ public function mime() /** * Get the file's last modification time. * - * @param string $format - * @param string $handler date or strftime + * @param string $format + * @param string $handler date or strftime * @return mixed */ public function modified(string $format = null, string $handler = 'date') @@ -189,8 +189,8 @@ public function modified(string $format = null, string $handler = 'date') /** * Move the file to a new location * - * @param string $newRoot - * @param bool $overwrite Force overwriting any existing files + * @param string $newRoot + * @param bool $overwrite Force overwriting any existing files * @return self */ public function move(string $newRoot, bool $overwrite = false) @@ -248,8 +248,8 @@ public function realpath(): string * Changes the name of the file without * touching the extension * - * @param string $newName - * @param bool $overwrite Force overwrite existing files + * @param string $newName + * @param bool $overwrite Force overwrite existing files * @return self */ public function rename(string $newName, bool $overwrite = false) @@ -276,7 +276,7 @@ public function root(): ?string /** * Returns the raw size of the file * - * @return int + * @return int */ public function size(): int { @@ -321,7 +321,7 @@ public function type() /** * Writes content to the file * - * @param string $content + * @param string $content * @return bool */ public function write($content): bool diff --git a/src/Toolkit/Html.php b/src/Toolkit/Html.php index 02cfad2893..8e3c49df70 100644 --- a/src/Toolkit/Html.php +++ b/src/Toolkit/Html.php @@ -144,8 +144,8 @@ public static function breaks(string $string = null): string * * * - * @param string $string - * @return string The html string + * @param string $string + * @return string The html string */ public static function decode(string $string = null): string { @@ -189,9 +189,9 @@ public static function email(string $email, $text = null, array $attr = []): str /** * Converts a string to a html-safe string * - * @param string $string - * @param bool $keepTags - * @return string The html string + * @param string $string + * @param bool $keepTags + * @return string The html string */ public static function encode(string $string = null, bool $keepTags = false): string { diff --git a/src/Toolkit/Iterator.php b/src/Toolkit/Iterator.php index c38e526dac..20d55a8752 100644 --- a/src/Toolkit/Iterator.php +++ b/src/Toolkit/Iterator.php @@ -115,8 +115,8 @@ public function count(): int /** * Tries to find the index number for the given element * - * @param mixed $needle the element to search for - * @return string|false the name of the key or false + * @param mixed $needle the element to search for + * @return string|false the name of the key or false */ public function indexOf($needle) { @@ -126,8 +126,8 @@ public function indexOf($needle) /** * Tries to find the key for the given element * - * @param mixed $needle the element to search for - * @return string|false the name of the key or false + * @param mixed $needle the element to search for + * @return string|false the name of the key or false */ public function keyOf($needle) { @@ -137,7 +137,7 @@ public function keyOf($needle) /** * Checks by key if an element is included * - * @param mixed $key + * @param mixed $key * @return bool */ public function has($key): bool @@ -148,7 +148,7 @@ public function has($key): bool /** * Checks if the current key is set * - * @param mixed $key the key to check + * @param mixed $key the key to check * @return bool */ public function __isset($key): bool diff --git a/src/Toolkit/Query.php b/src/Toolkit/Query.php index d608ad77be..391f0f26ae 100644 --- a/src/Toolkit/Query.php +++ b/src/Toolkit/Query.php @@ -114,7 +114,7 @@ protected function resolve(string $query) /** * Breaks the query string down into its components * - * @param string $query + * @param string $query * @return array */ protected function parts(string $query): array @@ -137,7 +137,7 @@ protected function parts(string $query): array * Analyzes each part of the query string and * extracts methods and method arguments. * - * @param string $part + * @param string $part * @return array */ protected function part(string $part): array @@ -158,7 +158,7 @@ protected function part(string $part): array * Converts a parameter of query to * proper type. * - * @param mixed $arg + * @param mixed $arg * @return mixed */ protected function parameter($arg) diff --git a/src/Toolkit/Str.php b/src/Toolkit/Str.php index fcb3a74c6e..a0257d7663 100644 --- a/src/Toolkit/Str.php +++ b/src/Toolkit/Str.php @@ -169,9 +169,9 @@ public static function accepted(string $input): array /** * Returns the rest of the string after the given character * - * @param string $string - * @param string $needle - * @param bool $caseInsensitive + * @param string $string + * @param string $needle + * @param bool $caseInsensitive * @return string */ public static function after(string $string, string $needle, bool $caseInsensitive = false): string @@ -188,7 +188,7 @@ public static function after(string $string, string $needle, bool $caseInsensiti /** * Convert a string to 7-bit ASCII. * - * @param string $string + * @param string $string * @return string */ public static function ascii(string $string): string @@ -211,9 +211,9 @@ public static function ascii(string $string): string /** * Returns the beginning of a string before the given character * - * @param string $string - * @param string $needle - * @param bool $caseInsensitive + * @param string $string + * @param string $needle + * @param bool $caseInsensitive * @return string */ public static function before(string $string, string $needle, bool $caseInsensitive = false): string @@ -243,9 +243,9 @@ public static function between(string $string = null, string $start, string $end /** * Checks if a str contains another string * - * @param string $string - * @param string $needle - * @param bool $caseInsensitive + * @param string $string + * @param string $needle + * @param bool $caseInsensitive * @return bool */ public static function contains(string $string = null, string $needle, bool $caseInsensitive = false): bool @@ -279,7 +279,7 @@ public static function convert($string, $targetEncoding, $sourceEncoding = null) /** * Encode a string (used for email addresses) * - * @param string $string + * @param string $string * @return string */ public static function encode(string $string): string @@ -298,7 +298,7 @@ public static function encode(string $string): string /** * Tries to detect the string encoding * - * @param string $string + * @param string $string * @return string */ public static function encoding(string $string): string @@ -309,9 +309,9 @@ public static function encoding(string $string): string /** * Checks if a string ends with the passed needle * - * @param string $string - * @param string $needle - * @param bool $caseInsensitive + * @param string $string + * @param string $needle + * @param bool $caseInsensitive * @return bool */ public static function endsWith(string $string, string $needle, bool $caseInsensitive = false): bool @@ -335,11 +335,11 @@ public static function endsWith(string $string, string $needle, bool $caseInsens * It removes all html tags first and then cuts the string * according to the specified number of chars. * - * @param string $string The string to be shortened - * @param int $chars The final number of characters the string should have - * @param bool $strip True: remove the HTML tags from the string first - * @param string $rep The element, which should be added if the string is too long. Ellipsis is the default. - * @return string The shortened string + * @param string $string The string to be shortened + * @param int $chars The final number of characters the string should have + * @param bool $strip True: remove the HTML tags from the string first + * @param string $rep The element, which should be added if the string is too long. Ellipsis is the default. + * @return string The shortened string */ public static function excerpt($string, $chars = 140, $strip = true, $rep = '…') { @@ -381,9 +381,9 @@ public static function float($value): string /** * Returns the rest of the string starting from the given character * - * @param string $string - * @param string $needle - * @param bool $caseInsensitive + * @param string $string + * @param string $needle + * @param bool $caseInsensitive * @return string */ public static function from(string $string, string $needle, bool $caseInsensitive = false): string @@ -411,7 +411,7 @@ public static function isURL(string $string = null): bool /** * Convert a string to kebab case. * - * @param string $value + * @param string $value * @return string */ public static function kebab(string $value = null): string @@ -422,7 +422,7 @@ public static function kebab(string $value = null): string /** * A UTF-8 safe version of strlen() * - * @param string $string + * @param string $string * @return int */ public static function length(string $string = null): int @@ -433,7 +433,7 @@ public static function length(string $string = null): int /** * A UTF-8 safe version of strtolower() * - * @param string $string + * @param string $string * @return string */ public static function lower(string $string = null): string @@ -457,8 +457,8 @@ public static function ltrim(string $string, string $trim = ' '): string /** * Get a character pool with various possible combinations * - * @param string|array $type - * @param bool $array + * @param string|array $type + * @param bool $array * @return string|array */ public static function pool($type, bool $array = true) @@ -498,9 +498,9 @@ public static function pool($type, bool $array = true) * Returns the position of a needle in a string * if it can be found * - * @param string $string - * @param string $needle - * @param bool $caseInsensitive + * @param string $string + * @param string $needle + * @param bool $caseInsensitive * @return int|bool */ public static function position(string $string = null, string $needle, bool $caseInsensitive = false) @@ -565,15 +565,15 @@ public static function random(int $length = null, string $type = 'alphaNum') * Replaces all or some occurrences of the search string with the replacement string * Extension of the str_replace() function in PHP with an additional $limit parameter * - * @param string|array $string String being replaced on (haystack); - * can be an array of multiple subject strings - * @param string|array $search Value being searched for (needle) - * @param string|array $replace Value to replace matches with - * @param int|array $limit Maximum possible replacements for each search value; - * multiple limits for each search value are supported; - * defaults to no limit - * @return string|array String with replaced values; - * if $string is an array, array of strings + * @param string|array $string String being replaced on (haystack); + * can be an array of multiple subject strings + * @param string|array $search Value being searched for (needle) + * @param string|array $replace Value to replace matches with + * @param int|array $limit Maximum possible replacements for each search value; + * multiple limits for each search value are supported; + * defaults to no limit + * @return string|array String with replaced values; + * if $string is an array, array of strings */ public static function replace($string, $search, $replace, $limit = -1) { @@ -622,13 +622,13 @@ public static function replace($string, $search, $replace, $limit = -1) * Generates a replacement array out of dynamic input data * Used for Str::replace() * - * @param string|array $search Value being searched for (needle) - * @param string|array $replace Value to replace matches with - * @param int|array $limit Maximum possible replacements for each search value; - * multiple limits for each search value are supported; - * defaults to no limit - * @return array List of replacement arrays, each with a - * 'search', 'replace' and 'limit' attribute + * @param string|array $search Value being searched for (needle) + * @param string|array $replace Value to replace matches with + * @param int|array $limit Maximum possible replacements for each search value; + * multiple limits for each search value are supported; + * defaults to no limit + * @return array List of replacement arrays, each with a + * 'search', 'replace' and 'limit' attribute */ public static function replacements($search, $replace, $limit): array { @@ -673,9 +673,9 @@ public static function replacements($search, $replace, $limit): array * Takes a replacement array and processes the replacements * Used for Str::replace() * - * @param string $string String being replaced on (haystack) - * @param array $replacements Replacement array from Str::replacements() - * @return string String with replaced values + * @param string $string String being replaced on (haystack) + * @param array $replacements Replacement array from Str::replacements() + * @return string String with replaced values */ public static function replaceReplacements(string $string, array $replacements): string { @@ -736,12 +736,12 @@ public static function rtrim(string $string, string $trim = ' '): string * * * - * @param string $string The string to be shortened - * @param int $length The final number of characters the - * string should have - * @param string $appendix The element, which should be added if the - * string is too long. Ellipsis is the default. - * @return string The shortened string + * @param string $string The string to be shortened + * @param int $length The final number of characters the + * string should have + * @param string $appendix The element, which should be added if the + * string is too long. Ellipsis is the default. + * @return string The shortened string */ public static function short(string $string = null, int $length = 0, string $appendix = '…'): ?string { @@ -759,11 +759,11 @@ public static function short(string $string = null, int $length = 0, string $app /** * Convert a string to a safe version to be used in a URL * - * @param string $string The unsafe string - * @param string $separator To be used instead of space and - * other non-word characters. - * @param string $allowed List of all allowed characters (regex) - * @return string The safe string + * @param string $string The unsafe string + * @param string $separator To be used instead of space and + * other non-word characters. + * @param string $allowed List of all allowed characters (regex) + * @return string The safe string */ public static function slug(string $string = null, string $separator = null, string $allowed = null): string { @@ -795,8 +795,8 @@ public static function slug(string $string = null, string $separator = null, str /** * Convert a string to snake case. * - * @param string $value - * @param string $delimiter + * @param string $value + * @param string $delimiter * @return string */ public static function snake(string $value = null, string $delimiter = '_'): string @@ -814,10 +814,10 @@ public static function snake(string $value = null, string $delimiter = '_'): str * and it has a built-in way to skip values * which are too short. * - * @param string $string The string to split - * @param string $separator The string to split by - * @param int $length The min length of values. - * @return array An array of found values + * @param string $string The string to split + * @param string $separator The string to split by + * @param int $length The min length of values. + * @return array An array of found values */ public static function split($string, string $separator = ',', int $length = 1): array { @@ -841,9 +841,9 @@ public static function split($string, string $separator = ',', int $length = 1): /** * Checks if a string starts with the passed needle * - * @param string $string - * @param string $needle - * @param bool $caseInsensitive + * @param string $string + * @param string $needle + * @param bool $caseInsensitive * @return bool */ public static function startsWith(string $string = null, string $needle, bool $caseInsensitive = false): bool @@ -858,9 +858,9 @@ public static function startsWith(string $string = null, string $needle, bool $c /** * A UTF-8 safe version of substr() * - * @param string $string - * @param int $start - * @param int $length + * @param string $string + * @param int $start + * @param int $length * @return string */ public static function substr(string $string = null, int $start = 0, int $length = null): string @@ -878,13 +878,13 @@ public static function substr(string $string = null, int $start = 0, int $length * * * - * @param string $string The string with placeholders - * @param array $data Associative array with placeholders as - * keys and replacements as values - * @param string $fallback A fallback if a token does not have any matches - * @param string $start Placeholder start characters - * @param string $end Placeholder end characters - * @return string The filled-in string + * @param string $string The string with placeholders + * @param array $data Associative array with placeholders as + * keys and replacements as values + * @param string $fallback A fallback if a token does not have any matches + * @param string $start Placeholder start characters + * @param string $end Placeholder end characters + * @return string The filled-in string */ public static function template(string $string = null, array $data = [], string $fallback = null, string $start = '{{', string $end = '}}'): string { @@ -969,7 +969,7 @@ public static function trim(string $string, string $trim = ' '): string /** * A UTF-8 safe version of ucfirst() * - * @param string $string + * @param string $string * @return string */ public static function ucfirst(string $string = null): string @@ -980,7 +980,7 @@ public static function ucfirst(string $string = null): string /** * A UTF-8 safe version of ucwords() * - * @param string $string + * @param string $string * @return string */ public static function ucwords(string $string = null): string @@ -998,8 +998,8 @@ public static function ucwords(string $string = null): string * * * - * @param string $string - * @return string The html string + * @param string $string + * @return string The html string */ public static function unhtml(string $string = null): string { @@ -1009,9 +1009,9 @@ public static function unhtml(string $string = null): string /** * Returns the beginning of a string until the given character * - * @param string $string - * @param string $needle - * @param bool $caseInsensitive + * @param string $string + * @param string $needle + * @param bool $caseInsensitive * @return string */ public static function until(string $string, string $needle, bool $caseInsensitive = false): string @@ -1028,7 +1028,7 @@ public static function until(string $string, string $needle, bool $caseInsensiti /** * A UTF-8 safe version of strotoupper() * - * @param string $string + * @param string $string * @return string */ public static function upper(string $string = null): string diff --git a/src/Toolkit/V.php b/src/Toolkit/V.php index f8b130a558..5a88ff0c4b 100644 --- a/src/Toolkit/V.php +++ b/src/Toolkit/V.php @@ -102,10 +102,10 @@ public static function validators(): array * a set of rules, using all registered * validators * - * @param mixed $value - * @param array $rules - * @param array $messages - * @param bool $fail + * @param mixed $value + * @param array $rules + * @param array $messages + * @param bool $fail * @return bool|array */ public static function value($value, array $rules, array $messages = [], bool $fail = true) @@ -142,8 +142,8 @@ public static function value($value, array $rules, array $messages = [], bool $f * a set of rules, using all registered * validators * - * @param array $input - * @param array $rules + * @param array $input + * @param array $rules * @return bool */ public static function input(array $input, array $rules): bool @@ -179,8 +179,8 @@ public static function input(array $input, array $rules): bool /** * Calls an installed validator and passes all arguments * - * @param string $method - * @param array $arguments + * @param string $method + * @param array $arguments * @return bool */ public static function __callStatic(string $method, array $arguments): bool diff --git a/src/Toolkit/View.php b/src/Toolkit/View.php index c11b5e026c..db545918aa 100644 --- a/src/Toolkit/View.php +++ b/src/Toolkit/View.php @@ -34,7 +34,7 @@ class View * Creates a new view object * * @param string $file - * @param array $data + * @param array $data */ public function __construct(string $file, array $data = []) { diff --git a/src/Toolkit/Xml.php b/src/Toolkit/Xml.php index ec3855fa0f..563f57e8cb 100644 --- a/src/Toolkit/Xml.php +++ b/src/Toolkit/Xml.php @@ -56,11 +56,11 @@ class Xml /** * Creates an XML string from an array * - * @param string $props The source array - * @param string $name The name of the root element - * @param bool $head Include the xml declaration head or not - * @param int $level The indendation level - * @return string The XML string + * @param string $props The source array + * @param string $name The name of the root element + * @param bool $head Include the xml declaration head or not + * @param int $level The indendation level + * @return string The XML string */ public static function create($props, string $name = 'root', bool $head = true, $level = 0): string { @@ -116,7 +116,7 @@ public static function create($props, string $name = 'root', bool $head = true, * * * - * @param string $string + * @param string $string * @return string */ public static function decode(string $string = null): string @@ -136,8 +136,8 @@ public static function decode(string $string = null): string * * * - * @param string $string - * @param bool $html True: convert to html first + * @param string $string + * @param bool $html True: convert to html first * @return string */ public static function encode(string $string = null, bool $html = true): string @@ -166,7 +166,7 @@ public static function entities(): array /** * Parses a XML string and returns an array * - * @param string $xml + * @param string $xml * @return array|false */ public static function parse(string $xml = null) diff --git a/tests/Session/FileSessionStoreTest.php b/tests/Session/FileSessionStoreTest.php index 1b36e0fe83..937089eeb0 100644 --- a/tests/Session/FileSessionStoreTest.php +++ b/tests/Session/FileSessionStoreTest.php @@ -335,7 +335,7 @@ public function testCollectGarbage() /** * Asserts that the given session is currently locked * - * @param string $name Combined name + * @param string $name Combined name * @return void */ protected function assertLocked(string $name) @@ -356,7 +356,7 @@ protected function assertLocked(string $name) /** * Asserts that the given session is currently not locked * - * @param string $name Combined name + * @param string $name Combined name * @return void */ protected function assertNotLocked(string $name) @@ -377,7 +377,7 @@ protected function assertNotLocked(string $name) /** * Asserts that the given session currently has an open handle * - * @param string $name Combined name + * @param string $name Combined name * @return void */ protected function assertHandleExists(string $name) @@ -389,7 +389,7 @@ protected function assertHandleExists(string $name) /** * Asserts that the given session currently has no open handle * - * @param string $name Combined name + * @param string $name Combined name * @return void */ protected function assertHandleNotExists(string $name) diff --git a/tests/Session/SessionTest.php b/tests/Session/SessionTest.php index 65f9ae1032..421f061b2f 100644 --- a/tests/Session/SessionTest.php +++ b/tests/Session/SessionTest.php @@ -1291,8 +1291,8 @@ public function testInitNonRenewable() /** * Asserts the state of the write mode of the given session * - * @param bool $expected Whether the write mode should be true or false right now - * @param Session $session + * @param bool $expected Whether the write mode should be true or false right now + * @param Session $session * @return void */ protected function assertWriteMode(bool $expected, Session $session) From d41dce7843a2f14546b7a50a98c8584c8e266d3d Mon Sep 17 00:00:00 2001 From: Neil Daniels Date: Fri, 16 Aug 2019 12:27:34 -0700 Subject: [PATCH 004/246] Added intersection() and intersects() methods to Collection --- src/Cms/Collection.php | 27 +++++++++ tests/Cms/Collections/CollectionTest.php | 77 ++++++++++++++++++++++++ 2 files changed, 104 insertions(+) diff --git a/src/Cms/Collection.php b/src/Cms/Collection.php index f072b2d3ef..df9070f806 100644 --- a/src/Cms/Collection.php +++ b/src/Cms/Collection.php @@ -193,6 +193,33 @@ public function indexOf($object): int return array_search($object->id(), $this->keys()); } + /** + * Returns a Collection with the intersection of the given elements + * + * @param Collection + * @return Collection + */ + public function intersection($other) + { + return $other->find($this->keys()); + } + + /** + * Checks if there is an intersection between the given collection and this collection + * + * @param Collection + * @return boolean + */ + public function intersects($other): bool + { + foreach ($this->keys() as $key) { + if ($other->has($key)) { + return true; + } + } + return false; + } + /** * Returns a Collection without the given element(s) * diff --git a/tests/Cms/Collections/CollectionTest.php b/tests/Cms/Collections/CollectionTest.php index 3e116eda8d..a347f2fd3e 100644 --- a/tests/Cms/Collections/CollectionTest.php +++ b/tests/Cms/Collections/CollectionTest.php @@ -189,6 +189,83 @@ public function testNotWithObjects() $this->assertEquals($c, $result->last()); } + public function testIntersection() + { + $collection1 = new Collection([ + $a = new MockObject(['id' => 'a']), + $b = new MockObject(['id' => 'b']), + $c = new MockObject(['id' => 'c']) + ]); + + $collection2 = new Collection([ + $c, + $d = new MockObject(['id' => 'd']), + $b + ]); + + $collection3 = new Collection([ + $d, + $e = new MockObject(['id' => 'e']) + ]); + + // 1 with 2 + $result = $collection1->intersection($collection2); + + $this->assertCount(2, $result); + $this->assertEquals($b, $result->first()); + $this->assertEquals($c, $result->last()); + + // 2 with 1 + $result = $collection2->intersection($collection1); + + $this->assertCount(2, $result); + $this->assertEquals($c, $result->first()); + $this->assertEquals($b, $result->last()); + + // 1 with 3 + $result = $collection1->intersection($collection3); + + $this->assertCount(0, $result); + + // 3 with 2 + $result = $collection3->intersection($collection2); + + $this->assertCount(1, $result); + $this->assertEquals($d, $result->first()); + } + + public function testIntersects() + { + $collection1 = new Collection([ + $a = new MockObject(['id' => 'a']), + $b = new MockObject(['id' => 'b']), + $c = new MockObject(['id' => 'c']) + ]); + + $collection2 = new Collection([ + $c, + $d = new MockObject(['id' => 'd']), + $b + ]); + + $collection3 = new Collection([ + $d, + $e = new MockObject(['id' => 'e']) + ]); + + // 1 with 2 + $this->assertTrue($collection1->intersects($collection2)); + + // 2 with 1 + $this->assertTrue($collection2->intersects($collection1)); + + // 1 with 3 + $this->assertFalse($collection1->intersects($collection3)); + + // 3 with 2 + $this->assertTrue($collection3->intersects($collection2)); + } + public function testNotWithCollection() { $collection = new Collection([ From cdc7555fdbe0e9b6f3c7507156f623c0503e5127 Mon Sep 17 00:00:00 2001 From: Lukas Bestle Date: Sat, 17 Aug 2019 11:58:25 +0200 Subject: [PATCH 005/246] Code style fixes, move to Toolkit\Collection --- src/Cms/Collection.php | 27 --------- src/Toolkit/Collection.php | 28 +++++++++ tests/Cms/Collections/CollectionTest.php | 77 ------------------------ tests/Toolkit/CollectionTest.php | 77 ++++++++++++++++++++++++ 4 files changed, 105 insertions(+), 104 deletions(-) diff --git a/src/Cms/Collection.php b/src/Cms/Collection.php index df9070f806..f072b2d3ef 100644 --- a/src/Cms/Collection.php +++ b/src/Cms/Collection.php @@ -193,33 +193,6 @@ public function indexOf($object): int return array_search($object->id(), $this->keys()); } - /** - * Returns a Collection with the intersection of the given elements - * - * @param Collection - * @return Collection - */ - public function intersection($other) - { - return $other->find($this->keys()); - } - - /** - * Checks if there is an intersection between the given collection and this collection - * - * @param Collection - * @return boolean - */ - public function intersects($other): bool - { - foreach ($this->keys() as $key) { - if ($other->has($key)) { - return true; - } - } - return false; - } - /** * Returns a Collection without the given element(s) * diff --git a/src/Toolkit/Collection.php b/src/Toolkit/Collection.php index 47e37682d4..1d056a6e79 100644 --- a/src/Toolkit/Collection.php +++ b/src/Toolkit/Collection.php @@ -542,6 +542,34 @@ public function groupBy($field, bool $i = true) }); } + /** + * Returns a Collection with the intersection of the given elements + * + * @param Kirby\Toolkit\Collection $other + * @return Kirby\Toolkit\Collection + */ + public function intersection($other) + { + return $other->find($this->keys()); + } + + /** + * Checks if there is an intersection between the given collection and this collection + * + * @param Kirby\Toolkit\Collection $other + * @return boolean + */ + public function intersects($other): bool + { + foreach ($this->keys() as $key) { + if ($other->has($key)) { + return true; + } + } + + return false; + } + /** * Checks if the number of elements is zero * diff --git a/tests/Cms/Collections/CollectionTest.php b/tests/Cms/Collections/CollectionTest.php index a347f2fd3e..3e116eda8d 100644 --- a/tests/Cms/Collections/CollectionTest.php +++ b/tests/Cms/Collections/CollectionTest.php @@ -189,83 +189,6 @@ public function testNotWithObjects() $this->assertEquals($c, $result->last()); } - public function testIntersection() - { - $collection1 = new Collection([ - $a = new MockObject(['id' => 'a']), - $b = new MockObject(['id' => 'b']), - $c = new MockObject(['id' => 'c']) - ]); - - $collection2 = new Collection([ - $c, - $d = new MockObject(['id' => 'd']), - $b - ]); - - $collection3 = new Collection([ - $d, - $e = new MockObject(['id' => 'e']) - ]); - - // 1 with 2 - $result = $collection1->intersection($collection2); - - $this->assertCount(2, $result); - $this->assertEquals($b, $result->first()); - $this->assertEquals($c, $result->last()); - - // 2 with 1 - $result = $collection2->intersection($collection1); - - $this->assertCount(2, $result); - $this->assertEquals($c, $result->first()); - $this->assertEquals($b, $result->last()); - - // 1 with 3 - $result = $collection1->intersection($collection3); - - $this->assertCount(0, $result); - - // 3 with 2 - $result = $collection3->intersection($collection2); - - $this->assertCount(1, $result); - $this->assertEquals($d, $result->first()); - } - - public function testIntersects() - { - $collection1 = new Collection([ - $a = new MockObject(['id' => 'a']), - $b = new MockObject(['id' => 'b']), - $c = new MockObject(['id' => 'c']) - ]); - - $collection2 = new Collection([ - $c, - $d = new MockObject(['id' => 'd']), - $b - ]); - - $collection3 = new Collection([ - $d, - $e = new MockObject(['id' => 'e']) - ]); - - // 1 with 2 - $this->assertTrue($collection1->intersects($collection2)); - - // 2 with 1 - $this->assertTrue($collection2->intersects($collection1)); - - // 1 with 3 - $this->assertFalse($collection1->intersects($collection3)); - - // 3 with 2 - $this->assertTrue($collection3->intersects($collection2)); - } - public function testNotWithCollection() { $collection = new Collection([ diff --git a/tests/Toolkit/CollectionTest.php b/tests/Toolkit/CollectionTest.php index f18c13badb..b0c41e04b8 100644 --- a/tests/Toolkit/CollectionTest.php +++ b/tests/Toolkit/CollectionTest.php @@ -294,6 +294,83 @@ public function testIndexOf() $this->assertEquals(1, $this->collection->indexOf('My second element')); } + public function testIntersection() + { + $collection1 = new Collection([ + 'a' => $a = new StringObject('a'), + 'b' => $b = new StringObject('b'), + 'c' => $c = new StringObject('c') + ]); + + $collection2 = new Collection([ + 'c' => $c, + 'd' => $d = new StringObject('d'), + 'b' => $b + ]); + + $collection3 = new Collection([ + 'd' => $d, + 'e' => $e = new StringObject('e') + ]); + + // 1 with 2 + $result = $collection1->intersection($collection2); + + $this->assertCount(2, $result); + $this->assertEquals($b, $result->first()); + $this->assertEquals($c, $result->last()); + + // 2 with 1 + $result = $collection2->intersection($collection1); + + $this->assertCount(2, $result); + $this->assertEquals($c, $result->first()); + $this->assertEquals($b, $result->last()); + + // 1 with 3 + $result = $collection1->intersection($collection3); + + $this->assertCount(0, $result); + + // 3 with 2 + $result = $collection3->intersection($collection2); + + $this->assertCount(1, $result); + $this->assertEquals($d, $result->first()); + } + + public function testIntersects() + { + $collection1 = new Collection([ + 'a' => $a = new StringObject('a'), + 'b' => $b = new StringObject('b'), + 'c' => $c = new StringObject('c') + ]); + + $collection2 = new Collection([ + 'c' => $c, + 'd' => $d = new StringObject('d'), + 'b' => $b + ]); + + $collection3 = new Collection([ + 'd' => $d, + 'e' => $e = new StringObject('e') + ]); + + // 1 with 2 + $this->assertTrue($collection1->intersects($collection2)); + + // 2 with 1 + $this->assertTrue($collection2->intersects($collection1)); + + // 1 with 3 + $this->assertFalse($collection1->intersects($collection3)); + + // 3 with 2 + $this->assertTrue($collection3->intersects($collection2)); + } + public function testIsEmpty() { $collection = new Collection([ From 2e8404bedcfee13a6fd1f4c997fa6c3fddee61d6 Mon Sep 17 00:00:00 2001 From: Bastian Allgeier Date: Fri, 27 Sep 2019 12:24:25 +0200 Subject: [PATCH 006/246] Fix CS issue in Collection class --- src/Toolkit/Collection.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Toolkit/Collection.php b/src/Toolkit/Collection.php index 1d056a6e79..2ccd33d866 100644 --- a/src/Toolkit/Collection.php +++ b/src/Toolkit/Collection.php @@ -557,7 +557,7 @@ public function intersection($other) * Checks if there is an intersection between the given collection and this collection * * @param Kirby\Toolkit\Collection $other - * @return boolean + * @return bool */ public function intersects($other): bool { From 63e58357d64321648a578b3bf9aff7a80638d49a Mon Sep 17 00:00:00 2001 From: Ahmet Bora Date: Thu, 26 Sep 2019 13:17:44 +0300 Subject: [PATCH 007/246] Fix invalid regex with enhance escape method --- panel/src/helpers/regex.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/panel/src/helpers/regex.js b/panel/src/helpers/regex.js index 98e7fe1a86..768f600f80 100644 --- a/panel/src/helpers/regex.js +++ b/panel/src/helpers/regex.js @@ -1 +1 @@ -RegExp.escape = s => s.replace(/\p[-/\\^$*+?.()|[\]{}]/g, '\\$&'); +RegExp.escape = s => s.replace(/[\p{L}]|[-\/\\^$*+?.()|[\]{}]+/u, '\\$&'); From accc57d68bc2ab47a4ca9513951df45a0b67630e Mon Sep 17 00:00:00 2001 From: Bastian Allgeier Date: Fri, 27 Sep 2019 12:43:34 +0200 Subject: [PATCH 008/246] Add unit test for plus sign handling #2138 --- panel/tests/unit/Helpers/Slug.spec.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/panel/tests/unit/Helpers/Slug.spec.js b/panel/tests/unit/Helpers/Slug.spec.js index ac6a688c81..3bf4aef8bd 100644 --- a/panel/tests/unit/Helpers/Slug.spec.js +++ b/panel/tests/unit/Helpers/Slug.spec.js @@ -50,4 +50,13 @@ describe("Slug Helper", () => { expect(result).toBe("aoess"); }); + it("handles plus signs", () => { + const rules = [ + { "+": "-plus-" } + ]; + + const result = slug("1+1", rules); + expect(result).toBe("1-plus-1"); + }); + }); From ac4b9679eed77f77798c830c02010e01057279dc Mon Sep 17 00:00:00 2001 From: Ahmet Bora Date: Tue, 17 Sep 2019 13:04:45 +0300 Subject: [PATCH 009/246] Fix jump clicking select item on multiselect field --- panel/src/components/Forms/Input/MultiselectInput.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/panel/src/components/Forms/Input/MultiselectInput.vue b/panel/src/components/Forms/Input/MultiselectInput.vue index b0fa36f461..8fb7b47cfe 100644 --- a/panel/src/components/Forms/Input/MultiselectInput.vue +++ b/panel/src/components/Forms/Input/MultiselectInput.vue @@ -50,7 +50,7 @@ 'selected': isSelected(option), 'disabled': !addable }" - @click="select(option)" + @click.prevent="select(option)" @keydown.native.enter.prevent="select(option)" @keydown.native.space.prevent="select(option)" > From 7b86b55d5ec71f4e17be951d70b76a4ee98d4bea Mon Sep 17 00:00:00 2001 From: Ahmet Bora Date: Tue, 24 Sep 2019 18:41:14 +0300 Subject: [PATCH 010/246] Fix jump clicking and focus issue on multiselect --- .../src/components/Forms/Input/MultiselectInput.vue | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/panel/src/components/Forms/Input/MultiselectInput.vue b/panel/src/components/Forms/Input/MultiselectInput.vue index 8fb7b47cfe..d7be0e75ca 100644 --- a/panel/src/components/Forms/Input/MultiselectInput.vue +++ b/panel/src/components/Forms/Input/MultiselectInput.vue @@ -99,7 +99,8 @@ export default { data() { return { state: this.value, - q: null + q: null, + scrollTop: 0 }; }, computed: { @@ -202,12 +203,12 @@ export default { switch (direction) { case "prev": - if (current && current.previousSibling) { + if (current && current.previousSibling && current.previousSibling.focus) { current.previousSibling.focus(); } break; case "next": - if (current && current.nextSibling) { + if (current && current.nextSibling && current.nextSibling.focus) { current.nextSibling.focus(); } break; @@ -221,9 +222,11 @@ export default { }, onOpen() { this.$nextTick(() => { - if (this.$refs.search) { + if (this.$refs.search && this.$refs.search.focus) { this.$refs.search.focus(); } + + this.$refs.dropdown.$el.querySelector('.k-multiselect-options').scrollTop = this.scrollTop }); }, remove(option) { @@ -231,6 +234,7 @@ export default { this.onInput(); }, select(option) { + this.scrollTop = this.$refs.dropdown.$el.querySelector('.k-multiselect-options').scrollTop; option = { text: option.text, value: option.value }; if (this.isSelected(option)) { From 7cd85ed854b51c766f4e9758fdab98498de56e6c Mon Sep 17 00:00:00 2001 From: Ahmet Bora Date: Tue, 24 Sep 2019 22:13:10 +0300 Subject: [PATCH 011/246] Fix code style --- panel/src/components/Forms/Input/MultiselectInput.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/panel/src/components/Forms/Input/MultiselectInput.vue b/panel/src/components/Forms/Input/MultiselectInput.vue index d7be0e75ca..d524af34e2 100644 --- a/panel/src/components/Forms/Input/MultiselectInput.vue +++ b/panel/src/components/Forms/Input/MultiselectInput.vue @@ -226,7 +226,7 @@ export default { this.$refs.search.focus(); } - this.$refs.dropdown.$el.querySelector('.k-multiselect-options').scrollTop = this.scrollTop + this.$refs.dropdown.$el.querySelector('.k-multiselect-options').scrollTop = this.scrollTop; }); }, remove(option) { @@ -235,6 +235,7 @@ export default { }, select(option) { this.scrollTop = this.$refs.dropdown.$el.querySelector('.k-multiselect-options').scrollTop; + option = { text: option.text, value: option.value }; if (this.isSelected(option)) { From 8fbc61a7fb2f1f19b4d98349988205ee78abfb1c Mon Sep 17 00:00:00 2001 From: Bastian Allgeier Date: Thu, 26 Sep 2019 16:03:40 +0200 Subject: [PATCH 012/246] Fix vimeo and youtube helper options #2118 --- config/helpers.php | 4 +-- src/Toolkit/Html.php | 2 +- tests/Cms/Helpers/HelpersTest.php | 44 ++++++++++++++++++++++++++++++- 3 files changed, 46 insertions(+), 4 deletions(-) diff --git a/config/helpers.php b/config/helpers.php index 86bc5effa7..2359053ed7 100755 --- a/config/helpers.php +++ b/config/helpers.php @@ -825,7 +825,7 @@ function video(string $url, array $options = [], array $attr = []): string */ function vimeo(string $url, array $options = [], array $attr = []): string { - return Html::video($url, $options, $attr); + return Html::vimeo($url, $options, $attr); } /** @@ -851,5 +851,5 @@ function widont(string $string = null): string */ function youtube(string $url, array $options = [], array $attr = []): string { - return Html::video($url, $options, $attr); + return Html::youtube($url, $options, $attr); } diff --git a/src/Toolkit/Html.php b/src/Toolkit/Html.php index 8e3c49df70..1411ddecf9 100644 --- a/src/Toolkit/Html.php +++ b/src/Toolkit/Html.php @@ -465,7 +465,7 @@ public static function vimeo(string $url, ?array $options = [], array $attr = [] } // build the options query - if (!empty($options)) { + if (empty($options) === false) { $query = '?' . http_build_query($options); } else { $query = ''; diff --git a/tests/Cms/Helpers/HelpersTest.php b/tests/Cms/Helpers/HelpersTest.php index d2002cd355..64aa888bbd 100644 --- a/tests/Cms/Helpers/HelpersTest.php +++ b/tests/Cms/Helpers/HelpersTest.php @@ -693,14 +693,48 @@ public function testVideo() $this->assertEquals($expected, $video); } + public function testYoutubeVideoWithOptions() + { + $video = video('https://www.youtube.com/watch?v=xB3s_f7PzYk', [ + 'youtube' => [ + 'controls' => 0 + ] + ]); + + $expected = ''; + + $this->assertEquals($expected, $video); + } + + public function testVimeoVideoWithOptions() + { + $video = video('https://vimeo.com/335292911', [ + 'vimeo' => [ + 'controls' => 0 + ] + ]); + + $expected = ''; + + $this->assertEquals($expected, $video); + } + public function testVimeo() { - $video = video('https://vimeo.com/335292911'); + $video = vimeo('https://vimeo.com/335292911'); $expected = ''; $this->assertEquals($expected, $video); } + public function testVimeoWithOptions() + { + $video = vimeo('https://vimeo.com/335292911', ['controls' => 0]); + $expected = ''; + + $this->assertEquals($expected, $video); + } + public function testWidont() { $result = widont('This is a headline'); @@ -716,4 +750,12 @@ public function testYoutube() $this->assertEquals($expected, $video); } + + public function testYoutubeWithOptions() + { + $video = youtube('https://www.youtube.com/watch?v=xB3s_f7PzYk', ['controls' => 0]); + $expected = ''; + + $this->assertEquals($expected, $video); + } } From 6ca3f5454593f51c803f36db09b373301b5f0e5a Mon Sep 17 00:00:00 2001 From: Bastian Allgeier Date: Fri, 27 Sep 2019 11:36:25 +0200 Subject: [PATCH 013/246] Small syntax fix #2118 --- src/Toolkit/Html.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Toolkit/Html.php b/src/Toolkit/Html.php index 1411ddecf9..de0b535a64 100644 --- a/src/Toolkit/Html.php +++ b/src/Toolkit/Html.php @@ -523,7 +523,7 @@ public static function youtube(string $url, ?array $options = [], array $attr = } // build the options query - if (!empty($options)) { + if (empty($options) === false) { $query = '?' . http_build_query($options); } else { $query = ''; From e844135753201eaab3830937f9170c31b70ccc2c Mon Sep 17 00:00:00 2001 From: Bastian Allgeier Date: Fri, 27 Sep 2019 12:12:10 +0200 Subject: [PATCH 014/246] New toggle field preview for structure fields #2126 --- .../components/Forms/Field/StructureField.vue | 5 ++++ .../Forms/Previews/ToggleFieldPreview.vue | 30 +++++++++++++++++++ panel/src/config/components.js | 2 ++ 3 files changed, 37 insertions(+) create mode 100644 panel/src/components/Forms/Previews/ToggleFieldPreview.vue diff --git a/panel/src/components/Forms/Field/StructureField.vue b/panel/src/components/Forms/Field/StructureField.vue index a970353821..1e892df5f3 100644 --- a/panel/src/components/Forms/Field/StructureField.vue +++ b/panel/src/components/Forms/Field/StructureField.vue @@ -99,6 +99,7 @@ :value="item[columnName]" :column="column" :field="fields[columnName]" + @input="update(index, columnName, $event)" />