From 1c5f2f7e3cfc809b9a660e6f279e38eab8ed2120 Mon Sep 17 00:00:00 2001 From: Ryan Cramer Date: Fri, 29 Nov 2024 13:29:28 -0500 Subject: [PATCH] Updates for PHP 8.4 support per processwire/processwire-issues#2000 Also note that these changes require we adjust our minimum required PHP version from 7.0 up to 7.1, with PHP 8.x still recommended. --- wire/core/Database.php | 6 ++--- wire/core/Field.php | 8 +++---- wire/core/Fieldgroups.php | 4 ++-- wire/core/Functions.php | 4 ++-- wire/core/Inputfield.php | 12 +++++----- wire/core/InputfieldWrapper.php | 4 ++-- wire/core/Interfaces.php | 2 +- wire/core/MarkupFieldtype.php | 6 ++--- wire/core/MarkupQA.php | 10 ++++----- wire/core/Modules.php | 8 +++---- wire/core/ModulesConfigs.php | 2 +- wire/core/ModulesLoader.php | 6 ++--- wire/core/Page.php | 12 +++++----- wire/core/PageFinder.php | 7 +++--- wire/core/PageTraversal.php | 20 ++++++++--------- wire/core/Pagefile.php | 8 +++---- wire/core/Pageimage.php | 6 ++--- wire/core/Pages.php | 6 ++--- wire/core/PagesEditor.php | 4 ++-- wire/core/PagesLoaderCache.php | 4 ++-- wire/core/PagesRequest.php | 2 +- wire/core/Permission.php | 6 ++--- wire/core/Role.php | 4 ++-- wire/core/Sanitizer.php | 8 ++++--- wire/core/Session.php | 2 +- wire/core/Tfa.php | 14 ++++++------ wire/core/User.php | 12 +++++----- wire/core/Wire.php | 4 ++-- wire/core/WireHooks.php | 2 +- wire/core/WireSaveableItems.php | 2 +- wire/core/WireSaveableItemsLookup.php | 2 +- .../FieldtypeComments/CommentForm.php | 4 +++- .../FieldtypeComments.module | 4 ++-- .../SelectableOptionManager.php | 2 +- .../FieldtypeRepeater.module | 4 ++-- .../FieldtypeRepeaterVersions.php | 2 +- .../InputfieldRepeater.module | 4 ++-- .../Fieldtype/FieldtypeTextarea.module | 6 ++--- .../InputfieldAsmSelect.module | 4 ++-- .../InputfieldCKEditor.module | 2 +- .../InputfieldDatetime.module | 4 ++-- .../InputfieldFile/InputfieldFile.module | 4 ++-- .../modules/Inputfield/InputfieldFloat.module | 4 ++-- .../InputfieldImage/InputfieldImage.module | 4 ++-- .../Inputfield/InputfieldMarkup.module | 2 +- .../InputfieldPage/InputfieldPage.module | 8 +++---- .../InputfieldPageListSelect.module | 2 +- .../InputfieldPageListSelectMultiple.module | 2 +- .../InputfieldPageTable.module | 2 +- .../InputfieldPageTitle.module | 2 +- .../InputfieldPassword.module | 4 ++-- .../Inputfield/InputfieldSelect.module | 10 ++++----- .../InputfieldSelectMultiple.module | 4 ++-- .../InputfieldSelector.module | 8 +++---- .../InputfieldSubmit/InputfieldSubmit.module | 4 ++-- .../InputfieldText/InputfieldText.module | 4 ++-- .../InputfieldTextTags.module | 6 ++--- .../InputfieldTinyMCE.module.php | 2 +- .../InputfieldToggle/InputfieldToggle.module | 2 +- wire/modules/LanguageSupport/Language.php | 4 ++-- .../LanguageSupportPageNames.module | 8 +++---- wire/modules/LanguageSupport/Languages.php | 5 ++--- wire/modules/Markup/MarkupRSS.module | 6 ++--- wire/modules/PagePaths.module | 22 ++++++++++++++++++- wire/modules/PagePermissions.module | 10 ++++----- .../PagesVersions/PagesVersions.module.php | 2 +- .../ProcessPageAdd/ProcessPageAdd.module | 12 +++++----- wire/modules/Process/ProcessPageClone.module | 4 ++-- .../ProcessPageSearchLive.php | 4 ++-- .../ProcessTemplate/ProcessTemplate.module | 4 ++-- .../parsedown-extra/ParsedownExtra.php | 2 +- .../parsedown/Parsedown.php | 6 ++--- 72 files changed, 208 insertions(+), 188 deletions(-) diff --git a/wire/core/Database.php b/wire/core/Database.php index da451799..430f3513 100644 --- a/wire/core/Database.php +++ b/wire/core/Database.php @@ -80,7 +80,7 @@ class Database extends \mysqli implements WireDatabase { if($config) { if($config->dbCharset) $this->set_charset($config->dbCharset); - else if($config->dbSetNamesUTF8) $this->query("SET NAMES 'utf8'"); + else if($config->get('dbSetNamesUTF8')) $this->query("SET NAMES 'utf8'"); } } @@ -134,12 +134,12 @@ class Database extends \mysqli implements WireDatabase { * * Active in ProcessWire debug mode only * - * @param ProcessWire $wire ProcessWire instance, if omitted returns queries for all instances + * @param ProcessWire|null $wire ProcessWire instance, if omitted returns queries for all instances * @return array * @deprecated * */ - static public function getQueryLog(ProcessWire $wire = null) { + static public function getQueryLog(?ProcessWire $wire = null) { if($wire) { return $wire->database->queryLog(); } else { diff --git a/wire/core/Field.php b/wire/core/Field.php index 40933042..5f8978e6 100644 --- a/wire/core/Field.php +++ b/wire/core/Field.php @@ -879,7 +879,7 @@ class Field extends WireData implements Saveable, Exportable { * @return bool True if viewable, false if not * */ - public function ___viewable(Page $page = null, User $user = null) { + public function ___viewable(?Page $page = null, ?User $user = null) { return $this->wire()->fields->_hasPermission($this, 'view', $page, $user); } @@ -893,12 +893,12 @@ class Field extends WireData implements Saveable, Exportable { * * #pw-group-access * - * @param Page|string|int|null $page Optionally specify a Page for context - * @param User|string|int|null $user Optionally specify a different user (default = current user) + * @param Page|null $page Optionally specify a Page for context + * @param User|null $user Optionally specify a different user (default = current user) * @return bool * */ - public function ___editable(Page $page = null, User $user = null) { + public function ___editable(?Page $page = null, ?User $user = null) { return $this->wire()->fields->_hasPermission($this, 'edit', $page, $user); } diff --git a/wire/core/Fieldgroups.php b/wire/core/Fieldgroups.php index 7a171bed..48e5f0e6 100644 --- a/wire/core/Fieldgroups.php +++ b/wire/core/Fieldgroups.php @@ -593,12 +593,12 @@ class Fieldgroups extends WireSaveableItemsLookup { * #pw-internal * * @param Field $field - * @param Template $template * @param Fieldgroup $fieldgroup + * @param Template|null $template * @return bool|string Returns error message string if not removeable or boolean false if it is removeable * */ - public function isFieldNotRemoveable(Field $field, Fieldgroup $fieldgroup, Template $template = null) { + public function isFieldNotRemoveable(Field $field, Fieldgroup $fieldgroup, ?Template $template = null) { if(is_null($template)) $template = $this->wire()->templates->get($fieldgroup->name); diff --git a/wire/core/Functions.php b/wire/core/Functions.php index 98e4f0ec..a76ab744 100644 --- a/wire/core/Functions.php +++ b/wire/core/Functions.php @@ -37,12 +37,12 @@ function wire($name = 'wire') { * * #pw-group-common * - * @param ProcessWire|Wire|null $wire To set specify ProcessWire instance or any Wire-derived object in it, or omit to get current instance. + * @param Wire|null $wire To set specify ProcessWire instance or any Wire-derived object in it, or omit to get current instance. * @return ProcessWire * @since 3.0.125 * */ -function wireInstance(Wire $wire = null) { +function wireInstance(?Wire $wire = null) { if($wire === null) return ProcessWire::getCurrentInstance(); if(!$wire instanceof ProcessWire) $wire = $wire->wire(); ProcessWire::setCurrentInstance($wire); diff --git a/wire/core/Inputfield.php b/wire/core/Inputfield.php index 1fd1a33a..8e9f4e21 100644 --- a/wire/core/Inputfield.php +++ b/wire/core/Inputfield.php @@ -1370,11 +1370,11 @@ abstract class Inputfield extends WireData implements Module { * * #pw-internal * - * @param array $attributes Associative array of attributes to build the string from, or omit to use this Inputfield's attributes. + * @param array|null $attributes Associative array of attributes to build the string from, or omit to use this Inputfield's attributes. * @return string * */ - public function getAttributesString(array $attributes = null) { + public function getAttributesString(?array $attributes = null) { $str = ''; @@ -1463,12 +1463,12 @@ abstract class Inputfield extends WireData implements Module { * * #pw-group-output * - * @param Inputfield|InputfieldWrapper|null The parent InputfieldWrapper that is rendering it, or null if no parent. + * @param Inputfield|null The parent InputfieldWrapper that is rendering it, or null if no parent. * @param bool $renderValueMode Specify true only if this is for `Inputfield::renderValue()` rather than `Inputfield::render()`. * @return bool True if assets were just added, false if already added. * */ - public function renderReady(Inputfield $parent = null, $renderValueMode = false) { + public function renderReady(?Inputfield $parent = null, $renderValueMode = false) { if($this->className() === 'InputfieldWrapper') { $result = false; } else { @@ -1485,11 +1485,11 @@ abstract class Inputfield extends WireData implements Module { * * Hook this method instead if you want to hook renderReady(). * - * @param Inputfield $parent + * @param Inputfield|null $parent * @param bool $renderValueMode * */ - public function ___renderReadyHook(Inputfield $parent = null, $renderValueMode = false) { } + public function ___renderReadyHook(?Inputfield $parent = null, $renderValueMode = false) { } /** * This hook was replaced by renderReady diff --git a/wire/core/InputfieldWrapper.php b/wire/core/InputfieldWrapper.php index 8e726ede..361ec12d 100644 --- a/wire/core/InputfieldWrapper.php +++ b/wire/core/InputfieldWrapper.php @@ -1973,11 +1973,11 @@ class InputfieldWrapper extends Inputfield implements \Countable, \IteratorAggre * #pw-group-manipulation * * @param array $a Array of Inputfield definitions - * @param InputfieldWrapper $inputfields Specify the wrapper you want them added to, or omit to use current. + * @param InputfieldWrapper|null $inputfields Specify the wrapper you want them added to, or omit to use current. * @return $this * */ - public function importArray(array $a, InputfieldWrapper $inputfields = null) { + public function importArray(array $a, ?InputfieldWrapper $inputfields = null) { $modules = $this->wire()->modules; diff --git a/wire/core/Interfaces.php b/wire/core/Interfaces.php index 326475d9..2589ba6c 100644 --- a/wire/core/Interfaces.php +++ b/wire/core/Interfaces.php @@ -758,7 +758,7 @@ interface InputfieldHasSelectableOptions { * @return self|$this * */ - public function addOption($value, $label = null, array $attributes = null); + public function addOption($value, $label = null, ?array $attributes = null); /** * Add selectable option with label, optionally for specific language diff --git a/wire/core/MarkupFieldtype.php b/wire/core/MarkupFieldtype.php index 85fec0d8..d41ea5e0 100644 --- a/wire/core/MarkupFieldtype.php +++ b/wire/core/MarkupFieldtype.php @@ -74,12 +74,12 @@ class MarkupFieldtype extends WireData implements Module { * If you construct without providing page and field, please populate them * separately with the setPage and setField methods before calling render(). * - * @param Page $page - * @param Field $field + * @param Page|null $page + * @param Field|null $field * @param mixed $value * */ - public function __construct(Page $page = null, Field $field = null, $value = null) { + public function __construct(?Page $page = null, ?Field $field = null, $value = null) { parent::__construct(); if($page) $this->setPage($page); if($field) $this->setField($field); diff --git a/wire/core/MarkupQA.php b/wire/core/MarkupQA.php index 57f8d48b..4a592c07 100644 --- a/wire/core/MarkupQA.php +++ b/wire/core/MarkupQA.php @@ -67,11 +67,11 @@ class MarkupQA extends Wire { /** * Construct * - * @param Page $page - * @param Field $field + * @param Page|null $page + * @param Field|null $field * */ - public function __construct(Page $page = null, Field $field = null) { + public function __construct(?Page $page = null, ?Field $field = null) { parent::__construct(); if($page) { $this->setPage($page); @@ -606,7 +606,7 @@ class MarkupQA extends Wire { /** * Find pages linking to another * - * @param Page $page Page to find links to, or omit to use page specified in constructor + * @param Page|null $page Page to find links to, or omit to use page specified in constructor * @param array $fieldNames Field names to look in or omit to use field specified in constructor * @param string $selector Optional selector to use as a filter * @param array $options Additional options @@ -617,7 +617,7 @@ class MarkupQA extends Wire { * @return PageArray|array|int * */ - public function findLinks(Page $page = null, $fieldNames = array(), $selector = '', array $options = array()) { + public function findLinks(?Page $page = null, $fieldNames = array(), $selector = '', array $options = array()) { $pages = $this->wire()->pages; $fields = $this->wire()->fields; diff --git a/wire/core/Modules.php b/wire/core/Modules.php index 4b96d6c7..cd0cb287 100644 --- a/wire/core/Modules.php +++ b/wire/core/Modules.php @@ -736,8 +736,8 @@ class Modules extends WireArray { * #pw-internal * * @param string|object $moduleName Module instance or module name - * @param User $user Optionally specify different user to consider than current. - * @param Page $page Optionally specify different page to consider than current. + * @param User|null $user Optionally specify different user to consider than current. + * @param Page|null $page Optionally specify different page to consider than current. * @param bool $strict If module specifies no permission settings, assume no permission. * - Default (false) is to assume permission when module doesn't say anything about it. * - Process modules (for instance) generally assume no permission when it isn't specifically defined @@ -746,7 +746,7 @@ class Modules extends WireArray { * @return bool * */ - public function hasPermission($moduleName, User $user = null, Page $page = null, $strict = false) { + public function hasPermission($moduleName, ?User $user = null, ?Page $page = null, $strict = false) { return $this->loader->hasPermission($moduleName, $user, $page, $strict); } @@ -1740,7 +1740,7 @@ class Modules extends WireArray { * @return InputfieldWrapper|null * */ - public function ___getModuleConfigInputfields($moduleName, InputfieldWrapper $form = null) { + public function ___getModuleConfigInputfields($moduleName, ?InputfieldWrapper $form = null) { return $this->configs->getModuleConfigInputfields($moduleName, $form); } diff --git a/wire/core/ModulesConfigs.php b/wire/core/ModulesConfigs.php index 172adfb7..24284aa3 100644 --- a/wire/core/ModulesConfigs.php +++ b/wire/core/ModulesConfigs.php @@ -558,7 +558,7 @@ class ModulesConfigs extends ModulesClass { * @return InputfieldWrapper|null * */ - public function getModuleConfigInputfields($moduleName, InputfieldWrapper $form = null) { + public function getModuleConfigInputfields($moduleName, ?InputfieldWrapper $form = null) { $moduleName = $this->modules->getModuleClass($moduleName); $configurable = $this->isConfigurable($moduleName); diff --git a/wire/core/ModulesLoader.php b/wire/core/ModulesLoader.php index 58a983fe..d5962bed 100644 --- a/wire/core/ModulesLoader.php +++ b/wire/core/ModulesLoader.php @@ -737,8 +737,8 @@ class ModulesLoader extends ModulesClass { * #pw-internal * * @param string|object $moduleName Module instance or module name - * @param User $user Optionally specify different user to consider than current. - * @param Page $page Optionally specify different page to consider than current. + * @param User|null $user Optionally specify different user to consider than current. + * @param Page|null $page Optionally specify different page to consider than current. * @param bool $strict If module specifies no permission settings, assume no permission. * - Default (false) is to assume permission when module doesn't say anything about it. * - Process modules (for instance) generally assume no permission when it isn't specifically defined @@ -747,7 +747,7 @@ class ModulesLoader extends ModulesClass { * @return bool * */ - public function hasPermission($moduleName, User $user = null, Page $page = null, $strict = false) { + public function hasPermission($moduleName, ?User $user = null, ?Page $page = null, $strict = false) { if(is_object($moduleName)) { $module = $moduleName; diff --git a/wire/core/Page.php b/wire/core/Page.php index 933b9f23..7f32237b 100644 --- a/wire/core/Page.php +++ b/wire/core/Page.php @@ -605,10 +605,10 @@ class Page extends WireData implements \Countable, WireMatchable { /** * Create a new page in memory. * - * @param Template $tpl Template object this page should use. + * @param Template|null $tpl Template object this page should use. * */ - public function __construct(Template $tpl = null) { + public function __construct(?Template $tpl = null) { parent::__construct(); if($tpl !== null) { $tpl->wire($this); @@ -2195,7 +2195,7 @@ class Page extends WireData implements \Countable, WireMatchable { * @return Page|NullPage Returns the next sibling page, or a NullPage if none found. * */ - public function next($selector = '', PageArray $siblings = null) { + public function next($selector = '', ?PageArray $siblings = null) { if($selector instanceof PageArray) { $siblings = $selector; $selector = ''; @@ -2252,7 +2252,7 @@ class Page extends WireData implements \Countable, WireMatchable { * @return PageArray * */ - public function nextUntil($selector = '', $filter = '', PageArray $siblings = null) { + public function nextUntil($selector = '', $filter = '', ?PageArray $siblings = null) { if($siblings === null && $this->traversalPages) $siblings = $this->traversalPages; if($siblings) return $this->traversal()->nextUntilSiblings($this, $selector, $filter, $siblings); return $this->traversal()->nextUntil($this, $selector, $filter); @@ -2276,7 +2276,7 @@ class Page extends WireData implements \Countable, WireMatchable { * @return Page|NullPage Returns the previous sibling page, or a NullPage if none found. * */ - public function prev($selector = '', PageArray $siblings = null) { + public function prev($selector = '', ?PageArray $siblings = null) { if($selector instanceof PageArray) { $siblings = $selector; $selector = ''; @@ -2315,7 +2315,7 @@ class Page extends WireData implements \Countable, WireMatchable { * @return PageArray * */ - public function prevUntil($selector = '', $filter = '', PageArray $siblings = null) { + public function prevUntil($selector = '', $filter = '', ?PageArray $siblings = null) { if($siblings === null && $this->traversalPages) $siblings = $this->traversalPages; if($siblings) return $this->traversal()->prevUntilSiblings($this, $selector, $filter, $siblings); return $this->traversal()->prevUntil($this, $selector, $filter); diff --git a/wire/core/PageFinder.php b/wire/core/PageFinder.php index 871d9103..fe50ae61 100644 --- a/wire/core/PageFinder.php +++ b/wire/core/PageFinder.php @@ -3587,10 +3587,11 @@ class PageFinder extends Wire { if(count($fields) > 1) { // OR fields present array_shift($fields); - $subfields = array($subfields); + $subfields = array($subfields); // 1. subfields is definitely an array… foreach($fields as $name) { if(strpos($name, "$fieldName.") === 0) { - list(,$name) = explode('__owner.', $name); + list(,$name) = explode('__owner.', $name); + /** @var array $subfields 2. …but PhpStorm in PHP8 mode can't tell it's an array without this */ $subfields[] = $name; } else { $this->syntaxError( @@ -3662,7 +3663,7 @@ class PageFinder extends Wire { * @return array * */ - public function getPageArrayData(PageArray $pageArray = null) { + public function getPageArrayData(?PageArray $pageArray = null) { if($pageArray !== null && count($this->pageArrayData)) { $pageArray->data($this->pageArrayData); } diff --git a/wire/core/PageTraversal.php b/wire/core/PageTraversal.php index 3b80ebec..615470b2 100644 --- a/wire/core/PageTraversal.php +++ b/wire/core/PageTraversal.php @@ -1147,11 +1147,11 @@ class PageTraversal { * * @param Page $page * @param string|array $selector Optional selector. When specified, will find nearest next sibling that matches. - * @param PageArray $siblings Optional siblings to use instead of the default. May also be specified as first argument when no selector needed. + * @param PageArray|null $siblings Optional siblings to use instead of the default. May also be specified as first argument when no selector needed. * @return Page|NullPage Returns the next sibling page, or a NullPage if none found. * */ - public function nextSibling(Page $page, $selector = '', PageArray $siblings = null) { + public function nextSibling(Page $page, $selector = '', ?PageArray $siblings = null) { if($selector instanceof PageArray) { // backwards compatible to when $siblings was first argument $siblings = $selector; @@ -1191,11 +1191,11 @@ class PageTraversal { * * @param Page $page * @param string|array $selector Optional selector. When specified, will find nearest previous sibling that matches. - * @param PageArray $siblings Optional siblings to use instead of the default. May also be specified as first argument when no selector needed. + * @param PageArray|null $siblings Optional siblings to use instead of the default. May also be specified as first argument when no selector needed. * @return Page|NullPage Returns the previous sibling page, or a NullPage if none found. * */ - public function prevSibling(Page $page, $selector = '', PageArray $siblings = null) { + public function prevSibling(Page $page, $selector = '', ?PageArray $siblings = null) { if($selector instanceof PageArray) { // backwards compatible to when $siblings was first argument $siblings = $selector; @@ -1222,11 +1222,11 @@ class PageTraversal { * * @param Page $page * @param string|array $selector Optional selector. When specified, will filter the found siblings. - * @param PageArray $siblings Optional siblings to use instead of the default. + * @param PageArray|null $siblings Optional siblings to use instead of the default. * @return PageArray Returns all matching pages after this one. * */ - public function nextAllSiblings(Page $page, $selector = '', PageArray $siblings = null) { + public function nextAllSiblings(Page $page, $selector = '', ?PageArray $siblings = null) { if(is_null($siblings)) { $siblings = $page->parent()->children(); @@ -1256,11 +1256,11 @@ class PageTraversal { * * @param Page $page * @param string|array $selector Optional selector. When specified, will filter the found siblings. - * @param PageArray $siblings Optional siblings to use instead of the default. + * @param PageArray|null $siblings Optional siblings to use instead of the default. * @return PageArray * */ - public function prevAllSiblings(Page $page, $selector = '', PageArray $siblings = null) { + public function prevAllSiblings(Page $page, $selector = '', ?PageArray $siblings = null) { if(is_null($siblings)) { $siblings = $page->parent()->children(); @@ -1291,7 +1291,7 @@ class PageTraversal { * @return PageArray * */ - public function nextUntilSiblings(Page $page, $selector = '', $filter = '', PageArray $siblings = null) { + public function nextUntilSiblings(Page $page, $selector = '', $filter = '', ?PageArray $siblings = null) { if(is_null($siblings)) { $siblings = $page->parent()->children(); @@ -1343,7 +1343,7 @@ class PageTraversal { * @return PageArray * */ - public function prevUntilSiblings(Page $page, $selector = '', $filter = '', PageArray $siblings = null) { + public function prevUntilSiblings(Page $page, $selector = '', $filter = '', ?PageArray $siblings = null) { if(is_null($siblings)) { $siblings = $page->parent()->children(); diff --git a/wire/core/Pagefile.php b/wire/core/Pagefile.php index 3be8a306..b7750d17 100644 --- a/wire/core/Pagefile.php +++ b/wire/core/Pagefile.php @@ -421,11 +421,11 @@ class Pagefile extends WireData implements WireArrayItem { * Set a description, optionally parsing JSON language-specific descriptions to separate properties * * @param string|array $value - * @param Page|Language Langage to set it for. Omit to determine automatically. + * @param Language|null Langage to set it for. Omit to determine automatically. * @return $this * */ - protected function setDescription($value, Page $language = null) { + protected function setDescription($value, ?Page $language = null) { $languages = $this->wire()->languages; @@ -1387,12 +1387,12 @@ class Pagefile extends WireData implements WireArrayItem { * #pw-internal * * @param string $name - * @param PagefileExtra $value + * @param PagefileExtra|null $value * @return PagefileExtra[]|PagefileExtra|null * @since 3.0.132 * */ - public function extras($name = null, PagefileExtra $value = null) { + public function extras($name = null, ?PagefileExtra $value = null) { if($name === null) return $this->extras; if($value instanceof PagefileExtra) { $this->extras[$name] = $value; diff --git a/wire/core/Pageimage.php b/wire/core/Pageimage.php index d9f07274..b72fcef7 100644 --- a/wire/core/Pageimage.php +++ b/wire/core/Pageimage.php @@ -154,7 +154,7 @@ class Pageimage extends Pagefile { * $pageimage = new Pageimage($page->images, '/path/to/file.png'); * ~~~~~ * - * @param Pageimages|Pagefiles $pagefiles + * @param Pagefiles $pagefiles * @param string $filename Full path and filename to this pagefile * @throws WireException * @@ -1782,12 +1782,12 @@ class Pageimage extends Pagefile { * #pw-internal * * @param string $name - * @param PagefileExtra $value + * @param PagefileExtra|null $value * @return PagefileExtra[] * @since 3.0.132 * */ - public function extras($name = null, PagefileExtra $value = null) { + public function extras($name = null, ?PagefileExtra $value = null) { if($name) return parent::extras($name, $value); $extras = parent::extras(); $extras['webp'] = $this->webp(); diff --git a/wire/core/Pages.php b/wire/core/Pages.php index 23e30141..264892e6 100644 --- a/wire/core/Pages.php +++ b/wire/core/Pages.php @@ -1044,7 +1044,7 @@ class Pages extends Wire { * @throws WireException|\Exception on fatal error * */ - public function ___clone(Page $page, Page $parent = null, $recursive = true, $options = array()) { + public function ___clone(Page $page, ?Page $parent = null, $recursive = true, $options = array()) { return $this->editor()->_clone($page, $parent, $recursive, $options); } @@ -1686,13 +1686,13 @@ class Pages extends Wire { * * #pw-group-cache * - * @param Page $page Optional Page that initiated the uncacheAll + * @param Page|null $page Optional Page that initiated the uncacheAll * @param array $options Options to modify default behavior: * - `shallow` (bool): By default, this method also calls $page->uncache(). To prevent that call, set this to true. * @return int Number of pages uncached * */ - public function uncacheAll(Page $page = null, array $options = array()) { + public function uncacheAll(?Page $page = null, array $options = array()) { return $this->cacher->uncacheAll($page, $options); } diff --git a/wire/core/PagesEditor.php b/wire/core/PagesEditor.php index d924fc44..c370c09c 100644 --- a/wire/core/PagesEditor.php +++ b/wire/core/PagesEditor.php @@ -1292,7 +1292,7 @@ class PagesEditor extends Wire { * Clone an entire page (including fields, file assets, and optionally children) and return it. * * @param Page $page Page that you want to clone - * @param Page $parent New parent, if different (default=same parent) + * @param Page|null $parent New parent, if different (default=same parent) * @param bool $recursive Clone the children too? (default=true) * @param array|string $options Optional options that can be passed to clone or save * - forceID (int): force a specific ID @@ -1302,7 +1302,7 @@ class PagesEditor extends Wire { * @throws WireException|\Exception on fatal error * */ - public function _clone(Page $page, Page $parent = null, $recursive = true, $options = array()) { + public function _clone(Page $page, ?Page $parent = null, $recursive = true, $options = array()) { $defaults = array( 'forceID' => 0, diff --git a/wire/core/PagesLoaderCache.php b/wire/core/PagesLoaderCache.php index 811efbbf..c19b52bb 100644 --- a/wire/core/PagesLoaderCache.php +++ b/wire/core/PagesLoaderCache.php @@ -161,13 +161,13 @@ class PagesLoaderCache extends Wire { /** * Remove all pages from the cache * - * @param Page $page Optional Page that initiated the uncacheAll + * @param Page|null $page Optional Page that initiated the uncacheAll * @param array $options Additional options to modify behavior: * - `shallow` (bool): By default, this method also calls $page->uncache(). To prevent call to $page->uncache(), set 'shallow' => true. * @return int Number of pages uncached * */ - public function uncacheAll(Page $page = null, array $options = array()) { + public function uncacheAll(?Page $page = null, array $options = array()) { if($page) {} // to ignore unused parameter inspection $user = $this->wire()->user; diff --git a/wire/core/PagesRequest.php b/wire/core/PagesRequest.php index 019237ec..cb47dad5 100644 --- a/wire/core/PagesRequest.php +++ b/wire/core/PagesRequest.php @@ -729,7 +729,7 @@ class PagesRequest extends Wire { * @return string|Page|null Login page object or string w/redirect URL, null if 404 * */ - public function ___getLoginPageOrUrl(Page $page = null) { + public function ___getLoginPageOrUrl(?Page $page = null) { $config = $this->wire()->config; diff --git a/wire/core/Permission.php b/wire/core/Permission.php index 9192d2d7..5c2e1511 100644 --- a/wire/core/Permission.php +++ b/wire/core/Permission.php @@ -47,10 +47,10 @@ class Permission extends Page { /** * Create a new Permission page in memory. * - * @param Template $tpl Template object this page should use. + * @param Template|null $tpl Template object this page should use. * */ - public function __construct(Template $tpl = null) { + public function __construct(?Template $tpl = null) { parent::__construct($tpl); if(!$tpl) $this->template = $this->wire()->templates->get('permission'); $this->_parent_id = $this->wire()->config->permissionsPageID; @@ -145,5 +145,3 @@ class Permission extends Page { return $this->wire()->permissions; } } - - diff --git a/wire/core/Role.php b/wire/core/Role.php index 298b7e7f..23202cd1 100644 --- a/wire/core/Role.php +++ b/wire/core/Role.php @@ -25,10 +25,10 @@ class Role extends Page { /** * Create a new Role page in memory. * - * @param Template $tpl + * @param Template|null $tpl * */ - public function __construct(Template $tpl = null) { + public function __construct(?Template $tpl = null) { parent::__construct($tpl); } diff --git a/wire/core/Sanitizer.php b/wire/core/Sanitizer.php index b3850de8..564fc208 100644 --- a/wire/core/Sanitizer.php +++ b/wire/core/Sanitizer.php @@ -90,7 +90,7 @@ * * #pw-body * - * ProcessWire 3.x, Copyright 2023 by Ryan Cramer + * ProcessWire 3.x, Copyright 2024 by Ryan Cramer * https://processwire.com * * @link https://processwire.com/api/variables/sanitizer/ Offical $sanitizer API variable Documentation @@ -4450,6 +4450,7 @@ class Sanitizer extends Wire { * - `delimiter` (string): Single delimiter to use to identify CSV strings. Overrides the 'delimiters' option when specified (default=null) * - `delimiters` (array): Delimiters to identify CSV strings. First found delimiter will be used, default=array("|", ",") * - `enclosure` (string): Enclosure to use for CSV strings (default=double quote, i.e. `"`) + * - `escape` (string): Escape to use for CSV strings (default=backslash, i.e. "\\") * @return array * @throws WireException if an unknown $sanitizer method is given * @@ -4465,6 +4466,7 @@ class Sanitizer extends Wire { 'delimiter' => null, 'delimiters' => array('|', ','), 'enclosure' => '"', + 'escape' => "\\", 'trim' => true, 'sanitizer' => null, 'keySanitizer' => null, @@ -4503,7 +4505,7 @@ class Sanitizer extends Wire { } } if($hasDelimiter !== null) { - $value = str_getcsv($value, $hasDelimiter, $options['enclosure']); + $value = str_getcsv($value, $hasDelimiter, $options['enclosure'], $options['escape']); } else { $value = array($value); } @@ -5196,7 +5198,7 @@ class Sanitizer extends Wire { * @param string|int|array|float $value * @param int $maxLength Maximum length (default=128) * @param null|int $maxBytes Maximum allowed bytes (used for string types only) - * @return array|bool|float|int|string + * @return array|float|int|string * @since 3.0.125 * @see Sanitizer::minLength() * diff --git a/wire/core/Session.php b/wire/core/Session.php index d1cc7b73..6427e96b 100644 --- a/wire/core/Session.php +++ b/wire/core/Session.php @@ -1706,7 +1706,7 @@ class Session extends Wire implements \IteratorAggregate { * @since 3.0.166 * */ - public function sessionHandler(WireSessionHandler $sessionHandler = null) { + public function sessionHandler(?WireSessionHandler $sessionHandler = null) { if($sessionHandler) $this->sessionHandler = $sessionHandler; return $this->sessionHandler; } diff --git a/wire/core/Tfa.php b/wire/core/Tfa.php index f9276f9d..fc05cdc0 100644 --- a/wire/core/Tfa.php +++ b/wire/core/Tfa.php @@ -484,11 +484,11 @@ class Tfa extends WireData implements Module, ConfigurableModule { /** * Get the TFA module for given user or current session * - * @param User $user Optionally specify user + * @param User|null $user Optionally specify user * @return Tfa|null * */ - public function getModule(User $user = null) { + public function getModule(?User $user = null) { $module = null; $moduleName = $this->sessionGet('type'); @@ -913,13 +913,13 @@ class Tfa extends WireData implements Module, ConfigurableModule { * Modules that support auto-enable must implement this method to return true. Modules * that do not support it can ignore this method, as the default returns false. * - * @param User $user Specify user to also confirm it is supported for given user. + * @param User|null $user Specify user to also confirm it is supported for given user. * Omit to test if the module supports it in general. * @return bool * @since 3.0.160 * */ - public function autoEnableSupported(User $user = null) { + public function autoEnableSupported(?User $user = null) { if($user && $this->className() !== 'Tfa') { // if it doesn't support it without user, then exit now if(!$this->autoEnableSupported()) return false; @@ -1901,7 +1901,7 @@ class RememberTfa extends Wire { * @return string * */ - protected function serverValue($cookieValue, User $user = null) { + protected function serverValue($cookieValue, ?User $user = null) { if($user === null) $user = $this->user; return sha1( $user->id . $user->name . $user->email . @@ -1954,11 +1954,11 @@ class RememberTfa extends Wire { /** * Get fingerprint string * - * @param array $types Fingerprints to use, or omit when creating new + * @param array|null $types Fingerprints to use, or omit when creating new * @return string * */ - public function getFingerprintString(array $types = null) { + public function getFingerprintString(?array $types = null) { if($types === null) $types = $this->fingerprints; return implode(',', $types) . ':' . sha1(implode("\n", $this->getFingerprintArray())); } diff --git a/wire/core/User.php b/wire/core/User.php index 2f8c2884..d470b40e 100644 --- a/wire/core/User.php +++ b/wire/core/User.php @@ -41,10 +41,10 @@ class User extends Page { /** * Create a new User page in memory. * - * @param Template $tpl Template object this page should use. + * @param Template|null $tpl Template object this page should use. * */ - public function __construct(Template $tpl = null) { + public function __construct(?Template $tpl = null) { if(!$tpl) $this->template = $this->wire()->templates->get('user'); $this->_parent_id = $this->wire()->config->usersPageID; parent::__construct($tpl); @@ -234,11 +234,11 @@ class User extends Page { * #pw-group-access * * @param string|Permission - * @param Page $page Optional page to check against + * @param Page|null $page Optional page to check against * @return bool * */ - protected function ___hasPagePermission($name, Page $page = null) { + protected function ___hasPagePermission($name, ?Page $page = null) { if($this->isSuperuser()) return true; $permissions = $this->wire()->permissions; @@ -404,11 +404,11 @@ class User extends Page { * * #pw-group-access * - * @param Page $page Optional page to check against + * @param Page|null $page Optional page to check against * @return PageArray of Permission objects * */ - public function getPermissions(Page $page = null) { + public function getPermissions(?Page $page = null) { // Does not currently include page-add or page-create permissions (runtime). if($this->isSuperuser()) return $this->wire()->permissions->getIterator(); // all permissions $userPermissions = $this->wire()->pages->newPageArray(); diff --git a/wire/core/Wire.php b/wire/core/Wire.php index 51fead7d..01499a4b 100644 --- a/wire/core/Wire.php +++ b/wire/core/Wire.php @@ -626,7 +626,7 @@ abstract class Wire implements WireTranslatable, WireFuelable, WireTrackable { * @deprecated * */ - static public function isHooked($method, Wire $instance = null) { + static public function isHooked($method, ?Wire $instance = null) { /** @var ProcessWire $wire */ $wire = $instance ? $instance->wire() : ProcessWire::getCurrentInstance(); if($instance) return $instance->wire()->hooks->hasHook($instance, $method); @@ -1370,7 +1370,7 @@ abstract class Wire implements WireTranslatable, WireFuelable, WireTrackable { * * #pw-hooker * - * @param \Exception|WireException $e Exception object that was thrown. + * @param \Exception $e Exception object that was thrown. * @param bool|int $severe Whether or not it should be considered severe (default=true). * @param string|array|object|true $text Additional details (optional): * - When provided, it will be sent to `$this->error($text)` if $severe is true, or `$this->warning($text)` if $severe is false. diff --git a/wire/core/WireHooks.php b/wire/core/WireHooks.php index 45e959ff..dfa5a654 100644 --- a/wire/core/WireHooks.php +++ b/wire/core/WireHooks.php @@ -334,7 +334,7 @@ class WireHooks { * @see WireHooks::isMethodHooked(), WireHooks::isPropertyHooked(), WireHooks::hasHook() * */ - public function isHooked($method, Wire $instance = null) { + public function isHooked($method, ?Wire $instance = null) { if($instance) return $this->hasHook($instance, $method); if(strpos($method, ':') !== false) { $hooked = isset($this->hookClassMethodCache[$method]); // fromClass::method() or fromClass::property diff --git a/wire/core/WireSaveableItems.php b/wire/core/WireSaveableItems.php index 6ab4be9f..5b5977c1 100644 --- a/wire/core/WireSaveableItems.php +++ b/wire/core/WireSaveableItems.php @@ -6,7 +6,7 @@ * Wire Data Access Object, provides reusable capability for loading, saving, creating, deleting, * and finding items of descending class-defined types. * - * ProcessWire 3.x, Copyright 2022 by Ryan Cramer + * ProcessWire 3.x, Copyright 2024 by Ryan Cramer * https://processwire.com * * @method WireArray load(WireArray $items, $selectors = null) diff --git a/wire/core/WireSaveableItemsLookup.php b/wire/core/WireSaveableItemsLookup.php index d89781f7..ce0430e3 100644 --- a/wire/core/WireSaveableItemsLookup.php +++ b/wire/core/WireSaveableItemsLookup.php @@ -109,7 +109,7 @@ abstract class WireSaveableItemsLookup extends WireSaveableItems { * @since 3.0.194 * */ - protected function initItem(array &$row, WireArray $items = null) { + protected function initItem(array &$row, ?WireArray $items = null) { $lookupField = $this->getLookupField(); $lookupValue = $row[$lookupField]; diff --git a/wire/modules/Fieldtype/FieldtypeComments/CommentForm.php b/wire/modules/Fieldtype/FieldtypeComments/CommentForm.php index 84f520da..7da88236 100644 --- a/wire/modules/Fieldtype/FieldtypeComments/CommentForm.php +++ b/wire/modules/Fieldtype/FieldtypeComments/CommentForm.php @@ -188,6 +188,8 @@ class CommentForm extends Wire implements CommentFormInterface { * */ public function __construct(Page $page, CommentArray $comments, $options = array()) { + + parent::__construct(); $this->page = $page; $this->comments = $comments; @@ -458,7 +460,7 @@ class CommentForm extends Wire implements CommentFormInterface { * @return string * */ - protected function renderSuccess(Comment $comment = null) { + protected function renderSuccess(?Comment $comment = null) { $pageID = (int) $this->wire('input')->post('page_id'); diff --git a/wire/modules/Fieldtype/FieldtypeComments/FieldtypeComments.module b/wire/modules/Fieldtype/FieldtypeComments/FieldtypeComments.module index fe703fa2..74464d4e 100644 --- a/wire/modules/Fieldtype/FieldtypeComments/FieldtypeComments.module +++ b/wire/modules/Fieldtype/FieldtypeComments/FieldtypeComments.module @@ -2024,7 +2024,7 @@ class FieldtypeComments extends FieldtypeMulti { * @since 3.0.169 * */ - public function getNotifyEmails(Page $page, Field $field, Comment $comment = null) { + public function getNotifyEmails(Page $page, Field $field, ?Comment $comment = null) { if(!$field->get('useNotify')) return array(); @@ -2093,7 +2093,7 @@ class FieldtypeComments extends FieldtypeMulti { * * @param Page $page * @param Field $field - * @param Comment|null $comment + * @param Comment $comment * @param array $emailsData * @return int * @since 3.0.175 diff --git a/wire/modules/Fieldtype/FieldtypeOptions/SelectableOptionManager.php b/wire/modules/Fieldtype/FieldtypeOptions/SelectableOptionManager.php index 241ca6fb..2881921c 100644 --- a/wire/modules/Fieldtype/FieldtypeOptions/SelectableOptionManager.php +++ b/wire/modules/Fieldtype/FieldtypeOptions/SelectableOptionManager.php @@ -782,7 +782,7 @@ class SelectableOptionManager extends Wire { * @param HookEvent|null $event * */ - public function updateLanguages(HookEvent $event = null) { + public function updateLanguages(?HookEvent $event = null) { if(!$this->useLanguages || !$this->wire()->languages) return; diff --git a/wire/modules/Fieldtype/FieldtypeRepeater/FieldtypeRepeater.module b/wire/modules/Fieldtype/FieldtypeRepeater/FieldtypeRepeater.module index d34762bc..fd314c61 100644 --- a/wire/modules/Fieldtype/FieldtypeRepeater/FieldtypeRepeater.module +++ b/wire/modules/Fieldtype/FieldtypeRepeater/FieldtypeRepeater.module @@ -1963,13 +1963,13 @@ class FieldtypeRepeater extends Fieldtype implements ConfigurableModule, Fieldty * - repeaters/for-field-123/for-page-456/repeater-item/something-else/ * * @param Page $page - * @param Field $field Optionally limit to given field or null if not appliable + * @param Field|null $field Optionally limit to given field or null if not appliable * @param bool $recursive Descend to children? * @return int Returns count of pages deleted, or 0 if delete not allowed * @since 3.0.188 * */ - public function deleteRepeaterPage(Page $page, Field $field = null, $recursive = false) { + public function deleteRepeaterPage(Page $page, ?Field $field = null, $recursive = false) { static $level = 0; $numDeleted = 0; diff --git a/wire/modules/Fieldtype/FieldtypeRepeater/FieldtypeRepeaterVersions.php b/wire/modules/Fieldtype/FieldtypeRepeater/FieldtypeRepeaterVersions.php index 8d77a3c0..e02efa49 100644 --- a/wire/modules/Fieldtype/FieldtypeRepeater/FieldtypeRepeaterVersions.php +++ b/wire/modules/Fieldtype/FieldtypeRepeater/FieldtypeRepeaterVersions.php @@ -37,7 +37,7 @@ class FieldtypeRepeaterVersions extends Wire { * @since 3.0.232 * */ - public function hasNestedRepeaterFields($page, Field $field = null, $verify = false) { + public function hasNestedRepeaterFields($page, ?Field $field = null, $verify = false) { $has = false; if($field === null) { diff --git a/wire/modules/Fieldtype/FieldtypeRepeater/InputfieldRepeater.module b/wire/modules/Fieldtype/FieldtypeRepeater/InputfieldRepeater.module index 551a4784..59d94b9e 100644 --- a/wire/modules/Fieldtype/FieldtypeRepeater/InputfieldRepeater.module +++ b/wire/modules/Fieldtype/FieldtypeRepeater/InputfieldRepeater.module @@ -763,12 +763,12 @@ class InputfieldRepeater extends Inputfield implements InputfieldItemList { /** * Called before render() or renderValue() method by InputfieldWrapper, before Inputfield-specific CSS/JS files added * - * @param Inputfield|InputfieldWrapper|null The parent Inputfield/wrapper that is rendering it or null if no parent. + * @param Inputfield|null The parent Inputfield/wrapper that is rendering it or null if no parent. * @param bool $renderValueMode Whether renderValueMode will be used. * @return bool * */ - public function renderReady(Inputfield $parent = null, $renderValueMode = false) { + public function renderReady(?Inputfield $parent = null, $renderValueMode = false) { $user = $this->wire()->user; $modules = $this->wire()->modules; diff --git a/wire/modules/Fieldtype/FieldtypeTextarea.module b/wire/modules/Fieldtype/FieldtypeTextarea.module index 9a107ef5..57c3d060 100644 --- a/wire/modules/Fieldtype/FieldtypeTextarea.module +++ b/wire/modules/Fieldtype/FieldtypeTextarea.module @@ -157,13 +157,13 @@ class FieldtypeTextarea extends FieldtypeText { /** * Get the MarkupQA instance * - * @param Page $page - * @param Field $field + * @param Page|null $page + * @param Field|null $field * @return MarkupQA * @throws WireException If called the first time without page or field arguments * */ - public function markupQA(Page $page = null, Field $field = null) { + public function markupQA(?Page $page = null, ?Field $field = null) { if(is_null($this->markupQA)) { $this->markupQA = $this->wire(new MarkupQA($page, $field)); } else { diff --git a/wire/modules/Inputfield/InputfieldAsmSelect/InputfieldAsmSelect.module b/wire/modules/Inputfield/InputfieldAsmSelect/InputfieldAsmSelect.module index cf57bc8c..d883066e 100644 --- a/wire/modules/Inputfield/InputfieldAsmSelect/InputfieldAsmSelect.module +++ b/wire/modules/Inputfield/InputfieldAsmSelect/InputfieldAsmSelect.module @@ -188,12 +188,12 @@ class InputfieldAsmSelect extends InputfieldSelectMultiple implements Inputfield /** * Called before render() * - * @param Inputfield $parent + * @param Inputfield|null $parent * @param bool $renderValueMode * @return bool * */ - public function renderReady(Inputfield $parent = null, $renderValueMode = false) { + public function renderReady(?Inputfield $parent = null, $renderValueMode = false) { $modules = $this->wire()->modules; $config = $this->wire()->config; diff --git a/wire/modules/Inputfield/InputfieldCKEditor/InputfieldCKEditor.module b/wire/modules/Inputfield/InputfieldCKEditor/InputfieldCKEditor.module index a0cabd5f..2bceb18d 100644 --- a/wire/modules/Inputfield/InputfieldCKEditor/InputfieldCKEditor.module +++ b/wire/modules/Inputfield/InputfieldCKEditor/InputfieldCKEditor.module @@ -311,7 +311,7 @@ class InputfieldCKEditor extends InputfieldTextarea implements ConfigModule { * @return bool * */ - public function renderReady(Inputfield $parent = null, $renderValueMode = false) { + public function renderReady(?Inputfield $parent = null, $renderValueMode = false) { static $loaded = false; diff --git a/wire/modules/Inputfield/InputfieldDatetime/InputfieldDatetime.module b/wire/modules/Inputfield/InputfieldDatetime/InputfieldDatetime.module index 49a9fa5a..d5ac0aa9 100644 --- a/wire/modules/Inputfield/InputfieldDatetime/InputfieldDatetime.module +++ b/wire/modules/Inputfield/InputfieldDatetime/InputfieldDatetime.module @@ -272,12 +272,12 @@ class InputfieldDatetime extends Inputfield { * We are overriding it here and checking for a datepicker, so that we can make sure * jQuery UI is loaded before the InputfieldDatetime.js * - * @param Inputfield $parent + * @param Inputfield|null $parent * @param bool $renderValueMode * @return bool * */ - public function renderReady(Inputfield $parent = null, $renderValueMode = false) { + public function renderReady(?Inputfield $parent = null, $renderValueMode = false) { $this->addClass("InputfieldNoFocus", 'wrapClass'); $this->getInputType()->renderReady(); return parent::renderReady($parent, $renderValueMode); diff --git a/wire/modules/Inputfield/InputfieldFile/InputfieldFile.module b/wire/modules/Inputfield/InputfieldFile/InputfieldFile.module index 5ca6cb46..8e38aa2a 100644 --- a/wire/modules/Inputfield/InputfieldFile/InputfieldFile.module +++ b/wire/modules/Inputfield/InputfieldFile/InputfieldFile.module @@ -763,7 +763,7 @@ class InputfieldFile extends Inputfield implements InputfieldItemList, Inputfiel * @return bool * */ - public function renderReady(Inputfield $parent = null, $renderValueMode = false) { + public function renderReady(?Inputfield $parent = null, $renderValueMode = false) { $config = $this->wire()->config; @@ -1468,7 +1468,7 @@ class InputfieldFile extends Inputfield implements InputfieldItemList, Inputfiel * @since 3.0.142 * */ - public function getItemInputfields(Pagefile $item = null) { + public function getItemInputfields(?Pagefile $item = null) { /** @var Pagefiles $pagefiles */ $value = $this->val(); diff --git a/wire/modules/Inputfield/InputfieldFloat.module b/wire/modules/Inputfield/InputfieldFloat.module index cb40aeeb..b2d16d97 100644 --- a/wire/modules/Inputfield/InputfieldFloat.module +++ b/wire/modules/Inputfield/InputfieldFloat.module @@ -125,11 +125,11 @@ class InputfieldFloat extends InputfieldInteger { /** * Override method from Inputfield to convert locale specific decimals for input[type=number] * - * @param array $attributes + * @param array|null $attributes * @return string * */ - public function getAttributesString(array $attributes = null) { + public function getAttributesString(?array $attributes = null) { if(is_null($attributes)) $attributes = $this->getAttributes(); if($attributes['type'] === 'number') { $value = isset($attributes['value']) ? $attributes['value'] : null; diff --git a/wire/modules/Inputfield/InputfieldImage/InputfieldImage.module b/wire/modules/Inputfield/InputfieldImage/InputfieldImage.module index e38d350a..ed1bc74c 100755 --- a/wire/modules/Inputfield/InputfieldImage/InputfieldImage.module +++ b/wire/modules/Inputfield/InputfieldImage/InputfieldImage.module @@ -175,12 +175,12 @@ class InputfieldImage extends InputfieldFile implements InputfieldItemList, Inpu /** * Called right before Inputfield render * - * @param Inputfield $parent Parent Inputfield + * @param Inputfield|null $parent Parent Inputfield * @param bool $renderValueMode Whether or not we are in renderValue mode * @return bool * */ - public function renderReady(Inputfield $parent = null, $renderValueMode = false) { + public function renderReady(?Inputfield $parent = null, $renderValueMode = false) { if(self::debugRenderValue) { // force render value mode for dev/debugging purposes diff --git a/wire/modules/Inputfield/InputfieldMarkup.module b/wire/modules/Inputfield/InputfieldMarkup.module index 6305a2bd..90975f55 100644 --- a/wire/modules/Inputfield/InputfieldMarkup.module +++ b/wire/modules/Inputfield/InputfieldMarkup.module @@ -57,7 +57,7 @@ class InputfieldMarkup extends InputfieldWrapper { * @return bool * */ - public function renderReady(Inputfield $parent = null, $renderValueMode = false) { + public function renderReady(?Inputfield $parent = null, $renderValueMode = false) { $label = $this->getSetting('label'); if(!strlen($label) && $this->skipLabel == Inputfield::skipLabelBlank) { diff --git a/wire/modules/Inputfield/InputfieldPage/InputfieldPage.module b/wire/modules/Inputfield/InputfieldPage/InputfieldPage.module index bbec9cd0..5b8cb2f8 100644 --- a/wire/modules/Inputfield/InputfieldPage/InputfieldPage.module +++ b/wire/modules/Inputfield/InputfieldPage/InputfieldPage.module @@ -224,12 +224,12 @@ class InputfieldPage extends Inputfield implements ConfigurableModule { * * @param Page $page * @param Field|InputfieldPage|string|int $field Field instance of field name (string) or ID - * @param Page $editPage Page being edited + * @param Page|null $editPage Page being edited * @return bool * @throws WireException * */ - public static function isValidPage(Page $page, $field, Page $editPage = null) { + public static function isValidPage(Page $page, $field, ?Page $editPage = null) { $pages = $page->wire()->pages; $user = $page->wire()->user; @@ -804,12 +804,12 @@ class InputfieldPage extends Inputfield implements ConfigurableModule { /** * Called before render() * - * @param Inputfield $parent + * @param Inputfield|null $parent * @param bool $renderValueMode * @return bool * */ - public function renderReady(Inputfield $parent = null, $renderValueMode = false) { + public function renderReady(?Inputfield $parent = null, $renderValueMode = false) { $this->renderValueMode = $renderValueMode; parent::renderReady($parent, $renderValueMode); diff --git a/wire/modules/Inputfield/InputfieldPageListSelect/InputfieldPageListSelect.module b/wire/modules/Inputfield/InputfieldPageListSelect/InputfieldPageListSelect.module index 594ab7a4..c107638c 100644 --- a/wire/modules/Inputfield/InputfieldPageListSelect/InputfieldPageListSelect.module +++ b/wire/modules/Inputfield/InputfieldPageListSelect/InputfieldPageListSelect.module @@ -43,7 +43,7 @@ class InputfieldPageListSelect extends Inputfield implements InputfieldPageListS parent::init(); } - public function renderReady(Inputfield $parent = null, $renderValueMode = false) { + public function renderReady(?Inputfield $parent = null, $renderValueMode = false) { $this->pageListReady($this->attr('name'), $this->labelFieldName); return parent::renderReady($parent, $renderValueMode); } diff --git a/wire/modules/Inputfield/InputfieldPageListSelect/InputfieldPageListSelectMultiple.module b/wire/modules/Inputfield/InputfieldPageListSelect/InputfieldPageListSelectMultiple.module index a986cb7b..2b9881b6 100644 --- a/wire/modules/Inputfield/InputfieldPageListSelect/InputfieldPageListSelectMultiple.module +++ b/wire/modules/Inputfield/InputfieldPageListSelect/InputfieldPageListSelectMultiple.module @@ -75,7 +75,7 @@ class InputfieldPageListSelectMultiple extends Inputfield return $out; } - public function renderReady(Inputfield $parent = null, $renderValueMode = false) { + public function renderReady(?Inputfield $parent = null, $renderValueMode = false) { $this->pageListReady($this->attr('name'), $this->labelFieldName); return parent::renderReady($parent, $renderValueMode); } diff --git a/wire/modules/Inputfield/InputfieldPageTable/InputfieldPageTable.module b/wire/modules/Inputfield/InputfieldPageTable/InputfieldPageTable.module index c8fd65b9..335048c4 100644 --- a/wire/modules/Inputfield/InputfieldPageTable/InputfieldPageTable.module +++ b/wire/modules/Inputfield/InputfieldPageTable/InputfieldPageTable.module @@ -108,7 +108,7 @@ class InputfieldPageTable extends Inputfield { parent::init(); } - public function renderReady(Inputfield $parent = null, $renderValueMode = false) { + public function renderReady(?Inputfield $parent = null, $renderValueMode = false) { $this->addClass('InputfieldNoFocus', 'wrapClass'); $jQueryUI = $this->wire()->modules->get('JqueryUI'); /** @var JqueryUI $jQueryUI */ $jQueryUI->use('modal'); diff --git a/wire/modules/Inputfield/InputfieldPageTitle/InputfieldPageTitle.module b/wire/modules/Inputfield/InputfieldPageTitle/InputfieldPageTitle.module index 7194ff5b..9d005c84 100644 --- a/wire/modules/Inputfield/InputfieldPageTitle/InputfieldPageTitle.module +++ b/wire/modules/Inputfield/InputfieldPageTitle/InputfieldPageTitle.module @@ -41,7 +41,7 @@ class InputfieldPageTitle extends InputfieldText { )); } - public function renderReady(Inputfield $parent = null, $renderValueMode = false) { + public function renderReady(?Inputfield $parent = null, $renderValueMode = false) { if($this->nameField) $this->setupCustom(); return parent::renderReady($parent, $renderValueMode); } diff --git a/wire/modules/Inputfield/InputfieldPassword/InputfieldPassword.module b/wire/modules/Inputfield/InputfieldPassword/InputfieldPassword.module index 92f16430..fcfb62be 100644 --- a/wire/modules/Inputfield/InputfieldPassword/InputfieldPassword.module +++ b/wire/modules/Inputfield/InputfieldPassword/InputfieldPassword.module @@ -146,13 +146,13 @@ class InputfieldPassword extends InputfieldText { /** * Called before render * - * @param Inputfield $parent + * @param Inputfield|null $parent * @param bool $renderValueMode * @return bool * @throws WireException * */ - public function renderReady(Inputfield $parent = null, $renderValueMode = false) { + public function renderReady(?Inputfield $parent = null, $renderValueMode = false) { if($this->label == 'Set Password') $this->label = $this->defaultLabel; $config = $this->wire()->config; $url = $config->urls('InputfieldPassword') . 'complexify/'; diff --git a/wire/modules/Inputfield/InputfieldSelect.module b/wire/modules/Inputfield/InputfieldSelect.module index d8d7ad5c..691e70d6 100644 --- a/wire/modules/Inputfield/InputfieldSelect.module +++ b/wire/modules/Inputfield/InputfieldSelect.module @@ -82,11 +82,11 @@ class InputfieldSelect extends Inputfield implements InputfieldHasSelectableOpti * * @param string $value Value that the option submits (or label of optgroup, if specifying an optgroup) * @param string $label|array Optional label associated with the value (if null, value will be used as the label), or array of optgroup options [value=>label] - * @param array $attributes Optional attributes to be associated with this option (i.e. a 'selected' attribute for an