Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class TranscodeFilter extends php_user_filter

protected $encodingTo;

public function filter($in, $out, &$consumed, $closing)
public function filter($in, $out, &$consumed, bool $closing): int
{
while ($resource = stream_bucket_make_writeable($in)) {
if (in_array($this->encodingFrom, mb_list_encodings())) {
Expand All @@ -42,7 +42,7 @@ public function filter($in, $out, &$consumed, $closing)
return PSFS_PASS_ON;
}

public function onCreate()
public function onCreate(): bool
{
if (strpos($this->filtername, self::FILTER_NAME) !== 0) {
return false;
Expand Down Expand Up @@ -70,7 +70,7 @@ public function onCreate()
return true;
}

public function onClose()
public function onClose(): void
{
setlocale(LC_CTYPE, $this->params['locale']);
}
Expand Down
6 changes: 3 additions & 3 deletions modules/backend/classes/FilterScope.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,12 @@ public function __construct($scopeName, $label)
* Specifies a scope control rendering mode. Supported modes are:
* - group - filter by a group of IDs. Default.
* - checkbox - filter by a simple toggle switch.
* @param string $type Specifies a render mode as described above
* @param string|null $type Specifies a render mode as described above
* @param array $config A list of render mode specific config.
*/
public function displayAs($type, $config = [])
public function displayAs(?string $type, $config = [])
{
$this->type = strtolower($type) ?: $this->type;
$this->type = strtolower($type ?? '') ?: $this->type;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why would this be allowed to be called without an argument for type present?

$this->config = $this->evalConfig($config);
return $this;
}
Expand Down
6 changes: 3 additions & 3 deletions modules/backend/classes/FormField.php
Original file line number Diff line number Diff line change
Expand Up @@ -254,17 +254,17 @@ public function options($value = null)
* - checkbox - creates a single checkbox.
* - checkboxlist - creates a checkbox list.
* - switch - creates a switch field.
* @param string $type Specifies a render mode as described above
* @param string|null $type Specifies a render mode as described above
* @param array $config A list of render mode specific config.
*/
public function displayAs($type, $config = [])
public function displayAs(?string $type, $config = [])
{
if (in_array($type, ['textarea', 'widget'])) {
// defaults to 'large'
$this->size = 'large';
}

$this->type = strtolower($type) ?: $this->type;
$this->type = strtolower($type ?? '') ?: $this->type;
$this->config = $this->evalConfig($config);

return $this;
Expand Down
6 changes: 3 additions & 3 deletions modules/backend/classes/ListColumn.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,11 @@ public function __construct($columnName, $label)
* Specifies a list column rendering mode. Supported modes are:
* - text - text column, aligned left
* - number - numeric column, aligned right
* @param string $type Specifies a render mode as described above
* @param string|null $type Specifies a render mode as described above
*/
public function displayAs($type, $config)
public function displayAs(?string $type, $config)
{
$this->type = strtolower($type) ?: $this->type;
$this->type = strtolower($type ?? '') ?: $this->type;
$this->config = $this->evalConfig($config);
return $this;
}
Expand Down
Loading