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

Commit 5dfcb5f

Browse files
committed
qa: use 7.1 features on new code
Updates new methods of Date validator and its tests to use typehints. Updates license docblock year range.
1 parent 1fd37b9 commit 5dfcb5f

File tree

2 files changed

+5
-23
lines changed

2 files changed

+5
-23
lines changed

src/Date.php

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Zend Framework (http://framework.zend.com/)
44
*
55
* @link http://github.com/zendframework/zf2 for the canonical source repository
6-
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
6+
* @copyright Copyright (c) 2005-2019 Zend Technologies USA Inc. (http://www.zend.com)
77
* @license http://framework.zend.com/license/new-bsd New BSD License
88
*/
99

@@ -105,28 +105,13 @@ public function setFormat($format = self::FORMAT_DEFAULT)
105105
return $this;
106106
}
107107

108-
/**
109-
* @param bool $strict
110-
* @return $this
111-
*/
112-
public function setStrict($strict)
108+
public function setStrict(bool $strict) : self
113109
{
114-
if (! is_bool($strict)) {
115-
throw new Exception\InvalidArgumentException(sprintf(
116-
'Expected boolean value; %s received',
117-
is_object($strict) ? get_class($strict) : gettype($strict)
118-
));
119-
}
120-
121110
$this->strict = $strict;
122-
123111
return $this;
124112
}
125113

126-
/**
127-
* @return bool
128-
*/
129-
public function isStrict()
114+
public function isStrict() : bool
130115
{
131116
return $this->strict;
132117
}

test/DateTest.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Zend Framework (http://framework.zend.com/)
44
*
55
* @link http://github.com/zendframework/zf2 for the canonical source repository
6-
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
6+
* @copyright Copyright (c) 2005-2019 Zend Technologies USA Inc. (http://www.zend.com)
77
* @license http://framework.zend.com/license/new-bsd New BSD License
88
*/
99

@@ -111,11 +111,8 @@ public function testBasic($input, $format, $result)
111111
* @dataProvider datesDataProvider
112112
*
113113
* @param mixed $input
114-
* @param string|null $format
115-
* @param bool $result
116-
* @param bool $resultStrict
117114
*/
118-
public function testBasicStrictMode($input, $format, $result, $resultStrict)
115+
public function testBasicStrictMode($input, ?string $format, bool $result, bool $resultStrict) : void
119116
{
120117
$this->validator->setStrict(true);
121118
$this->validator->setFormat($format);

0 commit comments

Comments
 (0)