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

Commit

Permalink
qa: use 7.1 features on new code
Browse files Browse the repository at this point in the history
Updates new methods of Date validator and its tests to use typehints.

Updates license docblock year range.
  • Loading branch information
weierophinney committed Dec 28, 2019
1 parent 1fd37b9 commit 5dfcb5f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 23 deletions.
21 changes: 3 additions & 18 deletions src/Date.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2019 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand Down Expand Up @@ -105,28 +105,13 @@ public function setFormat($format = self::FORMAT_DEFAULT)
return $this;
}

/**
* @param bool $strict
* @return $this
*/
public function setStrict($strict)
public function setStrict(bool $strict) : self
{
if (! is_bool($strict)) {
throw new Exception\InvalidArgumentException(sprintf(
'Expected boolean value; %s received',
is_object($strict) ? get_class($strict) : gettype($strict)
));
}

$this->strict = $strict;

return $this;
}

/**
* @return bool
*/
public function isStrict()
public function isStrict() : bool
{
return $this->strict;
}
Expand Down
7 changes: 2 additions & 5 deletions test/DateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2019 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand Down Expand Up @@ -111,11 +111,8 @@ public function testBasic($input, $format, $result)
* @dataProvider datesDataProvider
*
* @param mixed $input
* @param string|null $format
* @param bool $result
* @param bool $resultStrict
*/
public function testBasicStrictMode($input, $format, $result, $resultStrict)
public function testBasicStrictMode($input, ?string $format, bool $result, bool $resultStrict) : void
{
$this->validator->setStrict(true);
$this->validator->setFormat($format);
Expand Down

0 comments on commit 5dfcb5f

Please sign in to comment.