Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Commit

Permalink
Minor consistency fixes for #69
Browse files Browse the repository at this point in the history
- Modifies `$options` declaration to use `array<string, string|null>`
  for the type.
- No parens needed around ternary statements as argument values.
- Add space after casting operators.
  • Loading branch information
weierophinney committed Dec 12, 2018
1 parent 717968e commit 20bede6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
9 changes: 4 additions & 5 deletions src/StringPrefix.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
class StringPrefix extends AbstractFilter
{
/**
* @var string[]
* @var array<string, null|string>
*/
protected $options = [
'prefix' => null,
Expand All @@ -31,8 +31,7 @@ public function __construct($options = null)
/**
* Set the prefix string
*
* @param string $prefix
*
* @param string $prefix
* @return self
* @throws Exception\InvalidArgumentException
*/
Expand All @@ -42,7 +41,7 @@ public function setPrefix($prefix)
throw new Exception\InvalidArgumentException(sprintf(
'%s expects "prefix" to be string; received "%s"',
__METHOD__,
(is_object($prefix) ? get_class($prefix) : gettype($prefix))
is_object($prefix) ? get_class($prefix) : gettype($prefix)
));
}

Expand Down Expand Up @@ -77,7 +76,7 @@ public function filter($value)
return $value;
}

$value = (string)$value;
$value = (string) $value;

return $this->getPrefix() . $value;
}
Expand Down
6 changes: 3 additions & 3 deletions src/StringSuffix.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
class StringSuffix extends AbstractFilter
{
/**
* @var string[]
* @var array<string, string|null>
*/
protected $options = [
'suffix' => null,
Expand Down Expand Up @@ -42,7 +42,7 @@ public function setSuffix($suffix)
throw new Exception\InvalidArgumentException(sprintf(
'%s expects "suffix" to be string; received "%s"',
__METHOD__,
(is_object($suffix) ? get_class($suffix) : gettype($suffix))
is_object($suffix) ? get_class($suffix) : gettype($suffix)
));
}

Expand Down Expand Up @@ -78,7 +78,7 @@ public function filter($value)
return $value;
}

$value = (string)$value;
$value = (string) $value;

return $value . $this->getSuffix();
}
Expand Down

0 comments on commit 20bede6

Please sign in to comment.