Skip to content

Commit

Permalink
Merge pull request #154 from harikt/initial
Browse files Browse the repository at this point in the history
Changes in types
  • Loading branch information
harikt authored Apr 30, 2022
2 parents 3e00cf6 + 765a5f7 commit fe17f03
Show file tree
Hide file tree
Showing 17 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/Rule/Sanitize/Strlen.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class Strlen extends AbstractStrlen
* @return bool True if the value was sanitized, false if not.
*
*/
public function __invoke(object $subject, string $field, $len, $pad_string = ' ', $pad_type = STR_PAD_RIGHT): bool
public function __invoke(object $subject, string $field, $len, string $pad_string = ' ', int $pad_type = STR_PAD_RIGHT): bool
{
$value = $subject->$field;
if (! is_scalar($value)) {
Expand Down
2 changes: 1 addition & 1 deletion src/Rule/Sanitize/StrlenBetween.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class StrlenBetween extends AbstractStrlen
* @return bool True if the value was sanitized, false if not.
*
*/
public function __invoke(object $subject, string $field, $min, $max, $pad_string = ' ', $pad_type = STR_PAD_RIGHT): bool
public function __invoke(object $subject, string $field, int $min, int $max, string $pad_string = ' ', int $pad_type = STR_PAD_RIGHT): bool
{
$value = $subject->$field;
if (! is_scalar($value)) {
Expand Down
2 changes: 1 addition & 1 deletion src/Rule/Sanitize/StrlenMax.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class StrlenMax extends AbstractStrlen
* @return bool True if the value was sanitized, false if not.
*
*/
public function __invoke(object $subject, string $field, $max): bool
public function __invoke(object $subject, string $field, int $max): bool
{
$value = $subject->$field;
if (! is_scalar($value)) {
Expand Down
2 changes: 1 addition & 1 deletion src/Rule/Sanitize/StrlenMin.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class StrlenMin extends AbstractStrlen
* @return bool True if the value was sanitized, false if not.
*
*/
public function __invoke(object $subject, string $field, $min, $pad_string = ' ', $pad_type = STR_PAD_RIGHT): bool
public function __invoke(object $subject, string $field, int $min, string $pad_string = ' ', int $pad_type = STR_PAD_RIGHT): bool
{
$value = $subject->$field;
if (! is_scalar($value)) {
Expand Down
2 changes: 1 addition & 1 deletion src/Rule/Sanitize/Trim.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Trim
* @return bool True if the value was sanitized, false if not.
*
*/
public function __invoke(object $subject, string $field, $chars = " \t\n\r\0\x0B"): bool
public function __invoke(object $subject, string $field, string $chars = " \t\n\r\0\x0B"): bool
{
$value = $subject->$field;
if (is_scalar($value) || $value === null) {
Expand Down
4 changes: 2 additions & 2 deletions src/Rule/Validate/Between.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ class Between
*
* @param string $field The subject field name.
*
* @param mixed $min The minimum valid value.
* @param int $min The minimum valid value.
*
* @param mixed $max The maximum valid value.
* @param int $max The maximum valid value.
*
* @return bool True if valid, false if not.
*
Expand Down
2 changes: 1 addition & 1 deletion src/Rule/Validate/EqualToField.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class EqualToField
* @return bool True if the values are equal, false if not equal.
*
*/
public function __invoke(object $subject, string $field, $other_field): bool
public function __invoke(object $subject, string $field, string $other_field): bool
{
// the other field needs to exist and *not* be null
if (! isset($subject->$other_field)) {
Expand Down
2 changes: 1 addition & 1 deletion src/Rule/Validate/Ip.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Ip
*
* @param string $field The subject field name.
*
* @param mixed $flags `FILTER_VALIDATE_IP` flags to pass to filter_var();
* @param array|int $flags `FILTER_VALIDATE_IP` flags to pass to filter_var();
* cf. <http://php.net/manual/en/filter.filters.flags.php>.
*
* @return bool True if valid, false if not.
Expand Down
2 changes: 1 addition & 1 deletion src/Rule/Validate/Max.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Max
*
* @param string $field The subject field name.
*
* @param mixed $max The maximum valid value.
* @param int|float $max The maximum valid value.
*
* @return bool True if valid, false if not.
*
Expand Down
2 changes: 1 addition & 1 deletion src/Rule/Validate/Min.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Min
*
* @param string $field The subject field name.
*
* @param mixed $min The minimum valid value.
* @param int|float $min The minimum valid value.
*
* @return bool True if valid, false if not.
*
Expand Down
2 changes: 1 addition & 1 deletion src/Rule/Validate/StrictEqualToField.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class StrictEqualToField
* @return bool True if the values are equal, false if not equal.
*
*/
public function __invoke(object $subject, string $field, $other_field): bool
public function __invoke(object $subject, string $field, string $other_field): bool
{
// the other field needs to exist and *not* be null
if (! isset($subject->$other_field)) {
Expand Down
2 changes: 1 addition & 1 deletion src/Rule/Validate/StrictEqualToValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class StrictEqualToValue
* @return bool True if the values are equal, false if not equal.
*
*/
public function __invoke(object $subject, string $field, $other_value): bool
public function __invoke(object $subject, string $field, string $other_value): bool
{
return $subject->$field === $other_value;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Rule/Validate/Strlen.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ class Strlen extends AbstractStrlen
*
* @param string $field The subject field name.
*
* @param mixed $len The minimum valid length.
* @param int $len String length equal to length.
*
* @return bool True if valid, false if not.
*
*/
public function __invoke(object $subject, string $field, $len): bool
public function __invoke(object $subject, string $field, int $len): bool
{
$value = $subject->$field;
if (! is_scalar($value)) {
Expand Down
4 changes: 2 additions & 2 deletions src/Rule/Validate/StrlenBetween.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ class StrlenBetween extends AbstractStrlen
*
* @param string $field The subject field name.
*
* @param mixed $min The minimum valid length.
* @param int|float $min The minimum valid length.
*
* @param mixed $max The maximum valid length.
* @param int|float $max The maximum valid length.
*
* @return bool True if valid, false if not.
*
Expand Down
2 changes: 1 addition & 1 deletion src/Rule/Validate/StrlenMax.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class StrlenMax extends AbstractStrlen
*
* @param string $field The subject field name.
*
* @param mixed $max The value must have no more than this many
* @param int|float $max The value must have no more than this many
* characters.
*
* @return bool True if valid, false if not.
Expand Down
2 changes: 1 addition & 1 deletion src/Rule/Validate/StrlenMin.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class StrlenMin extends AbstractStrlen
*
* @param string $field The subject field name.
*
* @param mixed $min The value must have at least this many characters.
* @param int|float $min The value must have at least this many characters.
*
* @return bool True if valid, false if not.
*
Expand Down
2 changes: 1 addition & 1 deletion src/Rule/Validate/Trim.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Trim
* @return bool True if valid, false if not.
*
*/
public function __invoke(object $subject, string $field, $chars = " \t\n\r\0\x0B"): bool
public function __invoke(object $subject, string $field, string $chars = " \t\n\r\0\x0B"): bool
{
$value = $subject->$field;
if (! is_scalar($value)) {
Expand Down

0 comments on commit fe17f03

Please sign in to comment.