Change implicit nullable type declaration to explicit

Since PHP 8.4 implicitly nullable parameter types are deprecated.

Normalize scoped PHPDoc for nullable-parameter updates: use `?Type` instead of
`Type|null`, remove column alignment, and indent continuation lines with 2
spaces.

Co-authored-by: "Eric Lippmann <eric.lippmann@icinga.com>"
This commit is contained in:
Bastian Lederer 2025-11-20 13:44:24 +01:00 committed by Eric Lippmann
parent bc2d4a51c7
commit ea0ce32bc9
48 changed files with 388 additions and 387 deletions

View file

@ -145,11 +145,11 @@ abstract class RepositoryForm extends Form
/**
* Add a new entry
*
* @param array $data The defaults to use, if any
* @param ?array $data The defaults to use, if any
*
* @return $this
* @return $this
*/
public function add(array $data = null)
public function add(?array $data = null)
{
$this->mode = static::MODE_INSERT;
$this->data = $data;
@ -159,12 +159,12 @@ abstract class RepositoryForm extends Form
/**
* Edit an entry
*
* @param string $name The entry's name
* @param array $data The entry's current data
* @param string $name The entry's name
* @param ?array $data The entry's current data
*
* @return $this
* @return $this
*/
public function edit($name, array $data = null)
public function edit($name, ?array $data = null)
{
$this->mode = static::MODE_UPDATE;
$this->identifier = $name;

View file

@ -68,9 +68,9 @@ class Config implements Countable, Iterator, Selectable
/**
* Create a new config
*
* @param ConfigObject $config The config object to handle
* @param ?ConfigObject $config The config object to handle
*/
public function __construct(ConfigObject $config = null)
public function __construct(?ConfigObject $config = null)
{
$this->config = $config !== null ? $config : new ConfigObject();
}

View file

@ -16,13 +16,14 @@ abstract class AuditHook
*
* Propagates the given message details to all known hook implementations.
*
* @param string $type An arbitrary name identifying the type of activity
* @param string $message A detailed description possibly referencing parameters in $data
* @param array $data Additional information (How this is stored or used is up to each implementation)
* @param string $identity An arbitrary name identifying the responsible subject, defaults to the current user
* @param int $time A timestamp defining when the activity occurred, defaults to now
* @param string $type An arbitrary name identifying the type of activity
* @param string $message A detailed description possibly referencing parameters in $data
* @param ?array $data Additional information (How this is stored or used is up to each implementation)
* @param string $identity An arbitrary name identifying the responsible subject,
* defaults to the current user
* @param int $time A timestamp defining when the activity occurred, defaults to now
*/
public static function logActivity($type, $message, array $data = null, $identity = null, $time = null)
public static function logActivity($type, $message, ?array $data = null, $identity = null, $time = null)
{
if (! Hook::has('audit')) {
return;
@ -60,13 +61,13 @@ abstract class AuditHook
/**
* Log a message to the audit log
*
* @param int $time A timestamp defining when the activity occurred
* @param string $identity An arbitrary name identifying the responsible subject
* @param string $type An arbitrary name identifying the type of activity
* @param string $message A detailed description of the activity
* @param array $data Additional activity information
* @param int $time A timestamp defining when the activity occurred
* @param string $identity An arbitrary name identifying the responsible subject
* @param string $type An arbitrary name identifying the type of activity
* @param string $message A detailed description of the activity
* @param ?array $data Additional activity information
*/
abstract public function logMessage($time, $identity, $type, $message, array $data = null);
abstract public function logMessage($time, $identity, $type, $message, ?array $data = null);
/**
* Substitute the given message with its accompanying data

View file

@ -196,11 +196,11 @@ abstract class DbMigrationHook implements Countable
* Apply all pending migrations of this hook
*
* @param ?Connection $conn Use the provided database connection to apply the migrations.
* Is only used to elevate database users with insufficient privileges.
* Is only used to elevate database users with insufficient privileges.
*
* @return bool Whether the migration(s) have been successfully applied
*/
final public function run(Connection $conn = null): bool
final public function run(?Connection $conn = null): bool
{
if (! $conn) {
$conn = $this->getDb();

View file

@ -131,7 +131,7 @@ final class MigrationManager implements Countable
*
* @return bool
*/
public function apply(DbMigrationHook $hook, array $elevateConfig = null): bool
public function apply(DbMigrationHook $hook, ?array $elevateConfig = null): bool
{
if ($hook->isModule() && $this->hasMigrations(DbMigrationHook::DEFAULT_MODULE)) {
Logger::error(
@ -164,7 +164,7 @@ final class MigrationManager implements Countable
*
* @return bool
*/
public function applyAll(array $elevateConfig = null): bool
public function applyAll(?array $elevateConfig = null): bool
{
$default = DbMigrationHook::DEFAULT_MODULE;
if ($this->hasMigrations($default)) {
@ -218,7 +218,7 @@ final class MigrationManager implements Countable
*
* @return bool
*/
public function validateDatabasePrivileges(array $elevateConfig = null, bool $canIssueGrant = false): bool
public function validateDatabasePrivileges(?array $elevateConfig = null, bool $canIssueGrant = false): bool
{
if (! $this->hasPendingMigrations()) {
return true;
@ -324,7 +324,7 @@ final class MigrationManager implements Countable
*/
protected function checkRequiredPrivileges(
Sql\Connection $conn,
array $elevateConfig = null,
?array $elevateConfig = null,
bool $canIssueGrants = false
): bool {
if ($elevateConfig) {

View file

@ -641,11 +641,11 @@ class Manager
/**
* Detect installed modules from every path provided in modulePaths
*
* @param array $availableDirs Installed modules location
* @param ?array $availableDirs Installed modules location
*
* @return $this
*/
public function detectInstalledModules(array $availableDirs = null)
public function detectInstalledModules(?array $availableDirs = null)
{
$modulePaths = $availableDirs !== null ? $availableDirs : $this->modulePaths;
foreach ($modulePaths as $basedir) {

View file

@ -85,9 +85,9 @@ class AuthChain implements Authenticatable, Iterator
/**
* Create a new authentication chain from config
*
* @param Config $config User backends configuration
* @param ?Config $config User backends configuration
*/
public function __construct(Config $config = null)
public function __construct(?Config $config = null)
{
if ($config === null) {
try {

View file

@ -134,11 +134,11 @@ class DbUserBackend extends DbRepository implements UserBackendInterface, Inspec
/**
* Update table rows with the given data, optionally limited by using a filter
*
* @param string $table
* @param array $bind
* @param Filter $filter
* @param string $table
* @param array $bind
* @param ?Filter $filter
*/
public function update($table, array $bind, Filter $filter = null, array $types = array())
public function update($table, array $bind, ?Filter $filter = null, array $types = array())
{
$this->requireTable($table);
$bind['last_modified'] = date('Y-m-d H:i:s');

View file

@ -334,14 +334,14 @@ class LdapUserBackend extends LdapRepository implements UserBackendInterface, Do
/**
* Validate that the requested table exists
*
* @param string $table The table to validate
* @param RepositoryQuery $query An optional query to pass as context
* @param string $table The table to validate
* @param ?RepositoryQuery $query An optional query to pass as context
*
* @return string
* @return string
*
* @throws ProgrammingError In case the given table does not exist
* @throws ProgrammingError In case the given table does not exist
*/
public function requireTable($table, RepositoryQuery $query = null)
public function requireTable($table, ?RepositoryQuery $query = null)
{
if ($query !== null) {
$query->getQuery()->setBase($this->baseDn);
@ -356,15 +356,15 @@ class LdapUserBackend extends LdapRepository implements UserBackendInterface, Do
/**
* Validate that the given column is a valid query target and return it or the actual name if it's an alias
*
* @param string $table The table where to look for the column or alias
* @param string $name The name or alias of the column to validate
* @param RepositoryQuery $query An optional query to pass as context
* @param string $table The table where to look for the column or alias
* @param string $name The name or alias of the column to validate
* @param ?RepositoryQuery $query An optional query to pass as context
*
* @return string The given column's name
* @return string The given column's name
*
* @throws QueryException In case the given column is not a valid query column
* @throws QueryException In case the given column is not a valid query column
*/
public function requireQueryColumn($table, $name, RepositoryQuery $query = null)
public function requireQueryColumn($table, $name, ?RepositoryQuery $query = null)
{
$column = parent::requireQueryColumn($table, $name, $query);
if ($name === 'user_name' && $query !== null) {

View file

@ -159,14 +159,14 @@ class UserBackend implements ConfigAwareFactory
/**
* Create and return a user backend with the given name and given configuration applied to it
*
* @param string $name
* @param ConfigObject $backendConfig
* @param string $name
* @param ?ConfigObject $backendConfig
*
* @return UserBackendInterface
* @return UserBackendInterface
*
* @throws ConfigurationError
* @throws ConfigurationError
*/
public static function create($name, ConfigObject $backendConfig = null)
public static function create($name, ?ConfigObject $backendConfig = null)
{
if ($backendConfig === null) {
self::assertBackendsExist();

View file

@ -142,11 +142,11 @@ class DbUserGroupBackend extends DbRepository implements Inspectable, UserGroupB
/**
* Update table rows with the given data, optionally limited by using a filter
*
* @param string $table
* @param array $bind
* @param Filter $filter
* @param string $table
* @param array $bind
* @param ?Filter $filter
*/
public function update($table, array $bind, Filter $filter = null, array $types = array())
public function update($table, array $bind, ?Filter $filter = null, array $types = array())
{
$bind['last_modified'] = date('Y-m-d H:i:s');
parent::update($table, $bind, $filter);
@ -155,10 +155,10 @@ class DbUserGroupBackend extends DbRepository implements Inspectable, UserGroupB
/**
* Delete table rows, optionally limited by using a filter
*
* @param string $table
* @param Filter $filter
* @param string $table
* @param ?Filter $filter
*/
public function delete($table, Filter $filter = null)
public function delete($table, ?Filter $filter = null)
{
if ($table === 'group') {
parent::delete('group_membership', $filter);

View file

@ -661,14 +661,14 @@ class LdapUserGroupBackend extends LdapRepository implements Inspectable, UserGr
/**
* Validate that the requested table exists
*
* @param string $table The table to validate
* @param RepositoryQuery $query An optional query to pass as context
* @param string $table The table to validate
* @param ?RepositoryQuery $query An optional query to pass as context
*
* @return string
* @return string
*
* @throws ProgrammingError In case the given table does not exist
* @throws ProgrammingError In case the given table does not exist
*/
public function requireTable($table, RepositoryQuery $query = null)
public function requireTable($table, ?RepositoryQuery $query = null)
{
if ($query !== null) {
$query->getQuery()->setBase($this->groupBaseDn);
@ -683,15 +683,15 @@ class LdapUserGroupBackend extends LdapRepository implements Inspectable, UserGr
/**
* Validate that the given column is a valid query target and return it or the actual name if it's an alias
*
* @param string $table The table where to look for the column or alias
* @param string $name The name or alias of the column to validate
* @param RepositoryQuery $query An optional query to pass as context
* @param string $table The table where to look for the column or alias
* @param string $name The name or alias of the column to validate
* @param ?RepositoryQuery $query An optional query to pass as context
*
* @return string The given column's name
* @return string The given column's name
*
* @throws QueryException In case the given column is not a valid query column
* @throws QueryException In case the given column is not a valid query column
*/
public function requireQueryColumn($table, $name, RepositoryQuery $query = null)
public function requireQueryColumn($table, $name, ?RepositoryQuery $query = null)
{
$column = parent::requireQueryColumn($table, $name, $query);
if (($name === 'user_name' || $name === 'group_name') && $query !== null) {

View file

@ -53,15 +53,15 @@ class BarGraph extends Styleable implements Drawable
/**
* Create a new BarGraph with the given dataset
*
* @param array $dataSet An array of data points
* @param int $order The graph number displayed by this BarGraph
* @param array $tooltips The tooltips to display for each value
* @param array $dataSet An array of data points
* @param int $order The graph number displayed by this BarGraph
* @param ?array $tooltips The tooltips to display for each value
*/
public function __construct(
array $dataSet,
array &$graphs,
$order,
array $tooltips = null
?array $tooltips = null
) {
$this->order = $order;
$this->dataSet = $dataSet;

View file

@ -73,7 +73,7 @@ class LineGraph extends Styleable implements Drawable
array $dataset,
array &$graphs,
$order,
array $tooltips = null
?array $tooltips = null
) {
usort($dataset, array($this, 'sortByX'));
$this->dataset = $dataset;

View file

@ -182,7 +182,7 @@ class Loader
}
}
public function parseParams(Params $params = null)
public function parseParams(?Params $params = null)
{
if ($params === null) {
$params = $this->app->getParams();
@ -235,13 +235,13 @@ class Loader
return $this;
}
public function handleParams(Params $params = null)
public function handleParams(?Params $params = null)
{
$this->parseParams($params);
$this->dispatch();
}
public function dispatch(Params $overrideParams = null)
public function dispatch(?Params $overrideParams = null)
{
if ($this->commandName === null) {
fwrite(STDERR, $this->docs()->usage($this->moduleName));

View file

@ -72,9 +72,9 @@ class DbConnection implements Selectable, Extensible, Updatable, Reducible, Insp
/**
* Create a new connection object
*
* @param ConfigObject $config
* @param ?ConfigObject $config
*/
public function __construct(ConfigObject $config = null)
public function __construct(?ConfigObject $config = null)
{
$this->config = $config;
$this->connect();
@ -428,14 +428,14 @@ class DbConnection implements Selectable, Extensible, Updatable, Reducible, Insp
* Pass an array with a column name (the same as in $bind) and a PDO::PARAM_* constant as value
* as fourth parameter $types to define a different type than string for a particular column.
*
* @param string $table
* @param array $bind
* @param Filter $filter
* @param array $types
* @param string $table
* @param array $bind
* @param ?Filter $filter
* @param array $types
*
* @return int The number of affected rows
* @return int The number of affected rows
*/
public function update($table, array $bind, Filter $filter = null, array $types = array())
public function update($table, array $bind, ?Filter $filter = null, array $types = array())
{
$set = array();
foreach ($bind as $column => $value) {
@ -464,12 +464,12 @@ class DbConnection implements Selectable, Extensible, Updatable, Reducible, Insp
/**
* Delete table rows, optionally limited by using a filter
*
* @param string $table
* @param Filter $filter
* @param string $table
* @param ?Filter $filter
*
* @return int The number of affected rows
* @return int The number of affected rows
*/
public function delete($table, Filter $filter = null)
public function delete($table, ?Filter $filter = null)
{
return $this->dbAdapter->delete($table, $filter ? $this->renderFilter($filter) : '');
}

View file

@ -101,7 +101,7 @@ class DbQuery extends SimpleQuery
return $this;
}
public function from($target, array $fields = null)
public function from($target, ?array $fields = null)
{
parent::from($target, $fields);
$this->select->from($this->target, array());

View file

@ -122,11 +122,11 @@ class PivotTable implements Sortable
/**
* Set the filter to apply on the query for the x-axis
*
* @param Filter $filter
* @param ?Filter $filter
*
* @return $this
* @return $this
*/
public function setXAxisFilter(Filter $filter = null)
public function setXAxisFilter(?Filter $filter = null)
{
$this->xAxisFilter = $filter;
return $this;
@ -135,11 +135,11 @@ class PivotTable implements Sortable
/**
* Set the filter to apply on the query for the y-axis
*
* @param Filter $filter
* @param ?Filter $filter
*
* @return $this
* @return $this
*/
public function setYAxisFilter(Filter $filter = null)
public function setYAxisFilter(?Filter $filter = null)
{
$this->yAxisFilter = $filter;
return $this;

View file

@ -11,10 +11,10 @@ interface Queryable
/**
* Set the target and fields to query
*
* @param string $target
* @param array $fields
* @param string $target
* @param ?array $fields
*
* @return Fetchable
* @return Fetchable
*/
public function from($target, array $fields = null);
public function from($target, ?array $fields = null);
}

View file

@ -14,10 +14,10 @@ interface Reducible
/**
* Delete entries in the given target, optionally limiting the affected entries by using a filter
*
* @param string $target
* @param Filter $filter
* @param string $target
* @param ?Filter $filter
*
* @throws StatementException
* @throws StatementException
*/
public function delete($target, Filter $filter = null);
public function delete($target, ?Filter $filter = null);
}

View file

@ -239,12 +239,12 @@ class SimpleQuery implements QueryInterface, Queryable, Iterator
*
* Query will return all available columns if none are given here.
*
* @param mixed $target
* @param array $fields
* @param mixed $target
* @param ?array $fields
*
* @return $this
* @return $this
*/
public function from($target, array $fields = null)
public function from($target, ?array $fields = null)
{
$this->target = $target;
if ($fields !== null) {

View file

@ -37,12 +37,12 @@ class SimpleTree implements IteratorAggregate
/**
* Add a child node
*
* @param TreeNode $child
* @param TreeNode $parent
* @param TreeNode $child
* @param ?TreeNode $parent
*
* @return $this
*/
public function addChild(TreeNode $child, TreeNode $parent = null)
public function addChild(TreeNode $child, ?TreeNode $parent = null)
{
if ($parent === null) {
$parent = $this->sentinel;

View file

@ -14,11 +14,11 @@ interface Updatable
/**
* Update the target with the given data and optionally limit the affected entries by using a filter
*
* @param string $target
* @param array $data
* @param Filter $filter
* @param string $target
* @param array $data
* @param ?Filter $filter
*
* @throws StatementException
* @throws StatementException
*/
public function update($target, array $data, Filter $filter = null);
public function update($target, array $data, ?Filter $filter = null);
}

View file

@ -416,12 +416,12 @@ class LdapConnection implements Selectable, Inspectable
/**
* Retrieve an array containing all rows of the result set
*
* @param LdapQuery $query The query returning the result set
* @param array $fields Request these attributes instead of the ones registered in the given query
* @param LdapQuery $query The query returning the result set
* @param ?array $fields Request these attributes instead of the ones registered in the given query
*
* @return array
* @return array
*/
public function fetchAll(LdapQuery $query, array $fields = null)
public function fetchAll(LdapQuery $query, ?array $fields = null)
{
$this->bind();
@ -435,12 +435,12 @@ class LdapConnection implements Selectable, Inspectable
/**
* Fetch the first row of the result set
*
* @param LdapQuery $query The query returning the result set
* @param array $fields Request these attributes instead of the ones registered in the given query
* @param LdapQuery $query The query returning the result set
* @param ?array $fields Request these attributes instead of the ones registered in the given query
*
* @return mixed
* @return mixed
*/
public function fetchRow(LdapQuery $query, array $fields = null)
public function fetchRow(LdapQuery $query, ?array $fields = null)
{
$clonedQuery = clone $query;
$clonedQuery->limit(1);
@ -452,14 +452,14 @@ class LdapConnection implements Selectable, Inspectable
/**
* Fetch the first column of all rows of the result set as an array
*
* @param LdapQuery $query The query returning the result set
* @param array $fields Request these attributes instead of the ones registered in the given query
* @param LdapQuery $query The query returning the result set
* @param ?array $fields Request these attributes instead of the ones registered in the given query
*
* @return array
* @return array
*
* @throws ProgrammingError In case no attribute is being requested
* @throws ProgrammingError In case no attribute is being requested
*/
public function fetchColumn(LdapQuery $query, array $fields = null)
public function fetchColumn(LdapQuery $query, ?array $fields = null)
{
if ($fields === null) {
$fields = $query->getColumns();
@ -485,12 +485,12 @@ class LdapConnection implements Selectable, Inspectable
/**
* Fetch the first column of the first row of the result set
*
* @param LdapQuery $query The query returning the result set
* @param array $fields Request these attributes instead of the ones registered in the given query
* @param LdapQuery $query The query returning the result set
* @param ?array $fields Request these attributes instead of the ones registered in the given query
*
* @return string
* @return string
*/
public function fetchOne(LdapQuery $query, array $fields = null)
public function fetchOne(LdapQuery $query, ?array $fields = null)
{
$row = $this->fetchRow($query, $fields);
if ($row === false) {
@ -521,14 +521,14 @@ class LdapConnection implements Selectable, Inspectable
*
* The first column is the key, the second column is the value.
*
* @param LdapQuery $query The query returning the result set
* @param array $fields Request these attributes instead of the ones registered in the given query
* @param LdapQuery $query The query returning the result set
* @param ?array $fields Request these attributes instead of the ones registered in the given query
*
* @return array
* @return array
*
* @throws ProgrammingError In case there are less than two attributes being requested
* @throws ProgrammingError In case there are less than two attributes being requested
*/
public function fetchPairs(LdapQuery $query, array $fields = null)
public function fetchPairs(LdapQuery $query, ?array $fields = null)
{
if ($fields === null) {
$fields = $query->getColumns();
@ -567,12 +567,12 @@ class LdapConnection implements Selectable, Inspectable
/**
* Fetch an LDAP entry by its DN
*
* @param string $dn
* @param array|null $fields
* @param string $dn
* @param ?array $fields
*
* @return StdClass|bool
*/
public function fetchByDn($dn, array $fields = null)
public function fetchByDn($dn, ?array $fields = null)
{
return $this->select()
->from('*', $fields)
@ -721,14 +721,14 @@ class LdapConnection implements Selectable, Inspectable
/**
* Run the given LDAP query and return the resulting entries
*
* @param LdapQuery $query The query to fetch results with
* @param array $fields Request these attributes instead of the ones registered in the given query
* @param LdapQuery $query The query to fetch results with
* @param ?array $fields Request these attributes instead of the ones registered in the given query
*
* @return array
* @return array
*
* @throws LdapException In case an error occured while fetching the results
* @throws LdapException In case an error occured while fetching the results
*/
protected function runQuery(LdapQuery $query, array $fields = null)
protected function runQuery(LdapQuery $query, ?array $fields = null)
{
$limit = $query->getLimit();
$offset = $query->hasOffset() ? $query->getOffset() : 0;
@ -852,15 +852,15 @@ class LdapConnection implements Selectable, Inspectable
*
* This utilizes paged search requests as defined in RFC 2696.
*
* @param LdapQuery $query The query to fetch results with
* @param array $fields Request these attributes instead of the ones registered in the given query
* @param int $pageSize The maximum page size, defaults to self::PAGE_SIZE
* @param LdapQuery $query The query to fetch results with
* @param ?array $fields Request these attributes instead of the ones registered in the given query
* @param int $pageSize The maximum page size, defaults to self::PAGE_SIZE
*
* @return array
* @return array
*
* @throws LdapException In case an error occured while fetching the results
* @throws LdapException In case an error occured while fetching the results
*/
protected function runPagedQuery(LdapQuery $query, array $fields = null, $pageSize = null)
protected function runPagedQuery(LdapQuery $query, ?array $fields = null, $pageSize = null)
{
if ($pageSize === null) {
$pageSize = static::PAGE_SIZE;
@ -1202,11 +1202,11 @@ class LdapConnection implements Selectable, Inspectable
/**
* Prepare and establish a connection with the LDAP server
*
* @param ?Inspection $info Optional inspection to fill with diagnostic info
* @param ?Inspection $info Optional inspection to fill with diagnostic info
*
* @throws LdapException In case the connection is not possible
* @throws LdapException In case the connection is not possible
*/
protected function prepareNewConnection(Inspection $info = null)
protected function prepareNewConnection(?Inspection $info = null)
{
if (! isset($info)) {
$info = new Inspection('');
@ -1249,19 +1249,19 @@ class LdapConnection implements Selectable, Inspectable
/**
* Perform a LDAP search and return the result or false on error
*
* @param LdapQuery $query
* @param array $attributes An array of the required attributes
* @param int $attrsonly Should be set to 1 if only attribute types are wanted
* @param int $sizelimit Enables you to limit the count of entries fetched
* @param int $timelimit Sets the number of seconds how long is spend on the search
* @param int $deref
* @param array $controls LDAP Controls to send with the request (Only supported with PHP v7.3+)
* @param LdapQuery $query
* @param ?array $attributes An array of the required attributes
* @param int $attrsonly Should be set to 1 if only attribute types are wanted
* @param int $sizelimit Enables you to limit the count of entries fetched
* @param int $timelimit Sets the number of seconds how long is spend on the search
* @param int $deref
* @param array $controls LDAP Controls to send with the request (Only supported with PHP v7.3+)
*
* @throws LogicException If the LDAP query search scope is unsupported
* @throws LogicException If the LDAP query search scope is unsupported
*/
public function ldapSearch(
LdapQuery $query,
array $attributes = null,
?array $attributes = null,
$attrsonly = 0,
$sizelimit = 0,
$timelimit = 0,

View file

@ -178,7 +178,7 @@ class LdapQuery extends SimpleQuery
*
* {@inheritdoc} This creates an objectClass filter.
*/
public function from($target, array $fields = null)
public function from($target, ?array $fields = null)
{
$this->where('objectClass', $target);
return parent::from($target, $fields);

View file

@ -415,14 +415,14 @@ abstract class DbRepository extends Repository implements Extensible, Updatable,
* Pass an array with a column name (the same as in $bind) and a PDO::PARAM_* constant as value
* as fourth parameter $types to define a different type than string for a particular column.
*
* @param string $table
* @param array $bind
* @param Filter $filter
* @param array $types
* @param string $table
* @param array $bind
* @param ?Filter $filter
* @param array $types
*
* @return int The number of affected rows
* @return int The number of affected rows
*/
public function update($table, array $bind, Filter $filter = null, array $types = array())
public function update($table, array $bind, ?Filter $filter = null, array $types = array())
{
$realTable = $this->clearTableAlias($this->requireTable($table));
@ -441,12 +441,12 @@ abstract class DbRepository extends Repository implements Extensible, Updatable,
/**
* Delete table rows, optionally limited by using a filter
*
* @param string $table
* @param Filter $filter
* @param string $table
* @param ?Filter $filter
*
* @return int The number of affected rows
* @return int The number of affected rows
*/
public function delete($table, Filter $filter = null)
public function delete($table, ?Filter $filter = null)
{
$realTable = $this->clearTableAlias($this->requireTable($table));
@ -627,17 +627,17 @@ abstract class DbRepository extends Repository implements Extensible, Updatable,
* If a query column or a filter column, which is part of a query filter, needs to be converted,
* you'll need to pass $query, otherwise the column is considered a statement column.
*
* @param string $table The datasource's table
* @param string $name The alias or column name for which to return a conversion method
* @param string $context The context of the conversion: persist or retrieve
* @param RepositoryQuery $query If given the column is considered a query column,
* statement column otherwise
* @param string $table The datasource's table
* @param string $name The alias or column name for which to return a conversion method
* @param string $context The context of the conversion: persist or retrieve
* @param ?RepositoryQuery $query If given the column is considered a query column,
* statement column otherwise
*
* @return string
* @return string
*
* @throws ProgrammingError In case a conversion rule is found but not any conversion method
* @throws ProgrammingError In case a conversion rule is found but not any conversion method
*/
protected function getConverter($table, $name, $context, RepositoryQuery $query = null)
protected function getConverter($table, $name, $context, ?RepositoryQuery $query = null)
{
if ($name instanceof Zend_Db_Expr) {
return;
@ -668,15 +668,15 @@ abstract class DbRepository extends Repository implements Extensible, Updatable,
*
* This will prepend the datasource's table prefix and will apply the table's alias, if any.
*
* @param string $table The table to validate
* @param RepositoryQuery $query An optional query to pass as context
* (unused by the base implementation)
* @param string $table The table to validate
* @param ?RepositoryQuery $query An optional query to pass as context
* (unused by the base implementation)
*
* @return array|string
* @return array|string
*
* @throws ProgrammingError In case the given table does not exist
* @throws ProgrammingError In case the given table does not exist
*/
public function requireTable($table, RepositoryQuery $query = null)
public function requireTable($table, ?RepositoryQuery $query = null)
{
$virtualTable = null;
$statementColumns = $this->getStatementColumns();
@ -740,17 +740,17 @@ abstract class DbRepository extends Repository implements Extensible, Updatable,
* Attempts to join the given column from a different table if its association to the given table cannot be
* verified.
*
* @param string $table The table where to look for the column or alias
* @param string $name The name or alias of the column to validate
* @param RepositoryQuery $query An optional query to pass as context,
* if not given no join will be attempted
* @param string $table The table where to look for the column or alias
* @param string $name The name or alias of the column to validate
* @param ?RepositoryQuery $query An optional query to pass as context,
* if not given no join will be attempted
*
* @return string The given column's name
* @return string The given column's name
*
* @throws QueryException In case the given column is not a valid query column
* @throws ProgrammingError In case the given column is not found in $table and cannot be joined in
* @throws QueryException In case the given column is not a valid query column
* @throws ProgrammingError In case the given column is not found in $table and cannot be joined in
*/
public function requireQueryColumn($table, $name, RepositoryQuery $query = null)
public function requireQueryColumn($table, $name, ?RepositoryQuery $query = null)
{
if ($name instanceof Zend_Db_Expr) {
return $name;
@ -789,18 +789,18 @@ abstract class DbRepository extends Repository implements Extensible, Updatable,
* verified. In case of a PostgreSQL connection and if a COLLATE SQL-instruction is part of the resolved column,
* this applies LOWER() on the column and, if given, strtolower() on the filter's expression.
*
* @param string $table The table where to look for the column or alias
* @param string $name The name or alias of the column to validate
* @param RepositoryQuery $query An optional query to pass as context,
* if not given the column is considered being used for a statement filter
* @param FilterExpression $filter An optional filter to pass as context
* @param string $table The table where to look for the column or alias
* @param string $name The name or alias of the column to validate
* @param ?RepositoryQuery $query An optional query to pass as context,
* if not given the column is considered being used for a statement filter
* @param ?FilterExpression $filter An optional filter to pass as context
*
* @return string The given column's name
* @return string The given column's name
*
* @throws QueryException In case the given column is not a valid filter column
* @throws ProgrammingError In case the given column is not found in $table and cannot be joined in
* @throws QueryException In case the given column is not a valid filter column
* @throws ProgrammingError In case the given column is not found in $table and cannot be joined in
*/
public function requireFilterColumn($table, $name, RepositoryQuery $query = null, FilterExpression $filter = null)
public function requireFilterColumn($table, $name, ?RepositoryQuery $query = null, ?FilterExpression $filter = null)
{
if ($name instanceof Zend_Db_Expr) {
return $name;

View file

@ -59,11 +59,11 @@ abstract class IniRepository extends Repository implements Extensible, Updatable
/**
* Create a new INI repository object
*
* @param Config|null $ds The data source to use
* @param ?Config $ds The data source to use
*
* @throws ProgrammingError In case the given data source does not provide a valid key column
* @throws ProgrammingError In case the given data source does not provide a valid key column
*/
public function __construct(Config $ds = null)
public function __construct(?Config $ds = null)
{
parent::__construct($ds); // First! Due to init().
@ -263,13 +263,13 @@ abstract class IniRepository extends Repository implements Extensible, Updatable
/**
* Update the target with the given data and optionally limit the affected entries by using a filter
*
* @param string $target
* @param array $data
* @param Filter $filter
* @param string $target
* @param array $data
* @param ?Filter $filter
*
* @throws StatementException In case the operation has failed
* @throws StatementException In case the operation has failed
*/
public function update($target, array $data, Filter $filter = null)
public function update($target, array $data, ?Filter $filter = null)
{
$ds = $this->getDataSource($target);
$newData = $this->requireStatementColumns($target, $data);
@ -338,12 +338,12 @@ abstract class IniRepository extends Repository implements Extensible, Updatable
/**
* Delete entries in the given target, optionally limiting the affected entries by using a filter
*
* @param string $target
* @param Filter $filter
* @param string $target
* @param ?Filter $filter
*
* @throws StatementException In case the operation has failed
* @throws StatementException In case the operation has failed
*/
public function delete($target, Filter $filter = null)
public function delete($target, ?Filter $filter = null)
{
$ds = $this->getDataSource($target);

View file

@ -216,10 +216,10 @@ abstract class Repository implements Selectable
/**
* Create a new repository object
*
* @param Selectable|null $ds The datasource to use.
* Only pass null if you have overridden {@link getDataSource()}!
* @param ?Selectable $ds The datasource to use.
* Only pass null if you have overridden {@link getDataSource()}!
*/
public function __construct(Selectable $ds = null)
public function __construct(?Selectable $ds = null)
{
$this->ds = $ds;
$this->aliasTableMap = array();
@ -694,11 +694,11 @@ abstract class Repository implements Selectable
/**
* Return a new query for the given columns
*
* @param array $columns The desired columns, if null all columns will be queried
* @param ?array $columns The desired columns, if null all columns will be queried
*
* @return RepositoryQuery
* @return RepositoryQuery
*/
public function select(array $columns = null)
public function select(?array $columns = null)
{
$query = new RepositoryQuery($this);
$query->from($this->getBaseTable(), $columns);
@ -733,16 +733,16 @@ abstract class Repository implements Selectable
/**
* Convert a value supposed to be transmitted to the data source
*
* @param string $table The table where to persist the value
* @param string $name The alias or column name
* @param mixed $value The value to convert
* @param RepositoryQuery $query An optional query to pass as context
* (Directly passed through to $this->getConverter)
* @param string $table The table where to persist the value
* @param string $name The alias or column name
* @param mixed $value The value to convert
* @param ?RepositoryQuery $query An optional query to pass as context
* (Directly passed through to $this->getConverter)
*
* @return mixed If conversion was possible, the converted value,
* otherwise the unchanged value
* @return mixed If conversion was possible, the converted value,
* otherwise the unchanged value
*/
public function persistColumn($table, $name, $value, RepositoryQuery $query = null)
public function persistColumn($table, $name, $value, ?RepositoryQuery $query = null)
{
$converter = $this->getConverter($table, $name, 'persist', $query);
if ($converter !== null) {
@ -755,16 +755,16 @@ abstract class Repository implements Selectable
/**
* Convert a value which was fetched from the data source
*
* @param string $table The table the value has been fetched from
* @param string $name The alias or column name
* @param mixed $value The value to convert
* @param RepositoryQuery $query An optional query to pass as context
* (Directly passed through to $this->getConverter)
* @param string $table The table the value has been fetched from
* @param string $name The alias or column name
* @param mixed $value The value to convert
* @param ?RepositoryQuery $query An optional query to pass as context
* (Directly passed through to $this->getConverter)
*
* @return mixed If conversion was possible, the converted value,
* otherwise the unchanged value
* @return mixed If conversion was possible, the converted value,
* otherwise the unchanged value
*/
public function retrieveColumn($table, $name, $value, RepositoryQuery $query = null)
public function retrieveColumn($table, $name, $value, ?RepositoryQuery $query = null)
{
$converter = $this->getConverter($table, $name, 'retrieve', $query);
if ($converter !== null) {
@ -777,17 +777,17 @@ abstract class Repository implements Selectable
/**
* Return the name of the conversion method for the given alias or column name and context
*
* @param string $table The datasource's table
* @param string $name The alias or column name for which to return a conversion method
* @param string $context The context of the conversion: persist or retrieve
* @param RepositoryQuery $query An optional query to pass as context
* (unused by the base implementation)
* @param string $table The datasource's table
* @param string $name The alias or column name for which to return a conversion method
* @param string $context The context of the conversion: persist or retrieve
* @param ?RepositoryQuery $query An optional query to pass as context
* (unused by the base implementation)
*
* @return ?string
* @return ?string
*
* @throws ProgrammingError In case a conversion rule is found but not any conversion method
* @throws ProgrammingError In case a conversion rule is found but not any conversion method
*/
protected function getConverter($table, $name, $context, RepositoryQuery $query = null)
protected function getConverter($table, $name, $context, ?RepositoryQuery $query = null)
{
$conversionRules = $this->getConversionRules();
if (! isset($conversionRules[$table])) {
@ -950,15 +950,15 @@ abstract class Repository implements Selectable
/**
* Validate that the requested table exists and resolve it's real name if necessary
*
* @param string $table The table to validate
* @param RepositoryQuery $query An optional query to pass as context
* (unused by the base implementation)
* @param string $table The table to validate
* @param ?RepositoryQuery $query An optional query to pass as context
* (unused by the base implementation)
*
* @return string The table's name, may differ from the given one
* @return string The table's name, may differ from the given one
*
* @throws ProgrammingError In case the given table does not exist
* @throws ProgrammingError In case the given table does not exist
*/
public function requireTable($table, RepositoryQuery $query = null)
public function requireTable($table, ?RepositoryQuery $query = null)
{
$queryColumns = $this->getQueryColumns();
if (! isset($queryColumns[$table])) {
@ -976,15 +976,15 @@ abstract class Repository implements Selectable
/**
* Recurse the given filter, require each column for the given table and convert all values
*
* @param string $table The table being filtered
* @param Filter $filter The filter to recurse
* @param RepositoryQuery $query An optional query to pass as context
* (Directly passed through to $this->requireFilterColumn)
* @param bool $clone Whether to clone $filter first
* @param string $table The table being filtered
* @param Filter $filter The filter to recurse
* @param ?RepositoryQuery $query An optional query to pass as context
* (Directly passed through to $this->requireFilterColumn)
* @param bool $clone Whether to clone $filter first
*
* @return Filter The udpated filter
* @return Filter The udpated filter
*/
public function requireFilter($table, Filter $filter, RepositoryQuery $query = null, $clone = true)
public function requireFilter($table, Filter $filter, ?RepositoryQuery $query = null, $clone = true)
{
if ($clone) {
$filter = clone $filter;
@ -1124,15 +1124,15 @@ abstract class Repository implements Selectable
/**
* Validate that the given column is a valid query target and return it or the actual name if it's an alias
*
* @param string $table The table where to look for the column or alias
* @param string $name The name or alias of the column to validate
* @param RepositoryQuery $query An optional query to pass as context (unused by the base implementation)
* @param string $table The table where to look for the column or alias
* @param string $name The name or alias of the column to validate
* @param ?RepositoryQuery $query An optional query to pass as context (unused by the base implementation)
*
* @return string The given column's name
* @return string The given column's name
*
* @throws QueryException In case the given column is not a valid query column
* @throws QueryException In case the given column is not a valid query column
*/
public function requireQueryColumn($table, $name, RepositoryQuery $query = null)
public function requireQueryColumn($table, $name, ?RepositoryQuery $query = null)
{
if (($column = $this->resolveQueryColumnAlias($table, $name)) !== null) {
$alias = $name;
@ -1171,16 +1171,16 @@ abstract class Repository implements Selectable
/**
* Validate that the given column is a valid filter target and return it or the actual name if it's an alias
*
* @param string $table The table where to look for the column or alias
* @param string $name The name or alias of the column to validate
* @param RepositoryQuery $query An optional query to pass as context (unused by the base implementation)
* @param FilterExpression $filter An optional filter to pass as context (unused by the base implementation)
* @param string $table The table where to look for the column or alias
* @param string $name The name or alias of the column to validate
* @param ?RepositoryQuery $query An optional query to pass as context (unused by the base implementation)
* @param ?FilterExpression $filter An optional filter to pass as context (unused by the base implementation)
*
* @return string The given column's name
* @return string The given column's name
*
* @throws QueryException In case the given column is not a valid filter column
* @throws QueryException In case the given column is not a valid filter column
*/
public function requireFilterColumn($table, $name, RepositoryQuery $query = null, FilterExpression $filter = null)
public function requireFilterColumn($table, $name, ?RepositoryQuery $query = null, ?FilterExpression $filter = null)
{
if (($column = $this->resolveQueryColumnAlias($table, $name)) !== null) {
$alias = $name;

View file

@ -102,12 +102,12 @@ class RepositoryQuery implements QueryInterface, SortRules, FilterColumns, Itera
*
* This notifies the repository about each desired query column.
*
* @param mixed $target The target from which to fetch the columns
* @param array $columns If null or an empty array, all columns will be fetched
* @param mixed $target The target from which to fetch the columns
* @param ?array $columns If null or an empty array, all columns will be fetched
*
* @return $this
* @return $this
*/
public function from($target, array $columns = null)
public function from($target, ?array $columns = null)
{
$this->query = $this->repository->getDataSource($target)->select();
$this->query->from($this->repository->requireTable($target, $this));
@ -146,12 +146,12 @@ class RepositoryQuery implements QueryInterface, SortRules, FilterColumns, Itera
*
* This notifies the repository about each desired query column.
*
* @param mixed $target The target where to look for each column
* @param array $desiredColumns Pass null or an empty array to require all query columns
* @param mixed $target The target where to look for each column
* @param ?array $desiredColumns Pass null or an empty array to require all query columns
*
* @return array The desired columns indexed by their respective alias
* @return array The desired columns indexed by their respective alias
*/
protected function prepareQueryColumns($target, array $desiredColumns = null)
protected function prepareQueryColumns($target, ?array $desiredColumns = null)
{
$this->customAliases = array();
if (empty($desiredColumns)) {

View file

@ -113,14 +113,14 @@ class Controller extends ModuleActionController
*
* The widget is set on the `sortBox' view property only if the current view has not been requested as compact
*
* @param array $columns An array containing the sort columns, with the
* submit value as the key and the label as the value
* @param Sortable $query Query to apply the user chosen sort rules on
* @param array $defaults An array containing default sort directions for specific columns
* @param array $columns An array containing the sort columns, with the
* submit value as the key and the label as the value
* @param ?Sortable $query Query to apply the user chosen sort rules on
* @param ?array $defaults An array containing default sort directions for specific columns
*
* @return $this
* @return $this
*/
protected function setupSortControl(array $columns, Sortable $query = null, array $defaults = null)
protected function setupSortControl(array $columns, ?Sortable $query = null, ?array $defaults = null)
{
$request = $this->getRequest();
$sortBox = SortBox::create('sortbox-' . $request->getActionName(), $columns, $defaults);
@ -219,20 +219,20 @@ class Controller extends ModuleActionController
* $filterable->getSearchColumns() is called to provide the respective columns if $filterColumns or $searchColumns
* is not given.
*
* @param Filterable $filterable The filterable to create a filter editor for
* @param array $filterColumns The filter columns to offer to the user
* @param array $searchColumns The search columns to utilize for quick searches
* @param array $preserveParams The url parameters to preserve
* @param Filterable $filterable The filterable to create a filter editor for
* @param ?array $filterColumns The filter columns to offer to the user
* @param ?array $searchColumns The search columns to utilize for quick searches
* @param ?array $preserveParams The url parameters to preserve
*
* @return $this
* @return $this
*
* @todo Preserving and ignoring parameters should be configurable (another two method params? property magic?)
*/
protected function setupFilterControl(
Filterable $filterable,
array $filterColumns = null,
array $searchColumns = null,
array $preserveParams = null
?array $filterColumns = null,
?array $searchColumns = null,
?array $preserveParams = null
) {
$defaultPreservedParams = array(
'limit', // setupPaginationControl()

View file

@ -1149,11 +1149,11 @@ class Form extends Zend_Form
* Redirects to the url set with setRedirectUrl() upon success. See onSuccess()
* and onRequest() wherewith you can customize the processing logic.
*
* @param Request $request The request to be processed
* @param ?Request $request The request to be processed
*
* @return Request The request supposed to be processed
* @return Request The request supposed to be processed
*/
public function handleRequest(Request $request = null)
public function handleRequest(?Request $request = null)
{
if ($request === null) {
$request = $this->getRequest();
@ -1546,11 +1546,11 @@ class Form extends Zend_Form
/**
* Render this form
*
* @param Zend_View_Interface $view The view context to use
* @param ?Zend_View_Interface $view The view context to use
*
* @return string
* @return string
*/
public function render(Zend_View_Interface $view = null)
public function render(?Zend_View_Interface $view = null)
{
$this->create();
return parent::render($view);

View file

@ -43,11 +43,11 @@ class Help extends Zend_Form_Decorator_Abstract
/**
* Return the id used to identify the description associated with the decorated element
*
* @param Zend_Form_Element $element The element for which to generate a id
* @param ?Zend_Form_Element $element The element for which to generate a id
*
* @return string
* @return string
*/
public function getDescriptionId(Zend_Form_Element $element = null)
public function getDescriptionId(?Zend_Form_Element $element = null)
{
if ($this->descriptionId === null) {
$element = $element ?: $this->getElement();

View file

@ -149,10 +149,10 @@ class NavigationItem implements IteratorAggregate
/**
* Create a new NavigationItem
*
* @param string $name
* @param array $properties
* @param string $name
* @param ?array $properties
*/
public function __construct($name, array $properties = null)
public function __construct($name, ?array $properties = null)
{
$this->setName($name);
$this->children = new Navigation();

View file

@ -88,11 +88,11 @@ abstract class BadgeNavigationItemRenderer extends NavigationItemRenderer
/**
* Render the given navigation item as HTML anchor with a badge
*
* @param NavigationItem $item
* @param ?NavigationItem $item
*
* @return string
* @return string
*/
public function render(NavigationItem $item = null)
public function render(?NavigationItem $item = null)
{
if ($item === null) {
$item = $this->getItem();

View file

@ -47,9 +47,9 @@ class NavigationItemRenderer
/**
* Create a new NavigationItemRenderer
*
* @param array $options
* @param ?array $options
*/
public function __construct(array $options = null)
public function __construct(?array $options = null)
{
if (! empty($options)) {
$this->setOptions($options);
@ -161,11 +161,11 @@ class NavigationItemRenderer
/**
* Render the given navigation item as HTML anchor
*
* @param NavigationItem $item
* @param ?NavigationItem $item
*
* @return string
* @return string
*/
public function render(NavigationItem $item = null)
public function render(?NavigationItem $item = null)
{
if ($item !== null) {
$this->setItem($item);

View file

@ -188,11 +188,11 @@ class JsonResponse extends Response
/**
* Set the data for successful API requests
*
* @param array $successData
* @param ?array $successData
*
* @return $this
* @return $this
*/
public function setSuccessData(array $successData = null)
public function setSuccessData(?array $successData = null)
{
$this->successData = $successData;
$this->status = static::STATUS_SUCCESS;

View file

@ -22,11 +22,11 @@ class Session
/**
* Create the session
*
* @param BaseSession $session
* @param ?BaseSession $session
*
* @return BaseSession
* @return BaseSession
*/
public static function create(BaseSession $session = null)
public static function create(?BaseSession $session = null)
{
if ($session === null) {
self::$session = PhpSession::create();

View file

@ -36,14 +36,14 @@ class PhpSession extends Session
/**
* Create a new PHPSession object using the provided options (if any)
*
* @param array $options An optional array of ini options to set
* @param ?array $options An optional array of ini options to set
*
* @return static
* @return static
*
* @throws ConfigurationError
* @throws ConfigurationError
* @see http://php.net/manual/en/session.configuration.php
*/
public static function create(array $options = null)
public static function create(?array $options = null)
{
return version_compare(PHP_VERSION, '7.2.0') < 0 ? new self($options) : new Php72Session($options);
}
@ -51,12 +51,12 @@ class PhpSession extends Session
/**
* Create a new PHPSession object using the provided options (if any)
*
* @param array $options An optional array of ini options to set
* @param ?array $options An optional array of ini options to set
*
* @throws ConfigurationError
* @throws ConfigurationError
* @see http://php.net/manual/en/session.configuration.php
*/
public function __construct(array $options = null)
public function __construct(?array $options = null)
{
$defaultCookieOptions = array(
'use_trans_sid' => false,

View file

@ -5,7 +5,7 @@ namespace Icinga\Web\View\Helper;
class IcingaCheckbox extends \Zend_View_Helper_FormCheckbox
{
public function icingaCheckbox($name, $value = null, $attribs = null, array $checkedOptions = null)
public function icingaCheckbox($name, $value = null, $attribs = null, ?array $checkedOptions = null)
{
if (! isset($attribs['id'])) {
$attribs['id'] = $this->view->protectId('icingaCheckbox_' . $name);

View file

@ -151,11 +151,11 @@ class InlinePie extends AbstractWidget
/**
* Set the colors used by the slices of the pie chart.
*
* @param array $colors
* @param ?array $colors
*
* @return $this
* @return $this
*/
public function setColors(array $colors = null)
public function setColors(?array $colors = null)
{
$this->colors = $colors;

View file

@ -161,10 +161,10 @@ class Pane extends UserWidget
/**
* Removes all or a given list of dashlets from this pane
*
* @param array $dashlets Optional list of dashlet titles
* @param ?array $dashlets Optional list of dashlet titles
* @return Pane $this
*/
public function removeDashlets(array $dashlets = null)
public function removeDashlets(?array $dashlets = null)
{
if ($dashlets === null) {
$this->dashlets = array();

View file

@ -94,11 +94,11 @@ class FilterEditor extends AbstractWidget
/**
* Set columns to search in
*
* @param array $searchColumns
* @param ?array $searchColumns
*
* @return $this
*/
public function setSearchColumns(array $searchColumns = null)
public function setSearchColumns(?array $searchColumns = null)
{
$this->searchColumns = $searchColumns;
return $this;
@ -512,7 +512,7 @@ class FilterEditor extends AbstractWidget
}
}
protected function text(Filter $filter = null)
protected function text(?Filter $filter = null)
{
$value = $filter === null ? '' : $filter->getExpression();
if (is_array($value)) {
@ -554,7 +554,7 @@ class FilterEditor extends AbstractWidget
return $res;
}
protected function elementId($prefix, Filter $filter = null)
protected function elementId($prefix, ?Filter $filter = null)
{
if ($filter === null) {
return $prefix . '_new_' . ($this->addTo ?: '0');
@ -563,7 +563,7 @@ class FilterEditor extends AbstractWidget
}
}
protected function selectOperator(Filter $filter = null)
protected function selectOperator(?Filter $filter = null)
{
$ops = array(
'AND' => 'AND',
@ -579,7 +579,7 @@ class FilterEditor extends AbstractWidget
);
}
protected function selectSign(Filter $filter = null)
protected function selectSign(?Filter $filter = null)
{
$signs = array(
'=' => '=',
@ -598,13 +598,13 @@ class FilterEditor extends AbstractWidget
);
}
public function setColumns(array $columns = null)
public function setColumns(?array $columns = null)
{
$this->cachedColumnSelect = $columns ? $this->arrayForSelect($columns) : null;
return $this;
}
protected function selectColumn(Filter $filter = null)
protected function selectColumn(?Filter $filter = null)
{
$active = $filter === null ? null : $filter->getColumn();

View file

@ -35,7 +35,7 @@ class MigrationList extends BaseItemList
*
* @param ?MigrationForm $form
*/
public function __construct($data, MigrationForm $form = null)
public function __construct($data, ?MigrationForm $form = null)
{
parent::__construct($data);

View file

@ -66,11 +66,11 @@ class SortBox extends AbstractWidget
/**
* Create a SortBox with the entries from $sortFields
*
* @param string $name The name for the SortBox
* @param array $sortFields An array containing the columns and their labels to be displayed in the SortBox
* @param array $sortDefaults An array containing default sort directions for specific columns
* @param string $name The name for the SortBox
* @param array $sortFields An array containing the columns and their labels to be displayed in the SortBox
* @param ?array $sortDefaults An array containing default sort directions for specific columns
*/
public function __construct($name, array $sortFields, array $sortDefaults = null)
public function __construct($name, array $sortFields, ?array $sortDefaults = null)
{
$this->name = $name;
$this->sortFields = $sortFields;
@ -80,13 +80,13 @@ class SortBox extends AbstractWidget
/**
* Create a SortBox
*
* @param string $name The name for the SortBox
* @param array $sortFields An array containing the columns and their labels to be displayed in the SortBox
* @param array $sortDefaults An array containing default sort directions for specific columns
* @param string $name The name for the SortBox
* @param array $sortFields An array containing the columns and their labels to be displayed in the SortBox
* @param ?array $sortDefaults An array containing default sort directions for specific columns
*
* @return SortBox
* @return SortBox
*/
public static function create($name, array $sortFields, array $sortDefaults = null)
public static function create($name, array $sortFields, ?array $sortDefaults = null)
{
return new static($name, $sortFields, $sortDefaults);
}
@ -154,11 +154,11 @@ class SortBox extends AbstractWidget
/**
* Apply the sort rules from the given or current request on the query
*
* @param Request $request
* @param ?Request $request
*
* @return $this
* @return $this
*/
public function handleRequest(Request $request = null)
public function handleRequest(?Request $request = null)
{
if ($this->query !== null) {
if ($request === null) {

View file

@ -254,11 +254,11 @@ class Wizard
* Validate the request data using the current page, update the wizard's
* position and redirect to the page's redirect url upon success.
*
* @param Request $request The request to be processed
* @param ?Request $request The request to be processed
*
* @return Request The request supposed to be processed
* @return Request The request supposed to be processed
*/
public function handleRequest(Request $request = null)
public function handleRequest(?Request $request = null)
{
$page = $this->getCurrentPage();
@ -377,11 +377,11 @@ class Wizard
/**
* Return the direction of this wizard using the given request
*
* @param Request $request The request to use
* @param ?Request $request The request to use
*
* @return int The direction @see Wizard::FORWARD @see Wizard::BACKWARD @see Wizard::NO_CHANGE
* @return int The direction @see Wizard::FORWARD @see Wizard::BACKWARD @see Wizard::NO_CHANGE
*/
protected function getDirection(Request $request = null)
protected function getDirection(?Request $request = null)
{
if ($this->parent) {
return $this->parent->getDirection($request);

View file

@ -85,11 +85,11 @@ class AdminAccountPage extends Form
/**
* Set the user group backend configuration to use
*
* @param array $config
* @param ?array $config
*
* @return $this
* @return $this
*/
public function setGroupConfig(array $config = null)
public function setGroupConfig(?array $config = null)
{
$this->groupConfig = $config;
return $this;

View file

@ -545,15 +545,15 @@ class DbTool
/**
* Return whether the given privileges were granted
*
* @param array $privileges An array of strings with the required privilege names
* @param array $context An array describing the context for which the given privileges need to apply.
* Only one or more table names are currently supported
* @param string $username The login name for which to check the privileges,
* if NULL the current login is used
* @param array $privileges An array of strings with the required privilege names
* @param ?array $context An array describing the context for which the given privileges need to apply.
* Only one or more table names are currently supported
* @param string $username The login name for which to check the privileges,
* if NULL the current login is used
*
* @return ?bool
* @return ?bool
*/
public function checkPrivileges(array $privileges, array $context = null, $username = null)
public function checkPrivileges(array $privileges, ?array $context = null, $username = null)
{
if ($this->config['db'] === 'mysql') {
return $this->checkMysqlPrivileges($privileges, false, $context, $username);
@ -730,18 +730,18 @@ EOD;
/**
* Check whether the current user has the given privileges
*
* @param array $privileges The privilege names
* @param bool $requireGrants Only return true when all privileges can be granted to others
* @param array $context An array describing the context for which the given privileges need to apply.
* Only one or more table names are currently supported
* @param string $username The login name to which the passed privileges need to be granted
* @param array $privileges The privilege names
* @param bool $requireGrants Only return true when all privileges can be granted to others
* @param ?array $context An array describing the context for which the given privileges need to apply.
* Only one or more table names are currently supported
* @param string $username The login name to which the passed privileges need to be granted
*
* @return bool
* @return bool
*/
protected function checkMysqlPrivileges(
array $privileges,
$requireGrants = false,
array $context = null,
?array $context = null,
$username = null
) {
$mysqlPrivileges = array_intersect($privileges, array_keys($this->mysqlGrantContexts));
@ -835,18 +835,18 @@ EOD;
* Note that database and table specific privileges (i.e. not SUPER, CREATE and CREATEROLE) are ignored
* in case no connection to the database defined in the resource configuration has been established
*
* @param array $privileges The privilege names
* @param bool $requireGrants Only return true when all privileges can be granted to others
* @param array $context An array describing the context for which the given privileges need to apply.
* Only one or more table names are currently supported
* @param string $username The login name to which the passed privileges need to be granted
* @param array $privileges The privilege names
* @param bool $requireGrants Only return true when all privileges can be granted to others
* @param ?array $context An array describing the context for which the given privileges need to apply.
* Only one or more table names are currently supported
* @param string $username The login name to which the passed privileges need to be granted
*
* @return bool
* @return bool
*/
public function checkPgsqlPrivileges(
array $privileges,
$requireGrants = false,
array $context = null,
?array $context = null,
$username = null
) {
$privilegesGranted = true;

View file

@ -8,7 +8,7 @@ use Icinga\Test\BaseTestCase;
class TestAuditHook extends AuditHook
{
public function logMessage($time, $identity, $type, $message, array $data = null)
public function logMessage($time, $identity, $type, $message, ?array $data = null)
{
// TODO: Implement logMessage() method.
}