1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-12 17:54:44 +02:00

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.

This commit is contained in:
Ryan Cramer
2024-11-29 13:29:28 -05:00
parent ac4dfebfab
commit 1c5f2f7e3c
72 changed files with 208 additions and 188 deletions

View File

@@ -80,7 +80,7 @@ class Database extends \mysqli implements WireDatabase {
if($config) { if($config) {
if($config->dbCharset) $this->set_charset($config->dbCharset); 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 * 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 * @return array
* @deprecated * @deprecated
* *
*/ */
static public function getQueryLog(ProcessWire $wire = null) { static public function getQueryLog(?ProcessWire $wire = null) {
if($wire) { if($wire) {
return $wire->database->queryLog(); return $wire->database->queryLog();
} else { } else {

View File

@@ -879,7 +879,7 @@ class Field extends WireData implements Saveable, Exportable {
* @return bool True if viewable, false if not * @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); return $this->wire()->fields->_hasPermission($this, 'view', $page, $user);
} }
@@ -893,12 +893,12 @@ class Field extends WireData implements Saveable, Exportable {
* *
* #pw-group-access * #pw-group-access
* *
* @param Page|string|int|null $page Optionally specify a Page for context * @param Page|null $page Optionally specify a Page for context
* @param User|string|int|null $user Optionally specify a different user (default = current user) * @param User|null $user Optionally specify a different user (default = current user)
* @return bool * @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); return $this->wire()->fields->_hasPermission($this, 'edit', $page, $user);
} }

View File

@@ -593,12 +593,12 @@ class Fieldgroups extends WireSaveableItemsLookup {
* #pw-internal * #pw-internal
* *
* @param Field $field * @param Field $field
* @param Template $template
* @param Fieldgroup $fieldgroup * @param Fieldgroup $fieldgroup
* @param Template|null $template
* @return bool|string Returns error message string if not removeable or boolean false if it is removeable * @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); if(is_null($template)) $template = $this->wire()->templates->get($fieldgroup->name);

View File

@@ -37,12 +37,12 @@ function wire($name = 'wire') {
* *
* #pw-group-common * #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 * @return ProcessWire
* @since 3.0.125 * @since 3.0.125
* *
*/ */
function wireInstance(Wire $wire = null) { function wireInstance(?Wire $wire = null) {
if($wire === null) return ProcessWire::getCurrentInstance(); if($wire === null) return ProcessWire::getCurrentInstance();
if(!$wire instanceof ProcessWire) $wire = $wire->wire(); if(!$wire instanceof ProcessWire) $wire = $wire->wire();
ProcessWire::setCurrentInstance($wire); ProcessWire::setCurrentInstance($wire);

View File

@@ -1370,11 +1370,11 @@ abstract class Inputfield extends WireData implements Module {
* *
* #pw-internal * #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 * @return string
* *
*/ */
public function getAttributesString(array $attributes = null) { public function getAttributesString(?array $attributes = null) {
$str = ''; $str = '';
@@ -1463,12 +1463,12 @@ abstract class Inputfield extends WireData implements Module {
* *
* #pw-group-output * #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()`. * @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. * @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') { if($this->className() === 'InputfieldWrapper') {
$result = false; $result = false;
} else { } else {
@@ -1485,11 +1485,11 @@ abstract class Inputfield extends WireData implements Module {
* *
* Hook this method instead if you want to hook renderReady(). * Hook this method instead if you want to hook renderReady().
* *
* @param Inputfield $parent * @param Inputfield|null $parent
* @param bool $renderValueMode * @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 * This hook was replaced by renderReady

View File

@@ -1973,11 +1973,11 @@ class InputfieldWrapper extends Inputfield implements \Countable, \IteratorAggre
* #pw-group-manipulation * #pw-group-manipulation
* *
* @param array $a Array of Inputfield definitions * @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 * @return $this
* *
*/ */
public function importArray(array $a, InputfieldWrapper $inputfields = null) { public function importArray(array $a, ?InputfieldWrapper $inputfields = null) {
$modules = $this->wire()->modules; $modules = $this->wire()->modules;

View File

@@ -758,7 +758,7 @@ interface InputfieldHasSelectableOptions {
* @return self|$this * @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 * Add selectable option with label, optionally for specific language

View File

@@ -74,12 +74,12 @@ class MarkupFieldtype extends WireData implements Module {
* If you construct without providing page and field, please populate them * If you construct without providing page and field, please populate them
* separately with the setPage and setField methods before calling render(). * separately with the setPage and setField methods before calling render().
* *
* @param Page $page * @param Page|null $page
* @param Field $field * @param Field|null $field
* @param mixed $value * @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(); parent::__construct();
if($page) $this->setPage($page); if($page) $this->setPage($page);
if($field) $this->setField($field); if($field) $this->setField($field);

View File

@@ -67,11 +67,11 @@ class MarkupQA extends Wire {
/** /**
* Construct * Construct
* *
* @param Page $page * @param Page|null $page
* @param Field $field * @param Field|null $field
* *
*/ */
public function __construct(Page $page = null, Field $field = null) { public function __construct(?Page $page = null, ?Field $field = null) {
parent::__construct(); parent::__construct();
if($page) { if($page) {
$this->setPage($page); $this->setPage($page);
@@ -606,7 +606,7 @@ class MarkupQA extends Wire {
/** /**
* Find pages linking to another * 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 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 string $selector Optional selector to use as a filter
* @param array $options Additional options * @param array $options Additional options
@@ -617,7 +617,7 @@ class MarkupQA extends Wire {
* @return PageArray|array|int * @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; $pages = $this->wire()->pages;
$fields = $this->wire()->fields; $fields = $this->wire()->fields;

View File

@@ -736,8 +736,8 @@ class Modules extends WireArray {
* #pw-internal * #pw-internal
* *
* @param string|object $moduleName Module instance or module name * @param string|object $moduleName Module instance or module name
* @param User $user Optionally specify different user to consider than current. * @param User|null $user Optionally specify different user to consider than current.
* @param Page $page Optionally specify different page 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. * @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. * - 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 * - Process modules (for instance) generally assume no permission when it isn't specifically defined
@@ -746,7 +746,7 @@ class Modules extends WireArray {
* @return bool * @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); return $this->loader->hasPermission($moduleName, $user, $page, $strict);
} }
@@ -1740,7 +1740,7 @@ class Modules extends WireArray {
* @return InputfieldWrapper|null * @return InputfieldWrapper|null
* *
*/ */
public function ___getModuleConfigInputfields($moduleName, InputfieldWrapper $form = null) { public function ___getModuleConfigInputfields($moduleName, ?InputfieldWrapper $form = null) {
return $this->configs->getModuleConfigInputfields($moduleName, $form); return $this->configs->getModuleConfigInputfields($moduleName, $form);
} }

View File

@@ -558,7 +558,7 @@ class ModulesConfigs extends ModulesClass {
* @return InputfieldWrapper|null * @return InputfieldWrapper|null
* *
*/ */
public function getModuleConfigInputfields($moduleName, InputfieldWrapper $form = null) { public function getModuleConfigInputfields($moduleName, ?InputfieldWrapper $form = null) {
$moduleName = $this->modules->getModuleClass($moduleName); $moduleName = $this->modules->getModuleClass($moduleName);
$configurable = $this->isConfigurable($moduleName); $configurable = $this->isConfigurable($moduleName);

View File

@@ -737,8 +737,8 @@ class ModulesLoader extends ModulesClass {
* #pw-internal * #pw-internal
* *
* @param string|object $moduleName Module instance or module name * @param string|object $moduleName Module instance or module name
* @param User $user Optionally specify different user to consider than current. * @param User|null $user Optionally specify different user to consider than current.
* @param Page $page Optionally specify different page 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. * @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. * - 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 * - Process modules (for instance) generally assume no permission when it isn't specifically defined
@@ -747,7 +747,7 @@ class ModulesLoader extends ModulesClass {
* @return bool * @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)) { if(is_object($moduleName)) {
$module = $moduleName; $module = $moduleName;

View File

@@ -605,10 +605,10 @@ class Page extends WireData implements \Countable, WireMatchable {
/** /**
* Create a new page in memory. * 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(); parent::__construct();
if($tpl !== null) { if($tpl !== null) {
$tpl->wire($this); $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. * @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) { if($selector instanceof PageArray) {
$siblings = $selector; $siblings = $selector;
$selector = ''; $selector = '';
@@ -2252,7 +2252,7 @@ class Page extends WireData implements \Countable, WireMatchable {
* @return PageArray * @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 === null && $this->traversalPages) $siblings = $this->traversalPages;
if($siblings) return $this->traversal()->nextUntilSiblings($this, $selector, $filter, $siblings); if($siblings) return $this->traversal()->nextUntilSiblings($this, $selector, $filter, $siblings);
return $this->traversal()->nextUntil($this, $selector, $filter); 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. * @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) { if($selector instanceof PageArray) {
$siblings = $selector; $siblings = $selector;
$selector = ''; $selector = '';
@@ -2315,7 +2315,7 @@ class Page extends WireData implements \Countable, WireMatchable {
* @return PageArray * @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 === null && $this->traversalPages) $siblings = $this->traversalPages;
if($siblings) return $this->traversal()->prevUntilSiblings($this, $selector, $filter, $siblings); if($siblings) return $this->traversal()->prevUntilSiblings($this, $selector, $filter, $siblings);
return $this->traversal()->prevUntil($this, $selector, $filter); return $this->traversal()->prevUntil($this, $selector, $filter);

View File

@@ -3587,10 +3587,11 @@ class PageFinder extends Wire {
if(count($fields) > 1) { if(count($fields) > 1) {
// OR fields present // OR fields present
array_shift($fields); array_shift($fields);
$subfields = array($subfields); $subfields = array($subfields); // 1. subfields is definitely an array…
foreach($fields as $name) { foreach($fields as $name) {
if(strpos($name, "$fieldName.") === 0) { 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; $subfields[] = $name;
} else { } else {
$this->syntaxError( $this->syntaxError(
@@ -3662,7 +3663,7 @@ class PageFinder extends Wire {
* @return array * @return array
* *
*/ */
public function getPageArrayData(PageArray $pageArray = null) { public function getPageArrayData(?PageArray $pageArray = null) {
if($pageArray !== null && count($this->pageArrayData)) { if($pageArray !== null && count($this->pageArrayData)) {
$pageArray->data($this->pageArrayData); $pageArray->data($this->pageArrayData);
} }

View File

@@ -1147,11 +1147,11 @@ class PageTraversal {
* *
* @param Page $page * @param Page $page
* @param string|array $selector Optional selector. When specified, will find nearest next sibling that matches. * @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. * @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) { if($selector instanceof PageArray) {
// backwards compatible to when $siblings was first argument // backwards compatible to when $siblings was first argument
$siblings = $selector; $siblings = $selector;
@@ -1191,11 +1191,11 @@ class PageTraversal {
* *
* @param Page $page * @param Page $page
* @param string|array $selector Optional selector. When specified, will find nearest previous sibling that matches. * @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. * @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) { if($selector instanceof PageArray) {
// backwards compatible to when $siblings was first argument // backwards compatible to when $siblings was first argument
$siblings = $selector; $siblings = $selector;
@@ -1222,11 +1222,11 @@ class PageTraversal {
* *
* @param Page $page * @param Page $page
* @param string|array $selector Optional selector. When specified, will filter the found siblings. * @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. * @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)) { if(is_null($siblings)) {
$siblings = $page->parent()->children(); $siblings = $page->parent()->children();
@@ -1256,11 +1256,11 @@ class PageTraversal {
* *
* @param Page $page * @param Page $page
* @param string|array $selector Optional selector. When specified, will filter the found siblings. * @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 * @return PageArray
* *
*/ */
public function prevAllSiblings(Page $page, $selector = '', PageArray $siblings = null) { public function prevAllSiblings(Page $page, $selector = '', ?PageArray $siblings = null) {
if(is_null($siblings)) { if(is_null($siblings)) {
$siblings = $page->parent()->children(); $siblings = $page->parent()->children();
@@ -1291,7 +1291,7 @@ class PageTraversal {
* @return PageArray * @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)) { if(is_null($siblings)) {
$siblings = $page->parent()->children(); $siblings = $page->parent()->children();
@@ -1343,7 +1343,7 @@ class PageTraversal {
* @return PageArray * @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)) { if(is_null($siblings)) {
$siblings = $page->parent()->children(); $siblings = $page->parent()->children();

View File

@@ -421,11 +421,11 @@ class Pagefile extends WireData implements WireArrayItem {
* Set a description, optionally parsing JSON language-specific descriptions to separate properties * Set a description, optionally parsing JSON language-specific descriptions to separate properties
* *
* @param string|array $value * @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 * @return $this
* *
*/ */
protected function setDescription($value, Page $language = null) { protected function setDescription($value, ?Page $language = null) {
$languages = $this->wire()->languages; $languages = $this->wire()->languages;
@@ -1387,12 +1387,12 @@ class Pagefile extends WireData implements WireArrayItem {
* #pw-internal * #pw-internal
* *
* @param string $name * @param string $name
* @param PagefileExtra $value * @param PagefileExtra|null $value
* @return PagefileExtra[]|PagefileExtra|null * @return PagefileExtra[]|PagefileExtra|null
* @since 3.0.132 * @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($name === null) return $this->extras;
if($value instanceof PagefileExtra) { if($value instanceof PagefileExtra) {
$this->extras[$name] = $value; $this->extras[$name] = $value;

View File

@@ -154,7 +154,7 @@ class Pageimage extends Pagefile {
* $pageimage = new Pageimage($page->images, '/path/to/file.png'); * $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 * @param string $filename Full path and filename to this pagefile
* @throws WireException * @throws WireException
* *
@@ -1782,12 +1782,12 @@ class Pageimage extends Pagefile {
* #pw-internal * #pw-internal
* *
* @param string $name * @param string $name
* @param PagefileExtra $value * @param PagefileExtra|null $value
* @return PagefileExtra[] * @return PagefileExtra[]
* @since 3.0.132 * @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); if($name) return parent::extras($name, $value);
$extras = parent::extras(); $extras = parent::extras();
$extras['webp'] = $this->webp(); $extras['webp'] = $this->webp();

View File

@@ -1044,7 +1044,7 @@ class Pages extends Wire {
* @throws WireException|\Exception on fatal error * @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); return $this->editor()->_clone($page, $parent, $recursive, $options);
} }
@@ -1686,13 +1686,13 @@ class Pages extends Wire {
* *
* #pw-group-cache * #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: * @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. * - `shallow` (bool): By default, this method also calls $page->uncache(). To prevent that call, set this to true.
* @return int Number of pages uncached * @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); return $this->cacher->uncacheAll($page, $options);
} }

View File

@@ -1292,7 +1292,7 @@ class PagesEditor extends Wire {
* Clone an entire page (including fields, file assets, and optionally children) and return it. * 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 $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 bool $recursive Clone the children too? (default=true)
* @param array|string $options Optional options that can be passed to clone or save * @param array|string $options Optional options that can be passed to clone or save
* - forceID (int): force a specific ID * - forceID (int): force a specific ID
@@ -1302,7 +1302,7 @@ class PagesEditor extends Wire {
* @throws WireException|\Exception on fatal error * @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( $defaults = array(
'forceID' => 0, 'forceID' => 0,

View File

@@ -161,13 +161,13 @@ class PagesLoaderCache extends Wire {
/** /**
* Remove all pages from the cache * 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: * @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. * - `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 * @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 if($page) {} // to ignore unused parameter inspection
$user = $this->wire()->user; $user = $this->wire()->user;

View File

@@ -729,7 +729,7 @@ class PagesRequest extends Wire {
* @return string|Page|null Login page object or string w/redirect URL, null if 404 * @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; $config = $this->wire()->config;

View File

@@ -47,10 +47,10 @@ class Permission extends Page {
/** /**
* Create a new Permission page in memory. * 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); parent::__construct($tpl);
if(!$tpl) $this->template = $this->wire()->templates->get('permission'); if(!$tpl) $this->template = $this->wire()->templates->get('permission');
$this->_parent_id = $this->wire()->config->permissionsPageID; $this->_parent_id = $this->wire()->config->permissionsPageID;
@@ -145,5 +145,3 @@ class Permission extends Page {
return $this->wire()->permissions; return $this->wire()->permissions;
} }
} }

View File

@@ -25,10 +25,10 @@ class Role extends Page {
/** /**
* Create a new Role page in memory. * 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); parent::__construct($tpl);
} }

View File

@@ -90,7 +90,7 @@
* *
* #pw-body * #pw-body
* *
* ProcessWire 3.x, Copyright 2023 by Ryan Cramer * ProcessWire 3.x, Copyright 2024 by Ryan Cramer
* https://processwire.com * https://processwire.com
* *
* @link https://processwire.com/api/variables/sanitizer/ Offical $sanitizer API variable Documentation * @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) * - `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("|", ",") * - `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. `"`) * - `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 * @return array
* @throws WireException if an unknown $sanitizer method is given * @throws WireException if an unknown $sanitizer method is given
* *
@@ -4465,6 +4466,7 @@ class Sanitizer extends Wire {
'delimiter' => null, 'delimiter' => null,
'delimiters' => array('|', ','), 'delimiters' => array('|', ','),
'enclosure' => '"', 'enclosure' => '"',
'escape' => "\\",
'trim' => true, 'trim' => true,
'sanitizer' => null, 'sanitizer' => null,
'keySanitizer' => null, 'keySanitizer' => null,
@@ -4503,7 +4505,7 @@ class Sanitizer extends Wire {
} }
} }
if($hasDelimiter !== null) { if($hasDelimiter !== null) {
$value = str_getcsv($value, $hasDelimiter, $options['enclosure']); $value = str_getcsv($value, $hasDelimiter, $options['enclosure'], $options['escape']);
} else { } else {
$value = array($value); $value = array($value);
} }
@@ -5196,7 +5198,7 @@ class Sanitizer extends Wire {
* @param string|int|array|float $value * @param string|int|array|float $value
* @param int $maxLength Maximum length (default=128) * @param int $maxLength Maximum length (default=128)
* @param null|int $maxBytes Maximum allowed bytes (used for string types only) * @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 * @since 3.0.125
* @see Sanitizer::minLength() * @see Sanitizer::minLength()
* *

View File

@@ -1706,7 +1706,7 @@ class Session extends Wire implements \IteratorAggregate {
* @since 3.0.166 * @since 3.0.166
* *
*/ */
public function sessionHandler(WireSessionHandler $sessionHandler = null) { public function sessionHandler(?WireSessionHandler $sessionHandler = null) {
if($sessionHandler) $this->sessionHandler = $sessionHandler; if($sessionHandler) $this->sessionHandler = $sessionHandler;
return $this->sessionHandler; return $this->sessionHandler;
} }

View File

@@ -484,11 +484,11 @@ class Tfa extends WireData implements Module, ConfigurableModule {
/** /**
* Get the TFA module for given user or current session * 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 * @return Tfa|null
* *
*/ */
public function getModule(User $user = null) { public function getModule(?User $user = null) {
$module = null; $module = null;
$moduleName = $this->sessionGet('type'); $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 * 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. * 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. * Omit to test if the module supports it in general.
* @return bool * @return bool
* @since 3.0.160 * @since 3.0.160
* *
*/ */
public function autoEnableSupported(User $user = null) { public function autoEnableSupported(?User $user = null) {
if($user && $this->className() !== 'Tfa') { if($user && $this->className() !== 'Tfa') {
// if it doesn't support it without user, then exit now // if it doesn't support it without user, then exit now
if(!$this->autoEnableSupported()) return false; if(!$this->autoEnableSupported()) return false;
@@ -1901,7 +1901,7 @@ class RememberTfa extends Wire {
* @return string * @return string
* *
*/ */
protected function serverValue($cookieValue, User $user = null) { protected function serverValue($cookieValue, ?User $user = null) {
if($user === null) $user = $this->user; if($user === null) $user = $this->user;
return sha1( return sha1(
$user->id . $user->name . $user->email . $user->id . $user->name . $user->email .
@@ -1954,11 +1954,11 @@ class RememberTfa extends Wire {
/** /**
* Get fingerprint string * 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 * @return string
* *
*/ */
public function getFingerprintString(array $types = null) { public function getFingerprintString(?array $types = null) {
if($types === null) $types = $this->fingerprints; if($types === null) $types = $this->fingerprints;
return implode(',', $types) . ':' . sha1(implode("\n", $this->getFingerprintArray())); return implode(',', $types) . ':' . sha1(implode("\n", $this->getFingerprintArray()));
} }

View File

@@ -41,10 +41,10 @@ class User extends Page {
/** /**
* Create a new User page in memory. * 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'); if(!$tpl) $this->template = $this->wire()->templates->get('user');
$this->_parent_id = $this->wire()->config->usersPageID; $this->_parent_id = $this->wire()->config->usersPageID;
parent::__construct($tpl); parent::__construct($tpl);
@@ -234,11 +234,11 @@ class User extends Page {
* #pw-group-access * #pw-group-access
* *
* @param string|Permission * @param string|Permission
* @param Page $page Optional page to check against * @param Page|null $page Optional page to check against
* @return bool * @return bool
* *
*/ */
protected function ___hasPagePermission($name, Page $page = null) { protected function ___hasPagePermission($name, ?Page $page = null) {
if($this->isSuperuser()) return true; if($this->isSuperuser()) return true;
$permissions = $this->wire()->permissions; $permissions = $this->wire()->permissions;
@@ -404,11 +404,11 @@ class User extends Page {
* *
* #pw-group-access * #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 * @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). // Does not currently include page-add or page-create permissions (runtime).
if($this->isSuperuser()) return $this->wire()->permissions->getIterator(); // all permissions if($this->isSuperuser()) return $this->wire()->permissions->getIterator(); // all permissions
$userPermissions = $this->wire()->pages->newPageArray(); $userPermissions = $this->wire()->pages->newPageArray();

View File

@@ -626,7 +626,7 @@ abstract class Wire implements WireTranslatable, WireFuelable, WireTrackable {
* @deprecated * @deprecated
* *
*/ */
static public function isHooked($method, Wire $instance = null) { static public function isHooked($method, ?Wire $instance = null) {
/** @var ProcessWire $wire */ /** @var ProcessWire $wire */
$wire = $instance ? $instance->wire() : ProcessWire::getCurrentInstance(); $wire = $instance ? $instance->wire() : ProcessWire::getCurrentInstance();
if($instance) return $instance->wire()->hooks->hasHook($instance, $method); if($instance) return $instance->wire()->hooks->hasHook($instance, $method);
@@ -1370,7 +1370,7 @@ abstract class Wire implements WireTranslatable, WireFuelable, WireTrackable {
* *
* #pw-hooker * #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 bool|int $severe Whether or not it should be considered severe (default=true).
* @param string|array|object|true $text Additional details (optional): * @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. * - When provided, it will be sent to `$this->error($text)` if $severe is true, or `$this->warning($text)` if $severe is false.

View File

@@ -334,7 +334,7 @@ class WireHooks {
* @see WireHooks::isMethodHooked(), WireHooks::isPropertyHooked(), WireHooks::hasHook() * @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($instance) return $this->hasHook($instance, $method);
if(strpos($method, ':') !== false) { if(strpos($method, ':') !== false) {
$hooked = isset($this->hookClassMethodCache[$method]); // fromClass::method() or fromClass::property $hooked = isset($this->hookClassMethodCache[$method]); // fromClass::method() or fromClass::property

View File

@@ -6,7 +6,7 @@
* Wire Data Access Object, provides reusable capability for loading, saving, creating, deleting, * Wire Data Access Object, provides reusable capability for loading, saving, creating, deleting,
* and finding items of descending class-defined types. * 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 * https://processwire.com
* *
* @method WireArray load(WireArray $items, $selectors = null) * @method WireArray load(WireArray $items, $selectors = null)

View File

@@ -109,7 +109,7 @@ abstract class WireSaveableItemsLookup extends WireSaveableItems {
* @since 3.0.194 * @since 3.0.194
* *
*/ */
protected function initItem(array &$row, WireArray $items = null) { protected function initItem(array &$row, ?WireArray $items = null) {
$lookupField = $this->getLookupField(); $lookupField = $this->getLookupField();
$lookupValue = $row[$lookupField]; $lookupValue = $row[$lookupField];

View File

@@ -188,6 +188,8 @@ class CommentForm extends Wire implements CommentFormInterface {
* *
*/ */
public function __construct(Page $page, CommentArray $comments, $options = array()) { public function __construct(Page $page, CommentArray $comments, $options = array()) {
parent::__construct();
$this->page = $page; $this->page = $page;
$this->comments = $comments; $this->comments = $comments;
@@ -458,7 +460,7 @@ class CommentForm extends Wire implements CommentFormInterface {
* @return string * @return string
* *
*/ */
protected function renderSuccess(Comment $comment = null) { protected function renderSuccess(?Comment $comment = null) {
$pageID = (int) $this->wire('input')->post('page_id'); $pageID = (int) $this->wire('input')->post('page_id');

View File

@@ -2024,7 +2024,7 @@ class FieldtypeComments extends FieldtypeMulti {
* @since 3.0.169 * @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(); if(!$field->get('useNotify')) return array();
@@ -2093,7 +2093,7 @@ class FieldtypeComments extends FieldtypeMulti {
* *
* @param Page $page * @param Page $page
* @param Field $field * @param Field $field
* @param Comment|null $comment * @param Comment $comment
* @param array $emailsData * @param array $emailsData
* @return int * @return int
* @since 3.0.175 * @since 3.0.175

View File

@@ -782,7 +782,7 @@ class SelectableOptionManager extends Wire {
* @param HookEvent|null $event * @param HookEvent|null $event
* *
*/ */
public function updateLanguages(HookEvent $event = null) { public function updateLanguages(?HookEvent $event = null) {
if(!$this->useLanguages || !$this->wire()->languages) return; if(!$this->useLanguages || !$this->wire()->languages) return;

View File

@@ -1963,13 +1963,13 @@ class FieldtypeRepeater extends Fieldtype implements ConfigurableModule, Fieldty
* - repeaters/for-field-123/for-page-456/repeater-item/something-else/ * - repeaters/for-field-123/for-page-456/repeater-item/something-else/
* *
* @param Page $page * @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? * @param bool $recursive Descend to children?
* @return int Returns count of pages deleted, or 0 if delete not allowed * @return int Returns count of pages deleted, or 0 if delete not allowed
* @since 3.0.188 * @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; static $level = 0;
$numDeleted = 0; $numDeleted = 0;

View File

@@ -37,7 +37,7 @@ class FieldtypeRepeaterVersions extends Wire {
* @since 3.0.232 * @since 3.0.232
* *
*/ */
public function hasNestedRepeaterFields($page, Field $field = null, $verify = false) { public function hasNestedRepeaterFields($page, ?Field $field = null, $verify = false) {
$has = false; $has = false;
if($field === null) { if($field === null) {

View File

@@ -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 * 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. * @param bool $renderValueMode Whether renderValueMode will be used.
* @return bool * @return bool
* *
*/ */
public function renderReady(Inputfield $parent = null, $renderValueMode = false) { public function renderReady(?Inputfield $parent = null, $renderValueMode = false) {
$user = $this->wire()->user; $user = $this->wire()->user;
$modules = $this->wire()->modules; $modules = $this->wire()->modules;

View File

@@ -157,13 +157,13 @@ class FieldtypeTextarea extends FieldtypeText {
/** /**
* Get the MarkupQA instance * Get the MarkupQA instance
* *
* @param Page $page * @param Page|null $page
* @param Field $field * @param Field|null $field
* @return MarkupQA * @return MarkupQA
* @throws WireException If called the first time without page or field arguments * @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)) { if(is_null($this->markupQA)) {
$this->markupQA = $this->wire(new MarkupQA($page, $field)); $this->markupQA = $this->wire(new MarkupQA($page, $field));
} else { } else {

View File

@@ -188,12 +188,12 @@ class InputfieldAsmSelect extends InputfieldSelectMultiple implements Inputfield
/** /**
* Called before render() * Called before render()
* *
* @param Inputfield $parent * @param Inputfield|null $parent
* @param bool $renderValueMode * @param bool $renderValueMode
* @return bool * @return bool
* *
*/ */
public function renderReady(Inputfield $parent = null, $renderValueMode = false) { public function renderReady(?Inputfield $parent = null, $renderValueMode = false) {
$modules = $this->wire()->modules; $modules = $this->wire()->modules;
$config = $this->wire()->config; $config = $this->wire()->config;

View File

@@ -311,7 +311,7 @@ class InputfieldCKEditor extends InputfieldTextarea implements ConfigModule {
* @return bool * @return bool
* *
*/ */
public function renderReady(Inputfield $parent = null, $renderValueMode = false) { public function renderReady(?Inputfield $parent = null, $renderValueMode = false) {
static $loaded = false; static $loaded = false;

View File

@@ -272,12 +272,12 @@ class InputfieldDatetime extends Inputfield {
* We are overriding it here and checking for a datepicker, so that we can make sure * We are overriding it here and checking for a datepicker, so that we can make sure
* jQuery UI is loaded before the InputfieldDatetime.js * jQuery UI is loaded before the InputfieldDatetime.js
* *
* @param Inputfield $parent * @param Inputfield|null $parent
* @param bool $renderValueMode * @param bool $renderValueMode
* @return bool * @return bool
* *
*/ */
public function renderReady(Inputfield $parent = null, $renderValueMode = false) { public function renderReady(?Inputfield $parent = null, $renderValueMode = false) {
$this->addClass("InputfieldNoFocus", 'wrapClass'); $this->addClass("InputfieldNoFocus", 'wrapClass');
$this->getInputType()->renderReady(); $this->getInputType()->renderReady();
return parent::renderReady($parent, $renderValueMode); return parent::renderReady($parent, $renderValueMode);

View File

@@ -763,7 +763,7 @@ class InputfieldFile extends Inputfield implements InputfieldItemList, Inputfiel
* @return bool * @return bool
* *
*/ */
public function renderReady(Inputfield $parent = null, $renderValueMode = false) { public function renderReady(?Inputfield $parent = null, $renderValueMode = false) {
$config = $this->wire()->config; $config = $this->wire()->config;
@@ -1468,7 +1468,7 @@ class InputfieldFile extends Inputfield implements InputfieldItemList, Inputfiel
* @since 3.0.142 * @since 3.0.142
* *
*/ */
public function getItemInputfields(Pagefile $item = null) { public function getItemInputfields(?Pagefile $item = null) {
/** @var Pagefiles $pagefiles */ /** @var Pagefiles $pagefiles */
$value = $this->val(); $value = $this->val();

View File

@@ -125,11 +125,11 @@ class InputfieldFloat extends InputfieldInteger {
/** /**
* Override method from Inputfield to convert locale specific decimals for input[type=number] * Override method from Inputfield to convert locale specific decimals for input[type=number]
* *
* @param array $attributes * @param array|null $attributes
* @return string * @return string
* *
*/ */
public function getAttributesString(array $attributes = null) { public function getAttributesString(?array $attributes = null) {
if(is_null($attributes)) $attributes = $this->getAttributes(); if(is_null($attributes)) $attributes = $this->getAttributes();
if($attributes['type'] === 'number') { if($attributes['type'] === 'number') {
$value = isset($attributes['value']) ? $attributes['value'] : null; $value = isset($attributes['value']) ? $attributes['value'] : null;

View File

@@ -175,12 +175,12 @@ class InputfieldImage extends InputfieldFile implements InputfieldItemList, Inpu
/** /**
* Called right before Inputfield render * 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 * @param bool $renderValueMode Whether or not we are in renderValue mode
* @return bool * @return bool
* *
*/ */
public function renderReady(Inputfield $parent = null, $renderValueMode = false) { public function renderReady(?Inputfield $parent = null, $renderValueMode = false) {
if(self::debugRenderValue) { if(self::debugRenderValue) {
// force render value mode for dev/debugging purposes // force render value mode for dev/debugging purposes

View File

@@ -57,7 +57,7 @@ class InputfieldMarkup extends InputfieldWrapper {
* @return bool * @return bool
* *
*/ */
public function renderReady(Inputfield $parent = null, $renderValueMode = false) { public function renderReady(?Inputfield $parent = null, $renderValueMode = false) {
$label = $this->getSetting('label'); $label = $this->getSetting('label');
if(!strlen($label) && $this->skipLabel == Inputfield::skipLabelBlank) { if(!strlen($label) && $this->skipLabel == Inputfield::skipLabelBlank) {

View File

@@ -224,12 +224,12 @@ class InputfieldPage extends Inputfield implements ConfigurableModule {
* *
* @param Page $page * @param Page $page
* @param Field|InputfieldPage|string|int $field Field instance of field name (string) or ID * @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 * @return bool
* @throws WireException * @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; $pages = $page->wire()->pages;
$user = $page->wire()->user; $user = $page->wire()->user;
@@ -804,12 +804,12 @@ class InputfieldPage extends Inputfield implements ConfigurableModule {
/** /**
* Called before render() * Called before render()
* *
* @param Inputfield $parent * @param Inputfield|null $parent
* @param bool $renderValueMode * @param bool $renderValueMode
* @return bool * @return bool
* *
*/ */
public function renderReady(Inputfield $parent = null, $renderValueMode = false) { public function renderReady(?Inputfield $parent = null, $renderValueMode = false) {
$this->renderValueMode = $renderValueMode; $this->renderValueMode = $renderValueMode;
parent::renderReady($parent, $renderValueMode); parent::renderReady($parent, $renderValueMode);

View File

@@ -43,7 +43,7 @@ class InputfieldPageListSelect extends Inputfield implements InputfieldPageListS
parent::init(); 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); $this->pageListReady($this->attr('name'), $this->labelFieldName);
return parent::renderReady($parent, $renderValueMode); return parent::renderReady($parent, $renderValueMode);
} }

View File

@@ -75,7 +75,7 @@ class InputfieldPageListSelectMultiple extends Inputfield
return $out; 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); $this->pageListReady($this->attr('name'), $this->labelFieldName);
return parent::renderReady($parent, $renderValueMode); return parent::renderReady($parent, $renderValueMode);
} }

View File

@@ -108,7 +108,7 @@ class InputfieldPageTable extends Inputfield {
parent::init(); parent::init();
} }
public function renderReady(Inputfield $parent = null, $renderValueMode = false) { public function renderReady(?Inputfield $parent = null, $renderValueMode = false) {
$this->addClass('InputfieldNoFocus', 'wrapClass'); $this->addClass('InputfieldNoFocus', 'wrapClass');
$jQueryUI = $this->wire()->modules->get('JqueryUI'); /** @var JqueryUI $jQueryUI */ $jQueryUI = $this->wire()->modules->get('JqueryUI'); /** @var JqueryUI $jQueryUI */
$jQueryUI->use('modal'); $jQueryUI->use('modal');

View File

@@ -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(); if($this->nameField) $this->setupCustom();
return parent::renderReady($parent, $renderValueMode); return parent::renderReady($parent, $renderValueMode);
} }

View File

@@ -146,13 +146,13 @@ class InputfieldPassword extends InputfieldText {
/** /**
* Called before render * Called before render
* *
* @param Inputfield $parent * @param Inputfield|null $parent
* @param bool $renderValueMode * @param bool $renderValueMode
* @return bool * @return bool
* @throws WireException * @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; if($this->label == 'Set Password') $this->label = $this->defaultLabel;
$config = $this->wire()->config; $config = $this->wire()->config;
$url = $config->urls('InputfieldPassword') . 'complexify/'; $url = $config->urls('InputfieldPassword') . 'complexify/';

View File

@@ -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 $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 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 <option> tag) * @param array|null $attributes Optional attributes to be associated with this option (i.e. a 'selected' attribute for an <option> tag)
* @return $this * @return $this
* *
*/ */
public function addOption($value, $label = null, array $attributes = null) { public function addOption($value, $label = null, ?array $attributes = null) {
if(is_null($label) || (is_string($label) && !strlen($label))) $label = $value; if(is_null($label) || (is_string($label) && !strlen($label))) $label = $value;
if($value === $label && strpos($value, '-') === 0 && trim($value, '-') === '') { if($value === $label && strpos($value, '-') === 0 && trim($value, '-') === '') {
while(isset($this->options[$value])) $value .= '-'; while(isset($this->options[$value])) $value .= '-';
@@ -453,11 +453,11 @@ class InputfieldSelect extends Inputfield implements InputfieldHasSelectableOpti
* Returns whether the provided value is one of the available options * Returns whether the provided value is one of the available options
* *
* @param string|int $value * @param string|int $value
* @param array $options Array of options to check, or omit if using this classes options. * @param array|null $options Array of options to check, or omit if using this classes options.
* @return bool * @return bool
* *
*/ */
public function isOption($value, array $options = null) { public function isOption($value, ?array $options = null) {
if(is_null($options)) $options = $this->options; if(is_null($options)) $options = $this->options;
$is = false; $is = false;
@@ -715,7 +715,7 @@ class InputfieldSelect extends Inputfield implements InputfieldHasSelectableOpti
* @return bool * @return bool
* *
*/ */
public function renderReady(Inputfield $parent = null, $renderValueMode = false) { public function renderReady(?Inputfield $parent = null, $renderValueMode = false) {
if(!empty($this->optionLanguageLabels) && $this->hasFieldtype === false) { if(!empty($this->optionLanguageLabels) && $this->hasFieldtype === false) {
$languages = $this->wire()->languages; $languages = $this->wire()->languages;
if($languages) { if($languages) {

View File

@@ -54,10 +54,10 @@ class InputfieldSelectMultiple extends InputfieldSelect implements InputfieldHas
* @param string|int $value * @param string|int $value
* @param string|null $label * @param string|null $label
* @param array|null $attributes * @param array|null $attributes
* @return InputfieldSelect|InputfieldSelectMultiple|self * @return self
* *
*/ */
public function addOption($value, $label = null, array $attributes = null) { public function addOption($value, $label = null, ?array $attributes = null) {
if(is_null($value) || (is_string($value) && !strlen($value))) return $this; if(is_null($value) || (is_string($value) && !strlen($value))) return $this;
return parent::addOption($value, $label, $attributes); return parent::addOption($value, $label, $attributes);
} }

View File

@@ -1188,11 +1188,11 @@ class InputfieldSelector extends Inputfield implements ConfigurableModule {
* @param string $selectedOperator * @param string $selectedOperator
* @param string $selectedValue * @param string $selectedValue
* @param bool $orChecked * @param bool $orChecked
* @param Selector $selector * @param Selector|null $selector
* @return string * @return string
* *
*/ */
protected function renderOpval($fieldName, $type = '', $selectedOperator = '', $selectedValue = '', $orChecked = false, Selector $selector = null) { protected function renderOpval($fieldName, $type = '', $selectedOperator = '', $selectedValue = '', $orChecked = false, ?Selector $selector = null) {
/* /*
$this->message("fieldName: $fieldName"); $this->message("fieldName: $fieldName");
@@ -1503,11 +1503,11 @@ class InputfieldSelector extends Inputfield implements ConfigurableModule {
* *
* @param $fieldName * @param $fieldName
* @param string $selectedValue * @param string $selectedValue
* @param Selector $selector * @param Selector|null $selector
* @return string * @return string
* *
*/ */
protected function renderSelectSubfield($fieldName, $selectedValue = '', Selector $selector = null) { protected function renderSelectSubfield($fieldName, $selectedValue = '', ?Selector $selector = null) {
$sanitizer = $this->wire()->sanitizer; $sanitizer = $this->wire()->sanitizer;

View File

@@ -147,12 +147,12 @@ class InputfieldSubmit extends Inputfield {
/** /**
* Render ready * Render ready
* *
* @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()`. * @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. * @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) {
$class = $this->attr('class'); $class = $this->attr('class');
if(strpos($class, 'head_button_clone') !== false) { if(strpos($class, 'head_button_clone') !== false) {
// if legacy class name used, convert to updated pw- class name to accomodate 3rd party usages // if legacy class name used, convert to updated pw- class name to accomodate 3rd party usages

View File

@@ -86,13 +86,13 @@ class InputfieldText extends Inputfield {
/** /**
* Render ready * Render ready
* *
* @param Inputfield $parent * @param Inputfield|null $parent
* @param bool $renderValueMode * @param bool $renderValueMode
* @return bool * @return bool
* @throws WireException * @throws WireException
* *
*/ */
public function renderReady(Inputfield $parent = null, $renderValueMode = false) { public function renderReady(?Inputfield $parent = null, $renderValueMode = false) {
$showCount = (int) $this->getSetting('showCount'); $showCount = (int) $this->getSetting('showCount');
if($showCount) { if($showCount) {
$this->addClass('InputfieldTextLength'); $this->addClass('InputfieldTextLength');

View File

@@ -509,13 +509,13 @@ class InputfieldTextTags extends Inputfield implements
* *
* #pw-internal * #pw-internal
* *
* @param Inputfield $parent * @param Inputfield|null $parent
* @param bool $renderValueMode * @param bool $renderValueMode
* @return bool * @return bool
* @throws WireException * @throws WireException
* *
*/ */
public function renderReady(Inputfield $parent = null, $renderValueMode = false) { public function renderReady(?Inputfield $parent = null, $renderValueMode = false) {
/** @var JqueryUI $jQueryUI */ /** @var JqueryUI $jQueryUI */
$jQueryUI = $this->wire()->modules->get('JqueryUI'); $jQueryUI = $this->wire()->modules->get('JqueryUI');
$jQueryUI->use('selectize'); $jQueryUI->use('selectize');
@@ -800,7 +800,7 @@ class InputfieldTextTags extends Inputfield implements
* @return self|$this * @return self|$this
* *
*/ */
public function addOption($value, $label = null, array $attributes = null) { public function addOption($value, $label = null, ?array $attributes = null) {
return $this->addTag($value, $label); return $this->addTag($value, $label);
} }

View File

@@ -544,7 +544,7 @@ class InputfieldTinyMCE extends InputfieldTextarea implements ConfigurableModule
* @return bool * @return bool
* *
*/ */
public function renderReady(Inputfield $parent = null, $renderValueMode = false) { public function renderReady(?Inputfield $parent = null, $renderValueMode = false) {
if(!self::$loaded) { if(!self::$loaded) {
$this->renderReadyOnce(); $this->renderReadyOnce();

View File

@@ -334,7 +334,7 @@ class InputfieldToggle extends Inputfield {
* @return bool * @return bool
* *
*/ */
public function renderReady(Inputfield $parent = null, $renderValueMode = false) { public function renderReady(?Inputfield $parent = null, $renderValueMode = false) {
$f = $this->getInputfield(); $f = $this->getInputfield();
if($f && $f !== $this) $f->renderReady($parent, $renderValueMode); if($f && $f !== $this) $f->renderReady($parent, $renderValueMode);
if($this->useDeselect && $this->defaultOption === 'none') { if($this->useDeselect && $this->defaultOption === 'none') {

View File

@@ -25,10 +25,10 @@ class Language extends Page {
/** /**
* Construct a new Language instance * Construct a new Language instance
* *
* @param Template $tpl * @param Template|null $tpl
* *
*/ */
public function __construct(Template $tpl = null) { public function __construct(?Template $tpl = null) {
parent::__construct($tpl); parent::__construct($tpl);
if(!$tpl) $this->template = $this->wire()->templates->get('language'); if(!$tpl) $this->template = $this->wire()->templates->get('language');
} }

View File

@@ -443,7 +443,7 @@ class LanguageSupportPageNames extends WireData implements Module, ConfigurableM
* @param Language|null $language * @param Language|null $language
* *
*/ */
public function setLanguage(Language $language = null) { public function setLanguage(?Language $language = null) {
$languages = $this->wire()->languages; $languages = $this->wire()->languages;
if(!$language) $language = $languages->getDefault(); if(!$language) $language = $languages->getDefault();
$this->setLanguage = $language; $this->setLanguage = $language;
@@ -846,7 +846,7 @@ class LanguageSupportPageNames extends WireData implements Module, ConfigurableM
* @return bool True if all good, false if not * @return bool True if all good, false if not
* *
*/ */
public function checkLanguagePageName(Language $language, Page $page, $parentID, $value, Wire $errorTarget = null) { public function checkLanguagePageName(Language $language, Page $page, $parentID, $value, ?Wire $errorTarget = null) {
// verify that it does not conflict with another page inheriting name from default language // verify that it does not conflict with another page inheriting name from default language
$isValid = true; $isValid = true;
$nameKey = "name$language->id"; $nameKey = "name$language->id";
@@ -1441,11 +1441,11 @@ class LanguageSupportPageNames extends WireData implements Module, ConfigurableM
* Return the Language that the given path is in or null if can't determine * Return the Language that the given path is in or null if can't determine
* *
* @param string $path Page path without without installation subdir or URL segments or page numbers * @param string $path Page path without without installation subdir or URL segments or page numbers
* @param Page $page If you already know the $page that resulted from the path, provide it here for faster performance * @param Page|null $page If you already know the $page that resulted from the path, provide it here for faster performance
* @return Language|null * @return Language|null
* *
*/ */
public function getPagePathLanguage($path, Page $page = null) { public function getPagePathLanguage($path, ?Page $page = null) {
$languages = $this->wire()->languages; $languages = $this->wire()->languages;
$pages = $this->wire()->pages; $pages = $this->wire()->pages;

View File

@@ -300,13 +300,12 @@ class Languages extends PagesType {
* $languages->unsetDefault(); * $languages->unsetDefault();
* ~~~~~ * ~~~~~
* *
* @param Language $language * @param Language|null $language
* @return void * @return void
*
* @see Languages::unsetDefault(), Languages::setLanguage() * @see Languages::unsetDefault(), Languages::setLanguage()
* *
*/ */
public function setDefault(Language $language = null) { public function setDefault(?Language $language = null) {
if(is_null($language)) { if(is_null($language)) {
// save current user language setting and make current language default // save current user language setting and make current language default
if(!$this->defaultLanguage) return; if(!$this->defaultLanguage) return;

View File

@@ -268,7 +268,7 @@ class MarkupRSS extends WireData implements Module, ConfigurableModule {
* @return string * @return string
* *
*/ */
public function renderFeed(PageArray $feedPages = null) { public function renderFeed(?PageArray $feedPages = null) {
if(!is_null($feedPages)) $this->feedPages = $feedPages; if(!is_null($feedPages)) $this->feedPages = $feedPages;
@@ -291,7 +291,7 @@ class MarkupRSS extends WireData implements Module, ConfigurableModule {
* @return bool * @return bool
* *
*/ */
public function render(PageArray $feedPages = null) { public function render(?PageArray $feedPages = null) {
header($this->header); header($this->header);
echo $this->renderFeed($feedPages); echo $this->renderFeed($feedPages);
return true; return true;
@@ -529,5 +529,3 @@ class MarkupRSS extends WireData implements Module, ConfigurableModule {
} }
} }

View File

@@ -344,7 +344,7 @@ class PagePaths extends WireData implements Module, ConfigurableModule {
* @since 3.0.186 * @since 3.0.186
* *
*/ */
public function rebuild(Page $page = null) { public function rebuild(?Page $page = null) {
set_time_limit(3600); set_time_limit(3600);
$table = self::dbTableName; $table = self::dbTableName;
if($page === null) { if($page === null) {
@@ -535,6 +535,9 @@ class PagePaths extends WireData implements Module, ConfigurableModule {
"COUNT(children.id) AS kids " . "COUNT(children.id) AS kids " .
"FROM pages " . "FROM pages " .
"LEFT JOIN pages AS children ON children.id=pages.parent_id " . "LEFT JOIN pages AS children ON children.id=pages.parent_id " .
// The next line is proposed (PR#281) to replace the above line
// but we need further confirmation that it is correct:
// "LEFT JOIN pages AS children ON children.parent_id=pages.id " .
"WHERE pages.parent_id=:id " . "WHERE pages.parent_id=:id " .
"GROUP BY pages.id "; "GROUP BY pages.id ";
@@ -563,6 +566,23 @@ class PagePaths extends WireData implements Module, ConfigurableModule {
return $numUpdated; return $numUpdated;
} }
/**
* Alternate proposed replacement for updatePagePathsChildren() method
*
* @param int $pageId
* @param array $paths
* @return int
* @throws WireException
*
public function updatePagePathsChildren($pageId, array $paths) {
$numUpdated = 0;
foreach($this->wire()->pages->findMany("parent=$pageId,include=all") as $childPage) {
$numUpdated += $this->updatePagePaths($childPage);
}
return $numUpdated;
}
*/
/*** ROOT SEGMENTS ******************************************************************************/ /*** ROOT SEGMENTS ******************************************************************************/

View File

@@ -238,9 +238,9 @@ class PagePermissions extends WireData implements Module {
} }
/** /**
* Returns whether the given user ($page) is editable by the current user * Returns whether the given page ($page) is editable by the current user
* *
* @param User|Page $page * @param Page $page
* @param array $options * @param array $options
* - `viewable` (bool): Specify true if only a viewable check is needed (default=false) * - `viewable` (bool): Specify true if only a viewable check is needed (default=false)
* @return bool * @return bool
@@ -377,9 +377,9 @@ class PagePermissions extends WireData implements Module {
} }
/** /**
* Returns whether the given user ($page) is viewable by the current user * Returns whether the given page ($page) is viewable by the current user
* *
* @param User|Page $page * @param Page $page
* @param array $options * @param array $options
* @return bool * @return bool
* @throws WireException * @throws WireException
@@ -583,7 +583,7 @@ class PagePermissions extends WireData implements Module {
* @return bool * @return bool
* *
*/ */
public function userFieldEditable($name, User $user = null) { public function userFieldEditable($name, ?User $user = null) {
if($name instanceof Field) $name = $name->name; if($name instanceof Field) $name = $name->name;
if(empty($name) || !is_string($name)) return false; if(empty($name) || !is_string($name)) return false;
if($user === null) $user = $this->wire()->user; if($user === null) $user = $this->wire()->user;

View File

@@ -1240,7 +1240,7 @@ class PagesVersions extends Wire implements Module {
* @return Field[] Returned array of Field objects is indexed by Field name * @return Field[] Returned array of Field objects is indexed by Field name
* *
*/ */
public function getUnsupportedFields(Page $page = null) { public function getUnsupportedFields(?Page $page = null) {
if($page && !$page->id) return []; if($page && !$page->id) return [];
$templateId = $page ? $page->templates_id : 0; $templateId = $page ? $page->templates_id : 0;
if(isset($this->unsupportedFields[$templateId])) { if(isset($this->unsupportedFields[$templateId])) {

View File

@@ -701,12 +701,12 @@ class ProcessPageAdd extends Process implements ConfigurableModule, WirePageEdit
* Is the given template or template ID allowed here? * Is the given template or template ID allowed here?
* *
* @param Template|int Template ID or object * @param Template|int Template ID or object
* @param Page $parent Optionally parent page to filter by * @param Page|null $parent Optionally parent page to filter by
* @return bool * @return bool
* @throws WireException of template argument can't be resolved * @throws WireException of template argument can't be resolved
* *
*/ */
protected function isAllowedTemplate($template, Page $parent = null) { protected function isAllowedTemplate($template, ?Page $parent = null) {
if(!is_object($template)) $template = $this->wire()->templates->get($template); if(!is_object($template)) $template = $this->wire()->templates->get($template);
if(!$template) throw new WireException('Unknown template'); if(!$template) throw new WireException('Unknown template');
$templates = $this->getAllowedTemplates($parent); $templates = $this->getAllowedTemplates($parent);
@@ -732,11 +732,11 @@ class ProcessPageAdd extends Process implements ConfigurableModule, WirePageEdit
* *
* @param Page $parent * @param Page $parent
* @param bool $showError * @param bool $showError
* @param Template $template Optionally limit condition to a specific template * @param Template|null $template Optionally limit condition to a specific template
* @return bool * @return bool
* *
*/ */
protected function isAllowedParent(Page $parent, $showError = false, Template $template = null) { protected function isAllowedParent(Page $parent, $showError = false, ?Template $template = null) {
if($parent->template->noChildren) { if($parent->template->noChildren) {
if($showError) { if($showError) {
@@ -807,11 +807,11 @@ class ProcessPageAdd extends Process implements ConfigurableModule, WirePageEdit
* *
* This will always be 1-parent, unless predefinedParents was populated. * This will always be 1-parent, unless predefinedParents was populated.
* *
* @param Template $template Optionally specify a template to filter parents by * @param Template|null $template Optionally specify a template to filter parents by
* @return PageArray * @return PageArray
* *
*/ */
protected function getAllowedParents(Template $template = null) { protected function getAllowedParents(?Template $template = null) {
if(count($this->predefinedParents)) { if(count($this->predefinedParents)) {
$parents = $this->predefinedParents; $parents = $this->predefinedParents;
} else { } else {

View File

@@ -436,12 +436,12 @@ class ProcessPageClone extends Process implements ConfigurableModule {
* *
* Outputs JSON result and exits * Outputs JSON result and exits
* *
* @param Page $original * @param Page|null $original
* @param bool $returnArray * @param bool $returnArray
* @return array|null * @return array|null
* *
*/ */
public function processAjax(Page $original = null, $returnArray = false) { public function processAjax(?Page $original = null, $returnArray = false) {
$error = null; $error = null;
if($original === null) $original = $this->page; if($original === null) $original = $this->page;

View File

@@ -162,11 +162,11 @@ class ProcessPageSearchLive extends Wire {
/** /**
* Construct * Construct
* *
* @param Process|ProcessPageSearch $process * @param ProcessPageSearch|null $process
* @param array $liveSearch * @param array $liveSearch
* *
*/ */
public function __construct(Process $process = null, array $liveSearch = array()) { public function __construct(?Process $process = null, array $liveSearch = array()) {
if($process) { if($process) {
$process->wire($this); $process->wire($this);

View File

@@ -2480,11 +2480,11 @@ class ProcessTemplate extends Process implements ConfigurableModule {
/** /**
* Build the "roles" field for "access" tab in edit form * Build the "roles" field for "access" tab in edit form
* *
* @param Template $template * @param Template|null $template
* @return InputfieldMarkup * @return InputfieldMarkup
* *
*/ */
protected function buildEditFormAccessRoles(Template $template = null) { protected function buildEditFormAccessRoles(?Template $template = null) {
$config = $this->wire()->config; $config = $this->wire()->config;
$modules = $this->wire()->modules; $modules = $this->wire()->modules;

View File

@@ -331,7 +331,7 @@ class ParsedownExtra extends Parsedown
# #
# Setext # Setext
protected function blockSetextHeader($Line, array $Block = null) protected function blockSetextHeader($Line, ?array $Block = null)
{ {
$Block = parent::blockSetextHeader($Line, $Block); $Block = parent::blockSetextHeader($Line, $Block);

View File

@@ -571,7 +571,7 @@ class Parsedown
# #
# List # List
protected function blockList($Line, array $CurrentBlock = null) protected function blockList($Line, ?array $CurrentBlock = null)
{ {
list($name, $pattern) = $Line['text'][0] <= '-' ? array('ul', '[*+-]') : array('ol', '[0-9]{1,9}+[.\)]'); list($name, $pattern) = $Line['text'][0] <= '-' ? array('ul', '[*+-]') : array('ol', '[0-9]{1,9}+[.\)]');
@@ -808,7 +808,7 @@ class Parsedown
# #
# Setext # Setext
protected function blockSetextHeader($Line, array $Block = null) protected function blockSetextHeader($Line, ?array $Block = null)
{ {
if ( ! isset($Block) or $Block['type'] !== 'Paragraph' or isset($Block['interrupted'])) if ( ! isset($Block) or $Block['type'] !== 'Paragraph' or isset($Block['interrupted']))
{ {
@@ -894,7 +894,7 @@ class Parsedown
# #
# Table # Table
protected function blockTable($Line, array $Block = null) protected function blockTable($Line, ?array $Block = null)
{ {
if ( ! isset($Block) or $Block['type'] !== 'Paragraph' or isset($Block['interrupted'])) if ( ! isset($Block) or $Block['type'] !== 'Paragraph' or isset($Block['interrupted']))
{ {