From eded4bd583297e43c63cf8087e9e12e18552309a Mon Sep 17 00:00:00 2001 From: Philipp Scheit
toString or
* __toString() method returns a value equalTo the specified string.
*/
- function hasToString($matcher)
+ function hasToString($matcher): \Hamcrest\Core\HasToString
{
return \Hamcrest\Core\HasToString::hasToString($matcher);
}
@@ -329,8 +336,9 @@ function hasToString($matcher)
*
* For example: assertThat($cheese, equalTo($smelly))
* vs. assertThat($cheese, is(equalTo($smelly)))
+ * @param mixed $value
*/
- function is($value)
+ function is($value): \Hamcrest\Core\Is
{
return \Hamcrest\Core\Is::is($value);
}
@@ -344,7 +352,7 @@ function is($value)
*
* @return \Hamcrest\Core\IsAnything
*/
- function anything($description = 'ANYTHING')
+ function anything(string $description = 'ANYTHING'): \Hamcrest\Core\IsAnything
{
return \Hamcrest\Core\IsAnything::anything($description);
}
@@ -361,7 +369,7 @@ function anything($description = 'ANYTHING')
* assertThat(array('a', 'b'), hasItem('b'));
*
*/
- function hasItem(/* args... */)
+ function hasItem(/* args... */): \Hamcrest\Core\IsCollectionContaining
{
$args = func_get_args();
return call_user_func_array(array('\Hamcrest\Core\IsCollectionContaining', 'hasItem'), $args);
@@ -378,7 +386,7 @@ function hasItem(/* args... */)
* assertThat(array('a', 'b', 'c'), hasItems(equalTo('a'), equalTo('b')));
*
*/
- function hasItems(/* args... */)
+ function hasItems(/* args... */): \Hamcrest\Core\AllOf
{
$args = func_get_args();
return call_user_func_array(array('\Hamcrest\Core\IsCollectionContaining', 'hasItems'), $args);
@@ -389,8 +397,9 @@ function hasItems(/* args... */)
/**
* Is the value equal to another value, as tested by the use of the "=="
* comparison operator?
+ * @param mixed $item
*/
- function equalTo($item)
+ function equalTo($item): \Hamcrest\Core\IsEqual
{
return \Hamcrest\Core\IsEqual::equalTo($item);
}
@@ -399,8 +408,9 @@ function equalTo($item)
if (!function_exists('identicalTo')) {
/**
* Tests of the value is identical to $value as tested by the "===" operator.
+ * @param mixed $value
*/
- function identicalTo($value)
+ function identicalTo($value): \Hamcrest\Core\IsIdentical
{
return \Hamcrest\Core\IsIdentical::identicalTo($value);
}
@@ -413,7 +423,7 @@ function identicalTo($value)
* the signature of the method that sets it up, for example in
* assertThat($anObject, anInstanceOf('Thing'));
*/
- function anInstanceOf($theClass)
+ function anInstanceOf(string $theClass): \Hamcrest\Core\IsInstanceOf
{
return \Hamcrest\Core\IsInstanceOf::anInstanceOf($theClass);
}
@@ -426,7 +436,7 @@ function anInstanceOf($theClass)
* the signature of the method that sets it up, for example in
* assertThat($anObject, anInstanceOf('Thing'));
*/
- function any($theClass)
+ function any(string $theClass): \Hamcrest\Core\IsInstanceOf
{
return \Hamcrest\Core\IsInstanceOf::anInstanceOf($theClass);
}
@@ -435,8 +445,9 @@ function any($theClass)
if (!function_exists('not')) {
/**
* Matches if value does not match $value.
+ * @param mixed $value
*/
- function not($value)
+ function not($value): \Hamcrest\Core\IsNot
{
return \Hamcrest\Core\IsNot::not($value);
}
@@ -446,7 +457,7 @@ function not($value)
/**
* Matches if value is null.
*/
- function nullValue()
+ function nullValue(): \Hamcrest\Core\IsNull
{
return \Hamcrest\Core\IsNull::nullValue();
}
@@ -456,7 +467,7 @@ function nullValue()
/**
* Matches if value is not null.
*/
- function notNullValue()
+ function notNullValue(): \Hamcrest\Core\IsNot
{
return \Hamcrest\Core\IsNull::notNullValue();
}
@@ -472,7 +483,7 @@ function notNullValue()
*
* @return \Hamcrest\Core\IsSame
*/
- function sameInstance($object)
+ function sameInstance($object): \Hamcrest\Core\IsSame
{
return \Hamcrest\Core\IsSame::sameInstance($object);
}
@@ -482,7 +493,7 @@ function sameInstance($object)
/**
* Is the value a particular built-in type?
*/
- function typeOf($theType)
+ function typeOf(string $theType): \Hamcrest\Core\IsTypeOf
{
return \Hamcrest\Core\IsTypeOf::typeOf($theType);
}
@@ -491,8 +502,9 @@ function typeOf($theType)
if (!function_exists('set')) {
/**
* Matches if value (class, object, or array) has named $property.
+ * @param mixed $property
*/
- function set($property)
+ function set($property): \Hamcrest\Core\Set
{
return \Hamcrest\Core\Set::set($property);
}
@@ -501,8 +513,9 @@ function set($property)
if (!function_exists('notSet')) {
/**
* Matches if value (class, object, or array) does not have named $property.
+ * @param mixed $property
*/
- function notSet($property)
+ function notSet($property): \Hamcrest\Core\Set
{
return \Hamcrest\Core\Set::notSet($property);
}
@@ -512,8 +525,10 @@ function notSet($property)
/**
* Matches if value is a number equal to $value within some range of
* acceptable error $delta.
+ * @param mixed $value
+ * @param mixed $delta
*/
- function closeTo($value, $delta)
+ function closeTo($value, $delta): \Hamcrest\Number\IsCloseTo
{
return \Hamcrest\Number\IsCloseTo::closeTo($value, $delta);
}
@@ -522,8 +537,9 @@ function closeTo($value, $delta)
if (!function_exists('comparesEqualTo')) {
/**
* The value is not > $value, nor < $value.
+ * @param mixed $value
*/
- function comparesEqualTo($value)
+ function comparesEqualTo($value): \Hamcrest\Number\OrderingComparison
{
return \Hamcrest\Number\OrderingComparison::comparesEqualTo($value);
}
@@ -532,8 +548,9 @@ function comparesEqualTo($value)
if (!function_exists('greaterThan')) {
/**
* The value is > $value.
+ * @param mixed $value
*/
- function greaterThan($value)
+ function greaterThan($value): \Hamcrest\Number\OrderingComparison
{
return \Hamcrest\Number\OrderingComparison::greaterThan($value);
}
@@ -542,8 +559,9 @@ function greaterThan($value)
if (!function_exists('greaterThanOrEqualTo')) {
/**
* The value is >= $value.
+ * @param mixed $value
*/
- function greaterThanOrEqualTo($value)
+ function greaterThanOrEqualTo($value): \Hamcrest\Number\OrderingComparison
{
return \Hamcrest\Number\OrderingComparison::greaterThanOrEqualTo($value);
}
@@ -552,8 +570,9 @@ function greaterThanOrEqualTo($value)
if (!function_exists('atLeast')) {
/**
* The value is >= $value.
+ * @param mixed $value
*/
- function atLeast($value)
+ function atLeast($value): \Hamcrest\Number\OrderingComparison
{
return \Hamcrest\Number\OrderingComparison::greaterThanOrEqualTo($value);
}
@@ -562,8 +581,9 @@ function atLeast($value)
if (!function_exists('lessThan')) {
/**
* The value is < $value.
+ * @param mixed $value
*/
- function lessThan($value)
+ function lessThan($value): \Hamcrest\Number\OrderingComparison
{
return \Hamcrest\Number\OrderingComparison::lessThan($value);
}
@@ -572,8 +592,9 @@ function lessThan($value)
if (!function_exists('lessThanOrEqualTo')) {
/**
* The value is <= $value.
+ * @param mixed $value
*/
- function lessThanOrEqualTo($value)
+ function lessThanOrEqualTo($value): \Hamcrest\Number\OrderingComparison
{
return \Hamcrest\Number\OrderingComparison::lessThanOrEqualTo($value);
}
@@ -582,8 +603,9 @@ function lessThanOrEqualTo($value)
if (!function_exists('atMost')) {
/**
* The value is <= $value.
+ * @param mixed $value
*/
- function atMost($value)
+ function atMost($value): \Hamcrest\Number\OrderingComparison
{
return \Hamcrest\Number\OrderingComparison::lessThanOrEqualTo($value);
}
@@ -593,7 +615,7 @@ function atMost($value)
/**
* Matches if value is a zero-length string.
*/
- function isEmptyString()
+ function isEmptyString(): \Hamcrest\Text\IsEmptyString
{
return \Hamcrest\Text\IsEmptyString::isEmptyString();
}
@@ -603,7 +625,7 @@ function isEmptyString()
/**
* Matches if value is a zero-length string.
*/
- function emptyString()
+ function emptyString(): \Hamcrest\Text\IsEmptyString
{
return \Hamcrest\Text\IsEmptyString::isEmptyString();
}
@@ -613,7 +635,7 @@ function emptyString()
/**
* Matches if value is null or a zero-length string.
*/
- function isEmptyOrNullString()
+ function isEmptyOrNullString(): \Hamcrest\Core\AnyOf
{
return \Hamcrest\Text\IsEmptyString::isEmptyOrNullString();
}
@@ -623,7 +645,7 @@ function isEmptyOrNullString()
/**
* Matches if value is null or a zero-length string.
*/
- function nullOrEmptyString()
+ function nullOrEmptyString(): \Hamcrest\Core\AnyOf
{
return \Hamcrest\Text\IsEmptyString::isEmptyOrNullString();
}
@@ -633,7 +655,7 @@ function nullOrEmptyString()
/**
* Matches if value is a non-zero-length string.
*/
- function isNonEmptyString()
+ function isNonEmptyString(): \Hamcrest\Text\IsEmptyString
{
return \Hamcrest\Text\IsEmptyString::isNonEmptyString();
}
@@ -643,7 +665,7 @@ function isNonEmptyString()
/**
* Matches if value is a non-zero-length string.
*/
- function nonEmptyString()
+ function nonEmptyString(): \Hamcrest\Text\IsEmptyString
{
return \Hamcrest\Text\IsEmptyString::isNonEmptyString();
}
@@ -652,8 +674,9 @@ function nonEmptyString()
if (!function_exists('equalToIgnoringCase')) {
/**
* Matches if value is a string equal to $string, regardless of the case.
+ * @param mixed $string
*/
- function equalToIgnoringCase($string)
+ function equalToIgnoringCase($string): \Hamcrest\Text\IsEqualIgnoringCase
{
return \Hamcrest\Text\IsEqualIgnoringCase::equalToIgnoringCase($string);
}
@@ -662,8 +685,9 @@ function equalToIgnoringCase($string)
if (!function_exists('equalToIgnoringWhiteSpace')) {
/**
* Matches if value is a string equal to $string, regardless of whitespace.
+ * @param mixed $string
*/
- function equalToIgnoringWhiteSpace($string)
+ function equalToIgnoringWhiteSpace($string): \Hamcrest\Text\IsEqualIgnoringWhiteSpace
{
return \Hamcrest\Text\IsEqualIgnoringWhiteSpace::equalToIgnoringWhiteSpace($string);
}
@@ -672,8 +696,9 @@ function equalToIgnoringWhiteSpace($string)
if (!function_exists('matchesPattern')) {
/**
* Matches if value is a string that matches regular expression $pattern.
+ * @param mixed $pattern
*/
- function matchesPattern($pattern)
+ function matchesPattern($pattern): \Hamcrest\Text\MatchesPattern
{
return \Hamcrest\Text\MatchesPattern::matchesPattern($pattern);
}
@@ -682,8 +707,9 @@ function matchesPattern($pattern)
if (!function_exists('containsString')) {
/**
* Matches if value is a string that contains $substring.
+ * @param mixed $substring
*/
- function containsString($substring)
+ function containsString($substring): \Hamcrest\Text\StringContains
{
return \Hamcrest\Text\StringContains::containsString($substring);
}
@@ -692,8 +718,9 @@ function containsString($substring)
if (!function_exists('containsStringIgnoringCase')) {
/**
* Matches if value is a string that contains $substring regardless of the case.
+ * @param mixed $substring
*/
- function containsStringIgnoringCase($substring)
+ function containsStringIgnoringCase($substring): \Hamcrest\Text\StringContainsIgnoringCase
{
return \Hamcrest\Text\StringContainsIgnoringCase::containsStringIgnoringCase($substring);
}
@@ -703,7 +730,7 @@ function containsStringIgnoringCase($substring)
/**
* Matches if value contains $substrings in a constrained order.
*/
- function stringContainsInOrder(/* args... */)
+ function stringContainsInOrder(/* args... */): \Hamcrest\Text\StringContainsInOrder
{
$args = func_get_args();
return call_user_func_array(array('\Hamcrest\Text\StringContainsInOrder', 'stringContainsInOrder'), $args);
@@ -713,8 +740,9 @@ function stringContainsInOrder(/* args... */)
if (!function_exists('endsWith')) {
/**
* Matches if value is a string that ends with $substring.
+ * @param mixed $substring
*/
- function endsWith($substring)
+ function endsWith($substring): \Hamcrest\Text\StringEndsWith
{
return \Hamcrest\Text\StringEndsWith::endsWith($substring);
}
@@ -723,8 +751,9 @@ function endsWith($substring)
if (!function_exists('startsWith')) {
/**
* Matches if value is a string that starts with $substring.
+ * @param mixed $substring
*/
- function startsWith($substring)
+ function startsWith($substring): \Hamcrest\Text\StringStartsWith
{
return \Hamcrest\Text\StringStartsWith::startsWith($substring);
}
@@ -734,7 +763,7 @@ function startsWith($substring)
/**
* Is the value an array?
*/
- function arrayValue()
+ function arrayValue(): \Hamcrest\Type\IsArray
{
return \Hamcrest\Type\IsArray::arrayValue();
}
@@ -744,7 +773,7 @@ function arrayValue()
/**
* Is the value a boolean?
*/
- function booleanValue()
+ function booleanValue(): \Hamcrest\Type\IsBoolean
{
return \Hamcrest\Type\IsBoolean::booleanValue();
}
@@ -754,7 +783,7 @@ function booleanValue()
/**
* Is the value a boolean?
*/
- function boolValue()
+ function boolValue(): \Hamcrest\Type\IsBoolean
{
return \Hamcrest\Type\IsBoolean::booleanValue();
}
@@ -764,7 +793,7 @@ function boolValue()
/**
* Is the value callable?
*/
- function callableValue()
+ function callableValue(): \Hamcrest\Type\IsCallable
{
return \Hamcrest\Type\IsCallable::callableValue();
}
@@ -774,7 +803,7 @@ function callableValue()
/**
* Is the value a float/double?
*/
- function doubleValue()
+ function doubleValue(): \Hamcrest\Type\IsDouble
{
return \Hamcrest\Type\IsDouble::doubleValue();
}
@@ -784,7 +813,7 @@ function doubleValue()
/**
* Is the value a float/double?
*/
- function floatValue()
+ function floatValue(): \Hamcrest\Type\IsDouble
{
return \Hamcrest\Type\IsDouble::doubleValue();
}
@@ -794,7 +823,7 @@ function floatValue()
/**
* Is the value an integer?
*/
- function integerValue()
+ function integerValue(): \Hamcrest\Type\IsInteger
{
return \Hamcrest\Type\IsInteger::integerValue();
}
@@ -804,7 +833,7 @@ function integerValue()
/**
* Is the value an integer?
*/
- function intValue()
+ function intValue(): \Hamcrest\Type\IsInteger
{
return \Hamcrest\Type\IsInteger::integerValue();
}
@@ -814,7 +843,7 @@ function intValue()
/**
* Is the value a numeric?
*/
- function numericValue()
+ function numericValue(): \Hamcrest\Type\IsNumeric
{
return \Hamcrest\Type\IsNumeric::numericValue();
}
@@ -824,7 +853,7 @@ function numericValue()
/**
* Is the value an object?
*/
- function objectValue()
+ function objectValue(): \Hamcrest\Type\IsObject
{
return \Hamcrest\Type\IsObject::objectValue();
}
@@ -834,7 +863,7 @@ function objectValue()
/**
* Is the value an object?
*/
- function anObject()
+ function anObject(): \Hamcrest\Type\IsObject
{
return \Hamcrest\Type\IsObject::objectValue();
}
@@ -844,7 +873,7 @@ function anObject()
/**
* Is the value a resource?
*/
- function resourceValue()
+ function resourceValue(): \Hamcrest\Type\IsResource
{
return \Hamcrest\Type\IsResource::resourceValue();
}
@@ -854,7 +883,7 @@ function resourceValue()
/**
* Is the value a scalar (boolean, integer, double, or string)?
*/
- function scalarValue()
+ function scalarValue(): \Hamcrest\Type\IsScalar
{
return \Hamcrest\Type\IsScalar::scalarValue();
}
@@ -864,7 +893,7 @@ function scalarValue()
/**
* Is the value a string?
*/
- function stringValue()
+ function stringValue(): \Hamcrest\Type\IsString
{
return \Hamcrest\Type\IsString::stringValue();
}
@@ -875,8 +904,10 @@ function stringValue()
* Wraps $matcher with {@link Hamcrest\Core\IsEqual)
* if it's not a matcher and the XPath in count()
* if it's an integer.
+ * @param string $xpath
+ * @param null|Matcher|int|mixed $matcher
*/
- function hasXPath($xpath, $matcher = null)
+ function hasXPath($xpath, $matcher = null): \Hamcrest\Xml\HasXPath
{
return \Hamcrest\Xml\HasXPath::hasXPath($xpath, $matcher);
}
diff --git a/hamcrest/Hamcrest/Arrays/IsArray.php b/hamcrest/Hamcrest/Arrays/IsArray.php
index 9ea569703..0d90d3860 100644
--- a/hamcrest/Hamcrest/Arrays/IsArray.php
+++ b/hamcrest/Hamcrest/Arrays/IsArray.php
@@ -10,6 +10,7 @@
// TODO: Allow this to take matchers or values within the array
use Hamcrest\Description;
+use Hamcrest\Matcher;
use Hamcrest\TypeSafeMatcher;
use Hamcrest\Util;
@@ -20,8 +21,14 @@
class IsArray extends TypeSafeMatcher
{
- private $_elementMatchers;
+ /**
+ * @var array__toString() method returns a value equalTo the specified string.
*
* @factory
+ * @param mixed $matcher
*/
- public static function hasToString($matcher)
+ public static function hasToString($matcher): self
{
return new self(Util::wrapValueWithIsEqual($matcher));
}
diff --git a/hamcrest/Hamcrest/Core/Is.php b/hamcrest/Hamcrest/Core/Is.php
index 41266dc1f..fccfe1404 100644
--- a/hamcrest/Hamcrest/Core/Is.php
+++ b/hamcrest/Hamcrest/Core/Is.php
@@ -19,24 +19,24 @@
class Is extends BaseMatcher
{
- private $_matcher;
+ private Matcher $_matcher;
public function __construct(Matcher $matcher)
{
$this->_matcher = $matcher;
}
- public function matches($arg)
+ public function matches($arg): bool
{
return $this->_matcher->matches($arg);
}
- public function describeTo(Description $description)
+ public function describeTo(Description $description): void
{
$description->appendText('is ')->appendDescriptionOf($this->_matcher);
}
- public function describeMismatch($item, Description $mismatchDescription)
+ public function describeMismatch($item, Description $mismatchDescription): void
{
$this->_matcher->describeMismatch($item, $mismatchDescription);
}
@@ -49,8 +49,9 @@ public function describeMismatch($item, Description $mismatchDescription)
* vs. assertThat($cheese, is(equalTo($smelly)))
*
* @factory
+ * @param mixed $value
*/
- public static function is($value)
+ public static function is($value): self
{
return new self(Util::wrapValueWithIsEqual($value));
}
diff --git a/hamcrest/Hamcrest/Core/IsAnything.php b/hamcrest/Hamcrest/Core/IsAnything.php
index f20e6c0dc..2b9e19dc4 100644
--- a/hamcrest/Hamcrest/Core/IsAnything.php
+++ b/hamcrest/Hamcrest/Core/IsAnything.php
@@ -13,19 +13,19 @@
class IsAnything extends BaseMatcher
{
- private $_message;
+ private string $_message;
- public function __construct($message = 'ANYTHING')
+ public function __construct(string $message = 'ANYTHING')
{
$this->_message = $message;
}
- public function matches($item)
+ public function matches($item): bool
{
return true;
}
- public function describeTo(Description $description)
+ public function describeTo(Description $description): void
{
$description->appendText($this->_message);
}
@@ -38,7 +38,7 @@ public function describeTo(Description $description)
* @return \Hamcrest\Core\IsAnything
* @factory
*/
- public static function anything($description = 'ANYTHING')
+ public static function anything(string $description = 'ANYTHING')
{
return new self($description);
}
diff --git a/hamcrest/Hamcrest/Core/IsCollectionContaining.php b/hamcrest/Hamcrest/Core/IsCollectionContaining.php
index 5e60426d1..a623a0397 100644
--- a/hamcrest/Hamcrest/Core/IsCollectionContaining.php
+++ b/hamcrest/Hamcrest/Core/IsCollectionContaining.php
@@ -15,7 +15,7 @@
class IsCollectionContaining extends TypeSafeMatcher
{
- private $_elementMatcher;
+ private Matcher $_elementMatcher;
public function __construct(Matcher $elementMatcher)
{
@@ -24,7 +24,7 @@ public function __construct(Matcher $elementMatcher)
$this->_elementMatcher = $elementMatcher;
}
- protected function matchesSafely($items)
+ protected function matchesSafely($items): bool
{
foreach ($items as $item) {
if ($this->_elementMatcher->matches($item)) {
@@ -35,12 +35,12 @@ protected function matchesSafely($items)
return false;
}
- protected function describeMismatchSafely($items, Description $mismatchDescription)
+ protected function describeMismatchSafely($items, Description $mismatchDescription): void
{
$mismatchDescription->appendText('was ')->appendValue($items);
}
- public function describeTo(Description $description)
+ public function describeTo(Description $description): void
{
$description
->appendText('a collection containing ')
@@ -60,7 +60,7 @@ public function describeTo(Description $description)
*
* @factory ...
*/
- public static function hasItem()
+ public static function hasItem(): self
{
$args = func_get_args();
$firstArg = array_shift($args);
@@ -79,7 +79,7 @@ public static function hasItem()
*
* @factory ...
*/
- public static function hasItems(/* args... */)
+ public static function hasItems(/* args... */): AllOf
{
$args = func_get_args();
$matchers = array();
diff --git a/hamcrest/Hamcrest/Core/IsEqual.php b/hamcrest/Hamcrest/Core/IsEqual.php
index 523fba0b1..e37411b7a 100644
--- a/hamcrest/Hamcrest/Core/IsEqual.php
+++ b/hamcrest/Hamcrest/Core/IsEqual.php
@@ -13,20 +13,25 @@
*/
class IsEqual extends BaseMatcher
{
-
+ /**
+ * @var mixed
+ */
private $_item;
+ /**
+ * @param mixed $item
+ */
public function __construct($item)
{
$this->_item = $item;
}
- public function matches($arg)
+ public function matches($arg): bool
{
return (($arg == $this->_item) && ($this->_item == $arg));
}
- public function describeTo(Description $description)
+ public function describeTo(Description $description): void
{
$description->appendValue($this->_item);
}
@@ -36,8 +41,9 @@ public function describeTo(Description $description)
* comparison operator?
*
* @factory
+ * @param mixed $item
*/
- public static function equalTo($item)
+ public static function equalTo($item): self
{
return new self($item);
}
diff --git a/hamcrest/Hamcrest/Core/IsIdentical.php b/hamcrest/Hamcrest/Core/IsIdentical.php
index 28f7b36ea..6fad940a7 100644
--- a/hamcrest/Hamcrest/Core/IsIdentical.php
+++ b/hamcrest/Hamcrest/Core/IsIdentical.php
@@ -13,15 +13,21 @@
class IsIdentical extends IsSame
{
+ /**
+ * @var mixed $_value
+ */
private $_value;
+ /**
+ * @param mixed $value
+ */
public function __construct($value)
{
parent::__construct($value);
$this->_value = $value;
}
- public function describeTo(Description $description)
+ public function describeTo(Description $description): void
{
$description->appendValue($this->_value);
}
@@ -30,8 +36,9 @@ public function describeTo(Description $description)
* Tests of the value is identical to $value as tested by the "===" operator.
*
* @factory
+ * @param mixed $value
*/
- public static function identicalTo($value)
+ public static function identicalTo($value): self
{
return new self($value);
}
diff --git a/hamcrest/Hamcrest/Core/IsInstanceOf.php b/hamcrest/Hamcrest/Core/IsInstanceOf.php
index 7a5c92a6b..a3828372e 100644
--- a/hamcrest/Hamcrest/Core/IsInstanceOf.php
+++ b/hamcrest/Hamcrest/Core/IsInstanceOf.php
@@ -13,7 +13,7 @@
class IsInstanceOf extends DiagnosingMatcher
{
- private $_theClass;
+ private string $_theClass;
/**
* Creates a new instance of IsInstanceOf
@@ -22,12 +22,12 @@ class IsInstanceOf extends DiagnosingMatcher
* The predicate evaluates to true for instances of this class
* or one of its subclasses.
*/
- public function __construct($theClass)
+ public function __construct(string $theClass)
{
$this->_theClass = $theClass;
}
- protected function matchesWithDiagnosticDescription($item, Description $mismatchDescription)
+ protected function matchesWithDiagnosticDescription($item, Description $mismatchDescription): bool
{
if (!is_object($item)) {
$mismatchDescription->appendText('was ')->appendValue($item);
@@ -45,7 +45,7 @@ protected function matchesWithDiagnosticDescription($item, Description $mismatch
return true;
}
- public function describeTo(Description $description)
+ public function describeTo(Description $description): void
{
$description->appendText('an instance of ')
->appendText($this->_theClass)
@@ -60,7 +60,7 @@ public function describeTo(Description $description)
*
* @factory any
*/
- public static function anInstanceOf($theClass)
+ public static function anInstanceOf(string $theClass): self
{
return new self($theClass);
}
diff --git a/hamcrest/Hamcrest/Core/IsNot.php b/hamcrest/Hamcrest/Core/IsNot.php
index 167f0d063..1fb750f51 100644
--- a/hamcrest/Hamcrest/Core/IsNot.php
+++ b/hamcrest/Hamcrest/Core/IsNot.php
@@ -15,19 +15,19 @@
class IsNot extends BaseMatcher
{
- private $_matcher;
+ private Matcher $_matcher;
public function __construct(Matcher $matcher)
{
$this->_matcher = $matcher;
}
- public function matches($arg)
+ public function matches($arg): bool
{
return !$this->_matcher->matches($arg);
}
- public function describeTo(Description $description)
+ public function describeTo(Description $description): void
{
$description->appendText('not ')->appendDescriptionOf($this->_matcher);
}
@@ -36,8 +36,9 @@ public function describeTo(Description $description)
* Matches if value does not match $value.
*
* @factory
+ * @param mixed $value
*/
- public static function not($value)
+ public static function not($value): self
{
return new self(Util::wrapValueWithIsEqual($value));
}
diff --git a/hamcrest/Hamcrest/Core/IsNull.php b/hamcrest/Hamcrest/Core/IsNull.php
index 91a454c17..84686f744 100644
--- a/hamcrest/Hamcrest/Core/IsNull.php
+++ b/hamcrest/Hamcrest/Core/IsNull.php
@@ -4,8 +4,10 @@
/*
Copyright (c) 2009 hamcrest.org
*/
+
use Hamcrest\BaseMatcher;
use Hamcrest\Description;
+use Hamcrest\Matcher;
/**
* Is the value null?
@@ -13,15 +15,15 @@
class IsNull extends BaseMatcher
{
- private static $_INSTANCE;
- private static $_NOT_INSTANCE;
+ private static ?self $_INSTANCE = null;
+ private static ?IsNot $_NOT_INSTANCE = null;
- public function matches($item)
+ public function matches($item): bool
{
return is_null($item);
}
- public function describeTo(Description $description)
+ public function describeTo(Description $description): void
{
$description->appendText('null');
}
@@ -31,7 +33,7 @@ public function describeTo(Description $description)
*
* @factory
*/
- public static function nullValue()
+ public static function nullValue(): self
{
if (!self::$_INSTANCE) {
self::$_INSTANCE = new self();
@@ -45,7 +47,7 @@ public static function nullValue()
*
* @factory
*/
- public static function notNullValue()
+ public static function notNullValue(): IsNot
{
if (!self::$_NOT_INSTANCE) {
self::$_NOT_INSTANCE = IsNot::not(self::nullValue());
diff --git a/hamcrest/Hamcrest/Core/IsSame.php b/hamcrest/Hamcrest/Core/IsSame.php
index 810787050..f7e4c32a3 100644
--- a/hamcrest/Hamcrest/Core/IsSame.php
+++ b/hamcrest/Hamcrest/Core/IsSame.php
@@ -14,19 +14,25 @@
class IsSame extends BaseMatcher
{
+ /**
+ * @var mixed object
+ */
private $_object;
+ /**
+ * @param mixed $object
+ */
public function __construct($object)
{
$this->_object = $object;
}
- public function matches($object)
+ public function matches($object): bool
{
return ($object === $this->_object) && ($this->_object === $object);
}
- public function describeTo(Description $description)
+ public function describeTo(Description $description): void
{
$description->appendText('sameInstance(')
->appendValue($this->_object)
@@ -44,7 +50,7 @@ public function describeTo(Description $description)
* @return \Hamcrest\Core\IsSame
* @factory
*/
- public static function sameInstance($object)
+ public static function sameInstance($object): self
{
return new self($object);
}
diff --git a/hamcrest/Hamcrest/Core/IsTypeOf.php b/hamcrest/Hamcrest/Core/IsTypeOf.php
index d24f0f94c..9fa874ff0 100644
--- a/hamcrest/Hamcrest/Core/IsTypeOf.php
+++ b/hamcrest/Hamcrest/Core/IsTypeOf.php
@@ -13,7 +13,7 @@
class IsTypeOf extends BaseMatcher
{
- private $_theType;
+ private string $_theType;
/**
* Creates a new instance of IsTypeOf
@@ -21,22 +21,22 @@ class IsTypeOf extends BaseMatcher
* @param string $theType
* The predicate evaluates to true for values with this built-in type.
*/
- public function __construct($theType)
+ public function __construct(string $theType)
{
$this->_theType = strtolower($theType);
}
- public function matches($item)
+ public function matches($item): bool
{
return strtolower(gettype($item)) == $this->_theType;
}
- public function describeTo(Description $description)
+ public function describeTo(Description $description): void
{
$description->appendText(self::getTypeDescription($this->_theType));
}
- public function describeMismatch($item, Description $description)
+ public function describeMismatch($item, Description $description): void
{
if ($item === null) {
$description->appendText('was null');
@@ -49,7 +49,7 @@ public function describeMismatch($item, Description $description)
}
}
- public static function getTypeDescription($type)
+ public static function getTypeDescription(string $type): string
{
if ($type == 'null') {
return 'null';
@@ -63,8 +63,9 @@ public static function getTypeDescription($type)
* Is the value a particular built-in type?
*
* @factory
+ * @param string $theType
*/
- public static function typeOf($theType)
+ public static function typeOf(string $theType): self
{
return new self($theType);
}
diff --git a/hamcrest/Hamcrest/Core/Set.php b/hamcrest/Hamcrest/Core/Set.php
index cdc45d538..8da692b3f 100644
--- a/hamcrest/Hamcrest/Core/Set.php
+++ b/hamcrest/Hamcrest/Core/Set.php
@@ -22,16 +22,22 @@
class Set extends BaseMatcher
{
+ /**
+ * @var mixed $_property
+ */
private $_property;
- private $_not;
+ private bool $_not;
- public function __construct($property, $not = false)
+ /**
+ * @param mixed $property
+ */
+ public function __construct($property, bool $not = false)
{
$this->_property = $property;
$this->_not = $not;
}
- public function matches($item)
+ public function matches($item): bool
{
if ($item === null) {
return false;
@@ -50,12 +56,12 @@ public function matches($item)
return $this->_not ? !$result : $result;
}
- public function describeTo(Description $description)
+ public function describeTo(Description $description): void
{
$description->appendText($this->_not ? 'unset property ' : 'set property ')->appendText($this->_property);
}
- public function describeMismatch($item, Description $description)
+ public function describeMismatch($item, Description $description): void
{
$value = '';
if (!$this->_not) {
@@ -77,8 +83,9 @@ public function describeMismatch($item, Description $description)
* Matches if value (class, object, or array) has named $property.
*
* @factory
+ * @param mixed $property
*/
- public static function set($property)
+ public static function set($property): self
{
return new self($property);
}
@@ -87,8 +94,9 @@ public static function set($property)
* Matches if value (class, object, or array) does not have named $property.
*
* @factory
+ * @param mixed $property
*/
- public static function notSet($property)
+ public static function notSet($property): self
{
return new self($property, true);
}
diff --git a/hamcrest/Hamcrest/Core/ShortcutCombination.php b/hamcrest/Hamcrest/Core/ShortcutCombination.php
index d93db74ff..8638a3949 100644
--- a/hamcrest/Hamcrest/Core/ShortcutCombination.php
+++ b/hamcrest/Hamcrest/Core/ShortcutCombination.php
@@ -7,6 +7,7 @@
use Hamcrest\BaseMatcher;
use Hamcrest\Description;
+use Hamcrest\Matcher;
use Hamcrest\Util;
abstract class ShortcutCombination extends BaseMatcher
@@ -17,6 +18,9 @@ abstract class ShortcutCombination extends BaseMatcher
*/
private $_matchers;
+ /**
+ * @param array<\Hamcrest\Matcher> $matchers
+ */
public function __construct(array $matchers)
{
Util::checkAllAreMatchers($matchers);
@@ -24,9 +28,11 @@ public function __construct(array $matchers)
$this->_matchers = $matchers;
}
- protected function matchesWithShortcut($item, $shortcut)
+ /**
+ * @param mixed $item
+ */
+ protected function matchesWithShortcut($item, bool $shortcut): bool
{
- /** @var $matcher \Hamcrest\Matcher */
foreach ($this->_matchers as $matcher) {
if ($matcher->matches($item) == $shortcut) {
return $shortcut;
@@ -36,7 +42,7 @@ protected function matchesWithShortcut($item, $shortcut)
return !$shortcut;
}
- public function describeToWithOperator(Description $description, $operator)
+ public function describeToWithOperator(Description $description, string $operator): void
{
$description->appendList('(', ' ' . $operator . ' ', ')', $this->_matchers);
}
diff --git a/hamcrest/Hamcrest/Description.php b/hamcrest/Hamcrest/Description.php
index b09554b28..4fb573997 100644
--- a/hamcrest/Hamcrest/Description.php
+++ b/hamcrest/Hamcrest/Description.php
@@ -21,7 +21,7 @@ interface Description
*
* @return static
*/
- public function appendText($text);
+ public function appendText(string $text): self;
/**
* Appends the description of a {@link Hamcrest\SelfDescribing} value to
@@ -31,7 +31,7 @@ public function appendText($text);
*
* @return static
*/
- public function appendDescriptionOf(SelfDescribing $value);
+ public function appendDescriptionOf(SelfDescribing $value): self;
/**
* Appends an arbitrary value to the description.
@@ -40,7 +40,7 @@ public function appendDescriptionOf(SelfDescribing $value);
*
* @return static
*/
- public function appendValue($value);
+ public function appendValue($value): self;
/**
* Appends a list of values to the description.
@@ -48,11 +48,11 @@ public function appendValue($value);
* @param string $start
* @param string $separator
* @param string $end
- * @param array|\IteratorAggregate|\Iterator $values
+ * @param iterable$actual
* @throws AssertionError
*/
- private static function doAssert($identifier, $actual, Matcher $matcher)
+ private static function doAssert($identifier, $actual, Matcher $matcher): void
{
if (!$matcher->matches($actual)) {
$description = new StringDescription();
diff --git a/hamcrest/Hamcrest/Matchers.php b/hamcrest/Hamcrest/Matchers.php
index 719d2f9e5..37db6eea1 100644
--- a/hamcrest/Hamcrest/Matchers.php
+++ b/hamcrest/Hamcrest/Matchers.php
@@ -8,6 +8,15 @@
namespace Hamcrest;
+use Hamcrest\Arrays\IsArray;
+use Hamcrest\Arrays\IsArrayContainingInAnyOrder;
+use Hamcrest\Arrays\IsArrayContainingInOrder;
+use Hamcrest\Core\AllOf;
+use Hamcrest\Core\AnyOf;
+use Hamcrest\Core\DescribedAs;
+use Hamcrest\Core\IsCollectionContaining;
+use Hamcrest\Text\StringContainsInOrder;
+
/**
* A series of static factories for all hamcrest matchers.
*/
@@ -17,7 +26,7 @@ class Matchers
/**
* Evaluates to true only if each $matcher[$i] is satisfied by $array[$i].
*/
- public static function anArray(/* args... */)
+ public static function anArray(/* args... */): IsArray
{
$args = func_get_args();
return call_user_func_array(array('\Hamcrest\Arrays\IsArray', 'anArray'), $args);
@@ -30,7 +39,7 @@ public static function anArray(/* args... */)
*
* @return \Hamcrest\Arrays\IsArrayContaining
*/
- public static function hasItemInArray($item)
+ public static function hasItemInArray($item): \Hamcrest\Arrays\IsArrayContaining
{
return \Hamcrest\Arrays\IsArrayContaining::hasItemInArray($item);
}
@@ -42,7 +51,7 @@ public static function hasItemInArray($item)
*
* @return \Hamcrest\Arrays\IsArrayContaining
*/
- public static function hasValue($item)
+ public static function hasValue($item): \Hamcrest\Arrays\IsArrayContaining
{
return \Hamcrest\Arrays\IsArrayContaining::hasItemInArray($item);
}
@@ -50,7 +59,7 @@ public static function hasValue($item)
/**
* An array with elements that match the given matchers.
*/
- public static function arrayContainingInAnyOrder(/* args... */)
+ public static function arrayContainingInAnyOrder(/* args... */): IsArrayContainingInAnyOrder
{
$args = func_get_args();
return call_user_func_array(array('\Hamcrest\Arrays\IsArrayContainingInAnyOrder', 'arrayContainingInAnyOrder'), $args);
@@ -59,7 +68,7 @@ public static function arrayContainingInAnyOrder(/* args... */)
/**
* An array with elements that match the given matchers.
*/
- public static function containsInAnyOrder(/* args... */)
+ public static function containsInAnyOrder(/* args... */): IsArrayContainingInAnyOrder
{
$args = func_get_args();
return call_user_func_array(array('\Hamcrest\Arrays\IsArrayContainingInAnyOrder', 'arrayContainingInAnyOrder'), $args);
@@ -68,7 +77,7 @@ public static function containsInAnyOrder(/* args... */)
/**
* An array with elements that match the given matchers in the same order.
*/
- public static function arrayContaining(/* args... */)
+ public static function arrayContaining(/* args... */): IsArrayContainingInOrder
{
$args = func_get_args();
return call_user_func_array(array('\Hamcrest\Arrays\IsArrayContainingInOrder', 'arrayContaining'), $args);
@@ -77,7 +86,7 @@ public static function arrayContaining(/* args... */)
/**
* An array with elements that match the given matchers in the same order.
*/
- public static function contains(/* args... */)
+ public static function contains(/* args... */): IsArrayContainingInOrder
{
$args = func_get_args();
return call_user_func_array(array('\Hamcrest\Arrays\IsArrayContainingInOrder', 'arrayContaining'), $args);
@@ -90,7 +99,7 @@ public static function contains(/* args... */)
*
* @return \Hamcrest\Arrays\IsArrayContainingKey
*/
- public static function hasKeyInArray($key)
+ public static function hasKeyInArray($key): \Hamcrest\Arrays\IsArrayContainingKey
{
return \Hamcrest\Arrays\IsArrayContainingKey::hasKeyInArray($key);
}
@@ -102,23 +111,27 @@ public static function hasKeyInArray($key)
*
* @return \Hamcrest\Arrays\IsArrayContainingKey
*/
- public static function hasKey($key)
+ public static function hasKey($key): \Hamcrest\Arrays\IsArrayContainingKey
{
return \Hamcrest\Arrays\IsArrayContainingKey::hasKeyInArray($key);
}
/**
* Test if an array has both an key and value in parity with each other.
+ * @param mixed $key
+ * @param mixed $value
*/
- public static function hasKeyValuePair($key, $value)
+ public static function hasKeyValuePair($key, $value): \Hamcrest\Arrays\IsArrayContainingKeyValuePair
{
return \Hamcrest\Arrays\IsArrayContainingKeyValuePair::hasKeyValuePair($key, $value);
}
/**
* Test if an array has both an key and value in parity with each other.
+ * @param mixed $key
+ * @param mixed $value
*/
- public static function hasEntry($key, $value)
+ public static function hasEntry($key, $value): \Hamcrest\Arrays\IsArrayContainingKeyValuePair
{
return \Hamcrest\Arrays\IsArrayContainingKeyValuePair::hasKeyValuePair($key, $value);
}
@@ -130,7 +143,7 @@ public static function hasEntry($key, $value)
*
* @return \Hamcrest\Arrays\IsArrayWithSize
*/
- public static function arrayWithSize($size)
+ public static function arrayWithSize($size): \Hamcrest\Arrays\IsArrayWithSize
{
return \Hamcrest\Arrays\IsArrayWithSize::arrayWithSize($size);
}
@@ -138,7 +151,7 @@ public static function arrayWithSize($size)
/**
* Matches an empty array.
*/
- public static function emptyArray()
+ public static function emptyArray(): \Hamcrest\Core\DescribedAs
{
return \Hamcrest\Arrays\IsArrayWithSize::emptyArray();
}
@@ -146,7 +159,7 @@ public static function emptyArray()
/**
* Matches an empty array.
*/
- public static function nonEmptyArray()
+ public static function nonEmptyArray(): \Hamcrest\Core\DescribedAs
{
return \Hamcrest\Arrays\IsArrayWithSize::nonEmptyArray();
}
@@ -154,7 +167,7 @@ public static function nonEmptyArray()
/**
* Returns true if traversable is empty.
*/
- public static function emptyTraversable()
+ public static function emptyTraversable(): \Hamcrest\Collection\IsEmptyTraversable
{
return \Hamcrest\Collection\IsEmptyTraversable::emptyTraversable();
}
@@ -162,15 +175,16 @@ public static function emptyTraversable()
/**
* Returns true if traversable is not empty.
*/
- public static function nonEmptyTraversable()
+ public static function nonEmptyTraversable(): \Hamcrest\Collection\IsEmptyTraversable
{
return \Hamcrest\Collection\IsEmptyTraversable::nonEmptyTraversable();
}
/**
* Does traversable size satisfy a given matcher?
+ * @param mixed $size
*/
- public static function traversableWithSize($size)
+ public static function traversableWithSize($size): \Hamcrest\Collection\IsTraversableWithSize
{
return \Hamcrest\Collection\IsTraversableWithSize::traversableWithSize($size);
}
@@ -178,7 +192,7 @@ public static function traversableWithSize($size)
/**
* Evaluates to true only if ALL of the passed in matchers evaluate to true.
*/
- public static function allOf(/* args... */)
+ public static function allOf(/* args... */): AllOf
{
$args = func_get_args();
return call_user_func_array(array('\Hamcrest\Core\AllOf', 'allOf'), $args);
@@ -187,7 +201,7 @@ public static function allOf(/* args... */)
/**
* Evaluates to true if ANY of the passed in matchers evaluate to true.
*/
- public static function anyOf(/* args... */)
+ public static function anyOf(/* args... */): AnyOf
{
$args = func_get_args();
return call_user_func_array(array('\Hamcrest\Core\AnyOf', 'anyOf'), $args);
@@ -196,7 +210,7 @@ public static function anyOf(/* args... */)
/**
* Evaluates to false if ANY of the passed in matchers evaluate to true.
*/
- public static function noneOf(/* args... */)
+ public static function noneOf(/* args... */): AnyOf
{
$args = func_get_args();
return call_user_func_array(array('\Hamcrest\Core\AnyOf', 'noneOf'), $args);
@@ -209,7 +223,7 @@ public static function noneOf(/* args... */)
* assertThat($string, both(containsString("a"))->andAlso(containsString("b")));
*
*/
- public static function both(\Hamcrest\Matcher $matcher)
+ public static function both(\Hamcrest\Matcher $matcher): \Hamcrest\Core\CombinableMatcher
{
return \Hamcrest\Core\CombinableMatcher::both($matcher);
}
@@ -221,7 +235,7 @@ public static function both(\Hamcrest\Matcher $matcher)
* assertThat($string, either(containsString("a"))->orElse(containsString("b")));
*
*/
- public static function either(\Hamcrest\Matcher $matcher)
+ public static function either(\Hamcrest\Matcher $matcher): \Hamcrest\Core\CombinableMatcher
{
return \Hamcrest\Core\CombinableMatcher::either($matcher);
}
@@ -229,7 +243,7 @@ public static function either(\Hamcrest\Matcher $matcher)
/**
* Wraps an existing matcher and overrides the description when it fails.
*/
- public static function describedAs(/* args... */)
+ public static function describedAs(/* args... */): DescribedAs
{
$args = func_get_args();
return call_user_func_array(array('\Hamcrest\Core\DescribedAs', 'describedAs'), $args);
@@ -242,7 +256,7 @@ public static function describedAs(/* args... */)
* @return \Hamcrest\Core\Every
* Evaluates to TRUE for a collection in which every item matches $itemMatcher
*/
- public static function everyItem(\Hamcrest\Matcher $itemMatcher)
+ public static function everyItem(\Hamcrest\Matcher $itemMatcher): \Hamcrest\Core\Every
{
return \Hamcrest\Core\Every::everyItem($itemMatcher);
}
@@ -251,7 +265,7 @@ public static function everyItem(\Hamcrest\Matcher $itemMatcher)
* Creates a matcher that matches any examined object whose toString or
* __toString() method returns a value equalTo the specified string.
*/
- public static function hasToString($matcher)
+ public static function hasToString($matcher): \Hamcrest\Core\HasToString
{
return \Hamcrest\Core\HasToString::hasToString($matcher);
}
@@ -262,8 +276,9 @@ public static function hasToString($matcher)
*
* For example: assertThat($cheese, equalTo($smelly))
* vs. assertThat($cheese, is(equalTo($smelly)))
+ * @param mixed $value
*/
- public static function is($value)
+ public static function is($value): \Hamcrest\Core\Is
{
return \Hamcrest\Core\Is::is($value);
}
@@ -275,7 +290,7 @@ public static function is($value)
*
* @return \Hamcrest\Core\IsAnything
*/
- public static function anything($description = 'ANYTHING')
+ public static function anything(string $description = 'ANYTHING'): \Hamcrest\Core\IsAnything
{
return \Hamcrest\Core\IsAnything::anything($description);
}
@@ -290,7 +305,7 @@ public static function anything($description = 'ANYTHING')
* assertThat(array('a', 'b'), hasItem('b'));
*
*/
- public static function hasItem(/* args... */)
+ public static function hasItem(/* args... */): IsCollectionContaining
{
$args = func_get_args();
return call_user_func_array(array('\Hamcrest\Core\IsCollectionContaining', 'hasItem'), $args);
@@ -305,7 +320,7 @@ public static function hasItem(/* args... */)
* assertThat(array('a', 'b', 'c'), hasItems(equalTo('a'), equalTo('b')));
*
*/
- public static function hasItems(/* args... */)
+ public static function hasItems(/* args... */): IsCollectionContaining
{
$args = func_get_args();
return call_user_func_array(array('\Hamcrest\Core\IsCollectionContaining', 'hasItems'), $args);
@@ -314,16 +329,18 @@ public static function hasItems(/* args... */)
/**
* Is the value equal to another value, as tested by the use of the "=="
* comparison operator?
+ * @param mixed $item
*/
- public static function equalTo($item)
+ public static function equalTo($item): \Hamcrest\Core\IsEqual
{
return \Hamcrest\Core\IsEqual::equalTo($item);
}
/**
* Tests of the value is identical to $value as tested by the "===" operator.
+ * @param mixed $value
*/
- public static function identicalTo($value)
+ public static function identicalTo($value): \Hamcrest\Core\IsIdentical
{
return \Hamcrest\Core\IsIdentical::identicalTo($value);
}
@@ -334,7 +351,7 @@ public static function identicalTo($value)
* the signature of the method that sets it up, for example in
* assertThat($anObject, anInstanceOf('Thing'));
*/
- public static function anInstanceOf($theClass)
+ public static function anInstanceOf(string $theClass): \Hamcrest\Core\IsInstanceOf
{
return \Hamcrest\Core\IsInstanceOf::anInstanceOf($theClass);
}
@@ -345,15 +362,16 @@ public static function anInstanceOf($theClass)
* the signature of the method that sets it up, for example in
* assertThat($anObject, anInstanceOf('Thing'));
*/
- public static function any($theClass)
+ public static function any(string $theClass): \Hamcrest\Core\IsInstanceOf
{
return \Hamcrest\Core\IsInstanceOf::anInstanceOf($theClass);
}
/**
* Matches if value does not match $value.
+ * @param mixed $value
*/
- public static function not($value)
+ public static function not($value): \Hamcrest\Core\IsNot
{
return \Hamcrest\Core\IsNot::not($value);
}
@@ -361,7 +379,7 @@ public static function not($value)
/**
* Matches if value is null.
*/
- public static function nullValue()
+ public static function nullValue(): \Hamcrest\Core\IsNull
{
return \Hamcrest\Core\IsNull::nullValue();
}
@@ -369,7 +387,7 @@ public static function nullValue()
/**
* Matches if value is not null.
*/
- public static function notNullValue()
+ public static function notNullValue(): Matcher
{
return \Hamcrest\Core\IsNull::notNullValue();
}
@@ -383,7 +401,7 @@ public static function notNullValue()
*
* @return \Hamcrest\Core\IsSame
*/
- public static function sameInstance($object)
+ public static function sameInstance($object): \Hamcrest\Core\IsSame
{
return \Hamcrest\Core\IsSame::sameInstance($object);
}
@@ -391,23 +409,25 @@ public static function sameInstance($object)
/**
* Is the value a particular built-in type?
*/
- public static function typeOf($theType)
+ public static function typeOf(string $theType): \Hamcrest\Core\IsTypeOf
{
return \Hamcrest\Core\IsTypeOf::typeOf($theType);
}
/**
* Matches if value (class, object, or array) has named $property.
+ * @param mixed $property
*/
- public static function set($property)
+ public static function set($property): \Hamcrest\Core\Set
{
return \Hamcrest\Core\Set::set($property);
}
/**
* Matches if value (class, object, or array) does not have named $property.
+ * @param mixed $property
*/
- public static function notSet($property)
+ public static function notSet($property): \Hamcrest\Core\Set
{
return \Hamcrest\Core\Set::notSet($property);
}
@@ -415,64 +435,73 @@ public static function notSet($property)
/**
* Matches if value is a number equal to $value within some range of
* acceptable error $delta.
+ * @param mixed $value
+ * @param mixed $delta
*/
- public static function closeTo($value, $delta)
+ public static function closeTo($value, $delta): \Hamcrest\Number\IsCloseTo
{
return \Hamcrest\Number\IsCloseTo::closeTo($value, $delta);
}
/**
* The value is not > $value, nor < $value.
+ * @param mixed $value
*/
- public static function comparesEqualTo($value)
+ public static function comparesEqualTo($value): \Hamcrest\Number\OrderingComparison
{
return \Hamcrest\Number\OrderingComparison::comparesEqualTo($value);
}
/**
* The value is > $value.
+ * @param mixed $value
*/
- public static function greaterThan($value)
+ public static function greaterThan($value): \Hamcrest\Number\OrderingComparison
{
return \Hamcrest\Number\OrderingComparison::greaterThan($value);
}
/**
* The value is >= $value.
+ * @param mixed $value
*/
- public static function greaterThanOrEqualTo($value)
+ public static function greaterThanOrEqualTo($value): \Hamcrest\Number\OrderingComparison
{
return \Hamcrest\Number\OrderingComparison::greaterThanOrEqualTo($value);
}
/**
* The value is >= $value.
+ * @param mixed $value
*/
- public static function atLeast($value)
+ public static function atLeast($value): \Hamcrest\Number\OrderingComparison
{
return \Hamcrest\Number\OrderingComparison::greaterThanOrEqualTo($value);
}
/**
* The value is < $value.
+ * @param mixed $value
*/
- public static function lessThan($value)
+ public static function lessThan($value): \Hamcrest\Number\OrderingComparison
{
return \Hamcrest\Number\OrderingComparison::lessThan($value);
}
/**
* The value is <= $value.
+ * @param mixed $value
*/
- public static function lessThanOrEqualTo($value)
+ public static function lessThanOrEqualTo($value): \Hamcrest\Number\OrderingComparison
{
return \Hamcrest\Number\OrderingComparison::lessThanOrEqualTo($value);
}
/**
* The value is <= $value.
+ * @param mixed $value
*/
- public static function atMost($value)
+ public static function atMost($value): \Hamcrest\Number\OrderingComparison
{
return \Hamcrest\Number\OrderingComparison::lessThanOrEqualTo($value);
}
@@ -480,7 +509,7 @@ public static function atMost($value)
/**
* Matches if value is a zero-length string.
*/
- public static function isEmptyString()
+ public static function isEmptyString(): \Hamcrest\Text\IsEmptyString
{
return \Hamcrest\Text\IsEmptyString::isEmptyString();
}
@@ -488,7 +517,7 @@ public static function isEmptyString()
/**
* Matches if value is a zero-length string.
*/
- public static function emptyString()
+ public static function emptyString(): \Hamcrest\Text\IsEmptyString
{
return \Hamcrest\Text\IsEmptyString::isEmptyString();
}
@@ -496,7 +525,7 @@ public static function emptyString()
/**
* Matches if value is null or a zero-length string.
*/
- public static function isEmptyOrNullString()
+ public static function isEmptyOrNullString(): Matcher
{
return \Hamcrest\Text\IsEmptyString::isEmptyOrNullString();
}
@@ -504,7 +533,7 @@ public static function isEmptyOrNullString()
/**
* Matches if value is null or a zero-length string.
*/
- public static function nullOrEmptyString()
+ public static function nullOrEmptyString(): Matcher
{
return \Hamcrest\Text\IsEmptyString::isEmptyOrNullString();
}
@@ -512,7 +541,7 @@ public static function nullOrEmptyString()
/**
* Matches if value is a non-zero-length string.
*/
- public static function isNonEmptyString()
+ public static function isNonEmptyString(): \Hamcrest\Text\IsEmptyString
{
return \Hamcrest\Text\IsEmptyString::isNonEmptyString();
}
@@ -520,47 +549,52 @@ public static function isNonEmptyString()
/**
* Matches if value is a non-zero-length string.
*/
- public static function nonEmptyString()
+ public static function nonEmptyString(): \Hamcrest\Text\IsEmptyString
{
return \Hamcrest\Text\IsEmptyString::isNonEmptyString();
}
/**
* Matches if value is a string equal to $string, regardless of the case.
+ * @param mixed $string
*/
- public static function equalToIgnoringCase($string)
+ public static function equalToIgnoringCase($string): \Hamcrest\Text\IsEqualIgnoringCase
{
return \Hamcrest\Text\IsEqualIgnoringCase::equalToIgnoringCase($string);
}
/**
* Matches if value is a string equal to $string, regardless of whitespace.
+ * @param mixed $string
*/
- public static function equalToIgnoringWhiteSpace($string)
+ public static function equalToIgnoringWhiteSpace($string): \Hamcrest\Text\IsEqualIgnoringWhiteSpace
{
return \Hamcrest\Text\IsEqualIgnoringWhiteSpace::equalToIgnoringWhiteSpace($string);
}
/**
* Matches if value is a string that matches regular expression $pattern.
+ * @param mixed $pattern
*/
- public static function matchesPattern($pattern)
+ public static function matchesPattern($pattern): \Hamcrest\Text\MatchesPattern
{
return \Hamcrest\Text\MatchesPattern::matchesPattern($pattern);
}
/**
* Matches if value is a string that contains $substring.
+ * @param mixed $substring
*/
- public static function containsString($substring)
+ public static function containsString($substring): \Hamcrest\Text\StringContains
{
return \Hamcrest\Text\StringContains::containsString($substring);
}
/**
* Matches if value is a string that contains $substring regardless of the case.
+ * @param mixed $substring
*/
- public static function containsStringIgnoringCase($substring)
+ public static function containsStringIgnoringCase($substring): \Hamcrest\Text\StringContainsIgnoringCase
{
return \Hamcrest\Text\StringContainsIgnoringCase::containsStringIgnoringCase($substring);
}
@@ -568,7 +602,7 @@ public static function containsStringIgnoringCase($substring)
/**
* Matches if value contains $substrings in a constrained order.
*/
- public static function stringContainsInOrder(/* args... */)
+ public static function stringContainsInOrder(/* args... */): StringContainsInOrder
{
$args = func_get_args();
return call_user_func_array(array('\Hamcrest\Text\StringContainsInOrder', 'stringContainsInOrder'), $args);
@@ -576,16 +610,18 @@ public static function stringContainsInOrder(/* args... */)
/**
* Matches if value is a string that ends with $substring.
+ * @param mixed $substring
*/
- public static function endsWith($substring)
+ public static function endsWith($substring): \Hamcrest\Text\StringEndsWith
{
return \Hamcrest\Text\StringEndsWith::endsWith($substring);
}
/**
* Matches if value is a string that starts with $substring.
+ * @param mixed $substring
*/
- public static function startsWith($substring)
+ public static function startsWith($substring): \Hamcrest\Text\StringStartsWith
{
return \Hamcrest\Text\StringStartsWith::startsWith($substring);
}
@@ -593,7 +629,7 @@ public static function startsWith($substring)
/**
* Is the value an array?
*/
- public static function arrayValue()
+ public static function arrayValue(): \Hamcrest\Type\IsArray
{
return \Hamcrest\Type\IsArray::arrayValue();
}
@@ -601,7 +637,7 @@ public static function arrayValue()
/**
* Is the value a boolean?
*/
- public static function booleanValue()
+ public static function booleanValue(): \Hamcrest\Type\IsBoolean
{
return \Hamcrest\Type\IsBoolean::booleanValue();
}
@@ -609,7 +645,7 @@ public static function booleanValue()
/**
* Is the value a boolean?
*/
- public static function boolValue()
+ public static function boolValue(): \Hamcrest\Type\IsBoolean
{
return \Hamcrest\Type\IsBoolean::booleanValue();
}
@@ -617,7 +653,7 @@ public static function boolValue()
/**
* Is the value callable?
*/
- public static function callableValue()
+ public static function callableValue(): \Hamcrest\Type\IsCallable
{
return \Hamcrest\Type\IsCallable::callableValue();
}
@@ -625,7 +661,7 @@ public static function callableValue()
/**
* Is the value a float/double?
*/
- public static function doubleValue()
+ public static function doubleValue(): \Hamcrest\Type\IsDouble
{
return \Hamcrest\Type\IsDouble::doubleValue();
}
@@ -633,7 +669,7 @@ public static function doubleValue()
/**
* Is the value a float/double?
*/
- public static function floatValue()
+ public static function floatValue(): \Hamcrest\Type\IsDouble
{
return \Hamcrest\Type\IsDouble::doubleValue();
}
@@ -641,7 +677,7 @@ public static function floatValue()
/**
* Is the value an integer?
*/
- public static function integerValue()
+ public static function integerValue(): \Hamcrest\Type\IsInteger
{
return \Hamcrest\Type\IsInteger::integerValue();
}
@@ -649,7 +685,7 @@ public static function integerValue()
/**
* Is the value an integer?
*/
- public static function intValue()
+ public static function intValue(): \Hamcrest\Type\IsInteger
{
return \Hamcrest\Type\IsInteger::integerValue();
}
@@ -657,7 +693,7 @@ public static function intValue()
/**
* Is the value a numeric?
*/
- public static function numericValue()
+ public static function numericValue(): \Hamcrest\Type\IsNumeric
{
return \Hamcrest\Type\IsNumeric::numericValue();
}
@@ -665,7 +701,7 @@ public static function numericValue()
/**
* Is the value an object?
*/
- public static function objectValue()
+ public static function objectValue(): \Hamcrest\Type\IsObject
{
return \Hamcrest\Type\IsObject::objectValue();
}
@@ -673,7 +709,7 @@ public static function objectValue()
/**
* Is the value an object?
*/
- public static function anObject()
+ public static function anObject(): \Hamcrest\Type\IsObject
{
return \Hamcrest\Type\IsObject::objectValue();
}
@@ -681,7 +717,7 @@ public static function anObject()
/**
* Is the value a resource?
*/
- public static function resourceValue()
+ public static function resourceValue(): \Hamcrest\Type\IsResource
{
return \Hamcrest\Type\IsResource::resourceValue();
}
@@ -689,7 +725,7 @@ public static function resourceValue()
/**
* Is the value a scalar (boolean, integer, double, or string)?
*/
- public static function scalarValue()
+ public static function scalarValue(): \Hamcrest\Type\IsScalar
{
return \Hamcrest\Type\IsScalar::scalarValue();
}
@@ -697,7 +733,7 @@ public static function scalarValue()
/**
* Is the value a string?
*/
- public static function stringValue()
+ public static function stringValue(): \Hamcrest\Type\IsString
{
return \Hamcrest\Type\IsString::stringValue();
}
@@ -706,8 +742,9 @@ public static function stringValue()
* Wraps $matcher with {@link Hamcrest\Core\IsEqual)
* if it's not a matcher and the XPath in count()
* if it's an integer.
+ * @param null|Matcher|int|mixed $matcher
*/
- public static function hasXPath($xpath, $matcher = null)
+ public static function hasXPath(string $xpath, $matcher = null): \Hamcrest\Xml\HasXPath
{
return \Hamcrest\Xml\HasXPath::hasXPath($xpath, $matcher);
}
diff --git a/hamcrest/Hamcrest/NullDescription.php b/hamcrest/Hamcrest/NullDescription.php
index aae8e4616..1d86da479 100644
--- a/hamcrest/Hamcrest/NullDescription.php
+++ b/hamcrest/Hamcrest/NullDescription.php
@@ -11,27 +11,27 @@
class NullDescription implements Description
{
- public function appendText($text)
+ public function appendText(string $text): self
{
return $this;
}
- public function appendDescriptionOf(SelfDescribing $value)
+ public function appendDescriptionOf(SelfDescribing $value): self
{
return $this;
}
- public function appendValue($value)
+ public function appendValue($value): self
{
return $this;
}
- public function appendValueList($start, $separator, $end, $values)
+ public function appendValueList(string $start, string $separator, string $end, $values): self
{
return $this;
}
- public function appendList($start, $separator, $end, $values)
+ public function appendList(string $start, string $separator, string $end, $values): self
{
return $this;
}
diff --git a/hamcrest/Hamcrest/Number/IsCloseTo.php b/hamcrest/Hamcrest/Number/IsCloseTo.php
index 15453e526..748419df3 100644
--- a/hamcrest/Hamcrest/Number/IsCloseTo.php
+++ b/hamcrest/Hamcrest/Number/IsCloseTo.php
@@ -14,9 +14,19 @@
class IsCloseTo extends TypeSafeMatcher
{
+ /**
+ * @var mixed
+ */
private $_value;
+ /**
+ * @var mixed
+ */
private $_delta;
+ /**
+ * @param mixed $value
+ * @param mixed $delta
+ */
public function __construct($value, $delta)
{
parent::__construct(self::TYPE_NUMERIC);
@@ -25,12 +35,12 @@ public function __construct($value, $delta)
$this->_delta = $delta;
}
- protected function matchesSafely($item)
+ protected function matchesSafely($item): bool
{
return $this->_actualDelta($item) <= 0.0;
}
- protected function describeMismatchSafely($item, Description $mismatchDescription)
+ protected function describeMismatchSafely($item, Description $mismatchDescription): void
{
$mismatchDescription->appendValue($item)
->appendText(' differed by ')
@@ -38,7 +48,7 @@ protected function describeMismatchSafely($item, Description $mismatchDescriptio
;
}
- public function describeTo(Description $description)
+ public function describeTo(Description $description): void
{
$description->appendText('a numeric value within ')
->appendValue($this->_delta)
@@ -52,14 +62,20 @@ public function describeTo(Description $description)
* acceptable error $delta.
*
* @factory
+ * @param mixed $value
+ * @param mixed $delta
*/
- public static function closeTo($value, $delta)
+ public static function closeTo($value, $delta): self
{
return new self($value, $delta);
}
// -- Private Methods
+ /**
+ * @param mixed $item
+ * @return int|float
+ */
private function _actualDelta($item)
{
return (abs(($item - $this->_value)) - $this->_delta);
diff --git a/hamcrest/Hamcrest/Number/OrderingComparison.php b/hamcrest/Hamcrest/Number/OrderingComparison.php
index 369d0cfa5..1eb1713d2 100644
--- a/hamcrest/Hamcrest/Number/OrderingComparison.php
+++ b/hamcrest/Hamcrest/Number/OrderingComparison.php
@@ -11,10 +11,24 @@
class OrderingComparison extends TypeSafeMatcher
{
+ /**
+ * @var mixed
+ */
private $_value;
+ /**
+ * @var mixed
+ */
private $_minCompare;
+ /**
+ * @var mixed
+ */
private $_maxCompare;
+ /**
+ * @param mixed $value
+ * @param mixed $maxCompare
+ * @param mixed $minCompare
+ */
public function __construct($value, $minCompare, $maxCompare)
{
parent::__construct(self::TYPE_NUMERIC);
@@ -24,14 +38,14 @@ public function __construct($value, $minCompare, $maxCompare)
$this->_maxCompare = $maxCompare;
}
- protected function matchesSafely($other)
+ protected function matchesSafely($other): bool
{
$compare = $this->_compare($this->_value, $other);
return ($this->_minCompare <= $compare) && ($compare <= $this->_maxCompare);
}
- protected function describeMismatchSafely($item, Description $mismatchDescription)
+ protected function describeMismatchSafely($item, Description $mismatchDescription): void
{
$mismatchDescription
->appendValue($item)->appendText(' was ')
@@ -40,7 +54,7 @@ protected function describeMismatchSafely($item, Description $mismatchDescriptio
;
}
- public function describeTo(Description $description)
+ public function describeTo(Description $description): void
{
$description->appendText('a value ')
->appendText($this->_comparison($this->_minCompare))
@@ -57,8 +71,9 @@ public function describeTo(Description $description)
* The value is not > $value, nor < $value.
*
* @factory
+ * @param mixed $value
*/
- public static function comparesEqualTo($value)
+ public static function comparesEqualTo($value): self
{
return new self($value, 0, 0);
}
@@ -67,8 +82,9 @@ public static function comparesEqualTo($value)
* The value is > $value.
*
* @factory
+ * @param mixed $value
*/
- public static function greaterThan($value)
+ public static function greaterThan($value): self
{
return new self($value, -1, -1);
}
@@ -77,8 +93,9 @@ public static function greaterThan($value)
* The value is >= $value.
*
* @factory atLeast
+ * @param mixed $value
*/
- public static function greaterThanOrEqualTo($value)
+ public static function greaterThanOrEqualTo($value): self
{
return new self($value, -1, 0);
}
@@ -87,8 +104,9 @@ public static function greaterThanOrEqualTo($value)
* The value is < $value.
*
* @factory
+ * @param mixed $value
*/
- public static function lessThan($value)
+ public static function lessThan($value): self
{
return new self($value, 1, 1);
}
@@ -97,15 +115,20 @@ public static function lessThan($value)
* The value is <= $value.
*
* @factory atMost
+ * @param mixed $value
*/
- public static function lessThanOrEqualTo($value)
+ public static function lessThanOrEqualTo($value): self
{
return new self($value, 0, 1);
}
// -- Private Methods
- private function _compare($left, $right)
+ /**
+ * @param mixed $left
+ * @param mixed $right
+ */
+ private function _compare($left, $right): int
{
$a = $left;
$b = $right;
@@ -119,7 +142,10 @@ private function _compare($left, $right)
}
}
- private function _comparison($compare)
+ /**
+ * @param mixed $compare
+ */
+ private function _comparison($compare): string
{
if ($compare > 0) {
return 'less than';
diff --git a/hamcrest/Hamcrest/SelfDescribing.php b/hamcrest/Hamcrest/SelfDescribing.php
index 872fdf9c5..6712a02ef 100644
--- a/hamcrest/Hamcrest/SelfDescribing.php
+++ b/hamcrest/Hamcrest/SelfDescribing.php
@@ -19,5 +19,5 @@ interface SelfDescribing
* @param \Hamcrest\Description $description
* The description to be built or appended to.
*/
- public function describeTo(Description $description);
+ public function describeTo(Description $description): void;
}
diff --git a/hamcrest/Hamcrest/StringDescription.php b/hamcrest/Hamcrest/StringDescription.php
index 4b36fa2d1..766501252 100644
--- a/hamcrest/Hamcrest/StringDescription.php
+++ b/hamcrest/Hamcrest/StringDescription.php
@@ -11,8 +11,11 @@
class StringDescription extends BaseDescription
{
- private $_out;
+ private string $_out;
+ /**
+ * @param mixed $out
+ */
public function __construct($out = '')
{
$this->_out = (string) $out;
@@ -33,7 +36,7 @@ public function __toString()
* @return string
* The description of the object.
*/
- public static function toString(SelfDescribing $selfDescribing)
+ public static function toString(SelfDescribing $selfDescribing): string
{
$self = new self();
@@ -43,14 +46,14 @@ public static function toString(SelfDescribing $selfDescribing)
/**
* Alias for {@link toString()}.
*/
- public static function asString(SelfDescribing $selfDescribing)
+ public static function asString(SelfDescribing $selfDescribing): string
{
return self::toString($selfDescribing);
}
// -- Protected Methods
- protected function append($str)
+ protected function append($str): void
{
$this->_out .= $str;
}
diff --git a/hamcrest/Hamcrest/Text/IsEmptyString.php b/hamcrest/Hamcrest/Text/IsEmptyString.php
index 2ae61b96c..947a2c6de 100644
--- a/hamcrest/Hamcrest/Text/IsEmptyString.php
+++ b/hamcrest/Hamcrest/Text/IsEmptyString.php
@@ -15,25 +15,25 @@
class IsEmptyString extends BaseMatcher
{
- private static $_INSTANCE;
- private static $_NULL_OR_EMPTY_INSTANCE;
- private static $_NOT_INSTANCE;
+ private static ?self $_INSTANCE = null;
+ private static ?AnyOf $_NULL_OR_EMPTY_INSTANCE = null;
+ private static ?self $_NOT_INSTANCE = null;
- private $_empty;
+ private bool $_empty;
- public function __construct($empty = true)
+ public function __construct(bool $empty = true)
{
$this->_empty = $empty;
}
- public function matches($item)
+ public function matches($item): bool
{
return $this->_empty
? ($item === '')
: is_string($item) && $item !== '';
}
- public function describeTo(Description $description)
+ public function describeTo(Description $description): void
{
$description->appendText($this->_empty ? 'an empty string' : 'a non-empty string');
}
@@ -43,7 +43,7 @@ public function describeTo(Description $description)
*
* @factory emptyString
*/
- public static function isEmptyString()
+ public static function isEmptyString(): self
{
if (!self::$_INSTANCE) {
self::$_INSTANCE = new self(true);
@@ -57,7 +57,7 @@ public static function isEmptyString()
*
* @factory nullOrEmptyString
*/
- public static function isEmptyOrNullString()
+ public static function isEmptyOrNullString(): AnyOf
{
if (!self::$_NULL_OR_EMPTY_INSTANCE) {
self::$_NULL_OR_EMPTY_INSTANCE = AnyOf::anyOf(
@@ -74,7 +74,7 @@ public static function isEmptyOrNullString()
*
* @factory nonEmptyString
*/
- public static function isNonEmptyString()
+ public static function isNonEmptyString(): self
{
if (!self::$_NOT_INSTANCE) {
self::$_NOT_INSTANCE = new self(false);
diff --git a/hamcrest/Hamcrest/Text/IsEqualIgnoringCase.php b/hamcrest/Hamcrest/Text/IsEqualIgnoringCase.php
index 3836a8c37..027923f8d 100644
--- a/hamcrest/Hamcrest/Text/IsEqualIgnoringCase.php
+++ b/hamcrest/Hamcrest/Text/IsEqualIgnoringCase.php
@@ -12,9 +12,14 @@
*/
class IsEqualIgnoringCase extends TypeSafeMatcher
{
-
+ /**
+ * @var mixed
+ */
private $_string;
+ /**
+ * @param mixed $string
+ */
public function __construct($string)
{
parent::__construct(self::TYPE_STRING);
@@ -22,17 +27,17 @@ public function __construct($string)
$this->_string = $string;
}
- protected function matchesSafely($item)
+ protected function matchesSafely($item): bool
{
return strtolower($this->_string) === strtolower($item);
}
- protected function describeMismatchSafely($item, Description $mismatchDescription)
+ protected function describeMismatchSafely($item, Description $mismatchDescription): void
{
$mismatchDescription->appendText('was ')->appendText($item);
}
- public function describeTo(Description $description)
+ public function describeTo(Description $description): void
{
$description->appendText('equalToIgnoringCase(')
->appendValue($this->_string)
@@ -44,8 +49,9 @@ public function describeTo(Description $description)
* Matches if value is a string equal to $string, regardless of the case.
*
* @factory
+ * @param mixed $string
*/
- public static function equalToIgnoringCase($string)
+ public static function equalToIgnoringCase($string): self
{
return new self($string);
}
diff --git a/hamcrest/Hamcrest/Text/IsEqualIgnoringWhiteSpace.php b/hamcrest/Hamcrest/Text/IsEqualIgnoringWhiteSpace.php
index 853692b03..3127552e4 100644
--- a/hamcrest/Hamcrest/Text/IsEqualIgnoringWhiteSpace.php
+++ b/hamcrest/Hamcrest/Text/IsEqualIgnoringWhiteSpace.php
@@ -13,9 +13,14 @@
*/
class IsEqualIgnoringWhiteSpace extends TypeSafeMatcher
{
-
+ /**
+ * @var mixed
+ */
private $_string;
+ /**
+ * @param mixed $string
+ */
public function __construct($string)
{
parent::__construct(self::TYPE_STRING);
@@ -23,18 +28,18 @@ public function __construct($string)
$this->_string = $string;
}
- protected function matchesSafely($item)
+ protected function matchesSafely($item): bool
{
return (strtolower($this->_stripSpace($item))
=== strtolower($this->_stripSpace($this->_string)));
}
- protected function describeMismatchSafely($item, Description $mismatchDescription)
+ protected function describeMismatchSafely($item, Description $mismatchDescription): void
{
$mismatchDescription->appendText('was ')->appendText($item);
}
- public function describeTo(Description $description)
+ public function describeTo(Description $description): void
{
$description->appendText('equalToIgnoringWhiteSpace(')
->appendValue($this->_string)
@@ -46,15 +51,16 @@ public function describeTo(Description $description)
* Matches if value is a string equal to $string, regardless of whitespace.
*
* @factory
+ * @param mixed $string
*/
- public static function equalToIgnoringWhiteSpace($string)
+ public static function equalToIgnoringWhiteSpace($string): self
{
return new self($string);
}
// -- Private Methods
- private function _stripSpace($string)
+ private function _stripSpace(string $string): string
{
$parts = preg_split("/[\r\n\t ]+/", $string);
foreach ($parts as $i => $part) {
diff --git a/hamcrest/Hamcrest/Text/MatchesPattern.php b/hamcrest/Hamcrest/Text/MatchesPattern.php
index fa0d68eea..639759408 100644
--- a/hamcrest/Hamcrest/Text/MatchesPattern.php
+++ b/hamcrest/Hamcrest/Text/MatchesPattern.php
@@ -10,7 +10,9 @@
*/
class MatchesPattern extends SubstringMatcher
{
-
+ /**
+ * @param mixed $pattern
+ */
public function __construct($pattern)
{
parent::__construct($pattern);
@@ -20,20 +22,21 @@ public function __construct($pattern)
* Matches if value is a string that matches regular expression $pattern.
*
* @factory
+ * @param mixed $pattern
*/
- public static function matchesPattern($pattern)
+ public static function matchesPattern($pattern): self
{
return new self($pattern);
}
// -- Protected Methods
- protected function evalSubstringOf($item)
+ protected function evalSubstringOf(string $item): bool
{
return preg_match($this->_substring, (string) $item) >= 1;
}
- protected function relationship()
+ protected function relationship(): string
{
return 'matching';
}
diff --git a/hamcrest/Hamcrest/Text/StringContains.php b/hamcrest/Hamcrest/Text/StringContains.php
index b92786b60..65284dbe0 100644
--- a/hamcrest/Hamcrest/Text/StringContains.php
+++ b/hamcrest/Hamcrest/Text/StringContains.php
@@ -10,13 +10,15 @@
*/
class StringContains extends SubstringMatcher
{
-
+ /**
+ * @param mixed $substring
+ */
public function __construct($substring)
{
parent::__construct($substring);
}
- public function ignoringCase()
+ public function ignoringCase(): StringContainsIgnoringCase
{
return new StringContainsIgnoringCase($this->_substring);
}
@@ -25,20 +27,21 @@ public function ignoringCase()
* Matches if value is a string that contains $substring.
*
* @factory
+ * @param mixed $substring
*/
- public static function containsString($substring)
+ public static function containsString($substring): self
{
return new self($substring);
}
// -- Protected Methods
- protected function evalSubstringOf($item)
+ protected function evalSubstringOf(string $item): bool
{
return (false !== strpos((string) $item, $this->_substring));
}
- protected function relationship()
+ protected function relationship(): string
{
return 'containing';
}
diff --git a/hamcrest/Hamcrest/Text/StringContainsIgnoringCase.php b/hamcrest/Hamcrest/Text/StringContainsIgnoringCase.php
index 69f37c258..53d55eecb 100644
--- a/hamcrest/Hamcrest/Text/StringContainsIgnoringCase.php
+++ b/hamcrest/Hamcrest/Text/StringContainsIgnoringCase.php
@@ -11,6 +11,9 @@
class StringContainsIgnoringCase extends SubstringMatcher
{
+ /**
+ * @param mixed $substring
+ */
public function __construct($substring)
{
parent::__construct($substring);
@@ -20,20 +23,21 @@ public function __construct($substring)
* Matches if value is a string that contains $substring regardless of the case.
*
* @factory
+ * @param mixed $substring
*/
- public static function containsStringIgnoringCase($substring)
+ public static function containsStringIgnoringCase($substring): self
{
return new self($substring);
}
// -- Protected Methods
- protected function evalSubstringOf($item)
+ protected function evalSubstringOf(string $item): bool
{
return (false !== stripos((string) $item, $this->_substring));
}
- protected function relationship()
+ protected function relationship(): string
{
return 'containing in any case';
}
diff --git a/hamcrest/Hamcrest/Text/StringContainsInOrder.php b/hamcrest/Hamcrest/Text/StringContainsInOrder.php
index e75de65d2..33b3ab638 100644
--- a/hamcrest/Hamcrest/Text/StringContainsInOrder.php
+++ b/hamcrest/Hamcrest/Text/StringContainsInOrder.php
@@ -12,9 +12,14 @@
*/
class StringContainsInOrder extends TypeSafeMatcher
{
+ /**
+ * @var arraytoString or
* __toString() method returns a value equalTo the specified string.
+ *
+ * @param mixed $matcher
*/
function hasToString($matcher): \Hamcrest\Core\HasToString
{
@@ -336,6 +339,7 @@ function hasToString($matcher): \Hamcrest\Core\HasToString
*
* For example: assertThat($cheese, equalTo($smelly))
* vs. assertThat($cheese, is(equalTo($smelly)))
+ *
* @param mixed $value
*/
function is($value): \Hamcrest\Core\Is
@@ -349,8 +353,6 @@ function is($value): \Hamcrest\Core\Is
* This matcher always evaluates to true.
*
* @param string $description A meaningful string used when describing itself.
- *
- * @return \Hamcrest\Core\IsAnything
*/
function anything(string $description = 'ANYTHING'): \Hamcrest\Core\IsAnything
{
@@ -397,6 +399,7 @@ function hasItems(/* args... */): \Hamcrest\Core\AllOf
/**
* Is the value equal to another value, as tested by the use of the "=="
* comparison operator?
+ *
* @param mixed $item
*/
function equalTo($item): \Hamcrest\Core\IsEqual
@@ -408,6 +411,7 @@ function equalTo($item): \Hamcrest\Core\IsEqual
if (!function_exists('identicalTo')) {
/**
* Tests of the value is identical to $value as tested by the "===" operator.
+ *
* @param mixed $value
*/
function identicalTo($value): \Hamcrest\Core\IsIdentical
@@ -445,6 +449,7 @@ function any(string $theClass): \Hamcrest\Core\IsInstanceOf
if (!function_exists('not')) {
/**
* Matches if value does not match $value.
+ *
* @param mixed $value
*/
function not($value): \Hamcrest\Core\IsNot
@@ -492,6 +497,8 @@ function sameInstance($object): \Hamcrest\Core\IsSame
if (!function_exists('typeOf')) {
/**
* Is the value a particular built-in type?
+ *
+ * @param string $theType
*/
function typeOf(string $theType): \Hamcrest\Core\IsTypeOf
{
@@ -502,6 +509,7 @@ function typeOf(string $theType): \Hamcrest\Core\IsTypeOf
if (!function_exists('set')) {
/**
* Matches if value (class, object, or array) has named $property.
+ *
* @param mixed $property
*/
function set($property): \Hamcrest\Core\Set
@@ -513,6 +521,7 @@ function set($property): \Hamcrest\Core\Set
if (!function_exists('notSet')) {
/**
* Matches if value (class, object, or array) does not have named $property.
+ *
* @param mixed $property
*/
function notSet($property): \Hamcrest\Core\Set
@@ -525,6 +534,7 @@ function notSet($property): \Hamcrest\Core\Set
/**
* Matches if value is a number equal to $value within some range of
* acceptable error $delta.
+ *
* @param mixed $value
* @param mixed $delta
*/
@@ -537,6 +547,7 @@ function closeTo($value, $delta): \Hamcrest\Number\IsCloseTo
if (!function_exists('comparesEqualTo')) {
/**
* The value is not > $value, nor < $value.
+ *
* @param mixed $value
*/
function comparesEqualTo($value): \Hamcrest\Number\OrderingComparison
@@ -548,6 +559,7 @@ function comparesEqualTo($value): \Hamcrest\Number\OrderingComparison
if (!function_exists('greaterThan')) {
/**
* The value is > $value.
+ *
* @param mixed $value
*/
function greaterThan($value): \Hamcrest\Number\OrderingComparison
@@ -559,6 +571,7 @@ function greaterThan($value): \Hamcrest\Number\OrderingComparison
if (!function_exists('greaterThanOrEqualTo')) {
/**
* The value is >= $value.
+ *
* @param mixed $value
*/
function greaterThanOrEqualTo($value): \Hamcrest\Number\OrderingComparison
@@ -570,6 +583,7 @@ function greaterThanOrEqualTo($value): \Hamcrest\Number\OrderingComparison
if (!function_exists('atLeast')) {
/**
* The value is >= $value.
+ *
* @param mixed $value
*/
function atLeast($value): \Hamcrest\Number\OrderingComparison
@@ -581,6 +595,7 @@ function atLeast($value): \Hamcrest\Number\OrderingComparison
if (!function_exists('lessThan')) {
/**
* The value is < $value.
+ *
* @param mixed $value
*/
function lessThan($value): \Hamcrest\Number\OrderingComparison
@@ -592,6 +607,7 @@ function lessThan($value): \Hamcrest\Number\OrderingComparison
if (!function_exists('lessThanOrEqualTo')) {
/**
* The value is <= $value.
+ *
* @param mixed $value
*/
function lessThanOrEqualTo($value): \Hamcrest\Number\OrderingComparison
@@ -603,6 +619,7 @@ function lessThanOrEqualTo($value): \Hamcrest\Number\OrderingComparison
if (!function_exists('atMost')) {
/**
* The value is <= $value.
+ *
* @param mixed $value
*/
function atMost($value): \Hamcrest\Number\OrderingComparison
@@ -674,6 +691,7 @@ function nonEmptyString(): \Hamcrest\Text\IsEmptyString
if (!function_exists('equalToIgnoringCase')) {
/**
* Matches if value is a string equal to $string, regardless of the case.
+ *
* @param mixed $string
*/
function equalToIgnoringCase($string): \Hamcrest\Text\IsEqualIgnoringCase
@@ -685,6 +703,7 @@ function equalToIgnoringCase($string): \Hamcrest\Text\IsEqualIgnoringCase
if (!function_exists('equalToIgnoringWhiteSpace')) {
/**
* Matches if value is a string equal to $string, regardless of whitespace.
+ *
* @param mixed $string
*/
function equalToIgnoringWhiteSpace($string): \Hamcrest\Text\IsEqualIgnoringWhiteSpace
@@ -696,6 +715,7 @@ function equalToIgnoringWhiteSpace($string): \Hamcrest\Text\IsEqualIgnoringWhite
if (!function_exists('matchesPattern')) {
/**
* Matches if value is a string that matches regular expression $pattern.
+ *
* @param mixed $pattern
*/
function matchesPattern($pattern): \Hamcrest\Text\MatchesPattern
@@ -707,6 +727,7 @@ function matchesPattern($pattern): \Hamcrest\Text\MatchesPattern
if (!function_exists('containsString')) {
/**
* Matches if value is a string that contains $substring.
+ *
* @param mixed $substring
*/
function containsString($substring): \Hamcrest\Text\StringContains
@@ -718,6 +739,7 @@ function containsString($substring): \Hamcrest\Text\StringContains
if (!function_exists('containsStringIgnoringCase')) {
/**
* Matches if value is a string that contains $substring regardless of the case.
+ *
* @param mixed $substring
*/
function containsStringIgnoringCase($substring): \Hamcrest\Text\StringContainsIgnoringCase
@@ -740,6 +762,7 @@ function stringContainsInOrder(/* args... */): \Hamcrest\Text\StringContainsInOr
if (!function_exists('endsWith')) {
/**
* Matches if value is a string that ends with $substring.
+ *
* @param mixed $substring
*/
function endsWith($substring): \Hamcrest\Text\StringEndsWith
@@ -751,6 +774,7 @@ function endsWith($substring): \Hamcrest\Text\StringEndsWith
if (!function_exists('startsWith')) {
/**
* Matches if value is a string that starts with $substring.
+ *
* @param mixed $substring
*/
function startsWith($substring): \Hamcrest\Text\StringStartsWith
@@ -904,10 +928,11 @@ function stringValue(): \Hamcrest\Type\IsString
* Wraps $matcher with {@link Hamcrest\Core\IsEqual)
* if it's not a matcher and the XPath in count()
* if it's an integer.
+ *
* @param string $xpath
* @param null|Matcher|int|mixed $matcher
*/
- function hasXPath($xpath, $matcher = null): \Hamcrest\Xml\HasXPath
+ function hasXPath(string $xpath, $matcher = null): \Hamcrest\Xml\HasXPath
{
return \Hamcrest\Xml\HasXPath::hasXPath($xpath, $matcher);
}
diff --git a/hamcrest/Hamcrest/Matchers.php b/hamcrest/Hamcrest/Matchers.php
index 37db6eea1..b7e62a1cb 100644
--- a/hamcrest/Hamcrest/Matchers.php
+++ b/hamcrest/Hamcrest/Matchers.php
@@ -8,15 +8,6 @@
namespace Hamcrest;
-use Hamcrest\Arrays\IsArray;
-use Hamcrest\Arrays\IsArrayContainingInAnyOrder;
-use Hamcrest\Arrays\IsArrayContainingInOrder;
-use Hamcrest\Core\AllOf;
-use Hamcrest\Core\AnyOf;
-use Hamcrest\Core\DescribedAs;
-use Hamcrest\Core\IsCollectionContaining;
-use Hamcrest\Text\StringContainsInOrder;
-
/**
* A series of static factories for all hamcrest matchers.
*/
@@ -26,7 +17,7 @@ class Matchers
/**
* Evaluates to true only if each $matcher[$i] is satisfied by $array[$i].
*/
- public static function anArray(/* args... */): IsArray
+ public static function anArray(/* args... */): \Hamcrest\Arrays\IsArray
{
$args = func_get_args();
return call_user_func_array(array('\Hamcrest\Arrays\IsArray', 'anArray'), $args);
@@ -59,7 +50,7 @@ public static function hasValue($item): \Hamcrest\Arrays\IsArrayContaining
/**
* An array with elements that match the given matchers.
*/
- public static function arrayContainingInAnyOrder(/* args... */): IsArrayContainingInAnyOrder
+ public static function arrayContainingInAnyOrder(/* args... */): \Hamcrest\Arrays\IsArrayContainingInAnyOrder
{
$args = func_get_args();
return call_user_func_array(array('\Hamcrest\Arrays\IsArrayContainingInAnyOrder', 'arrayContainingInAnyOrder'), $args);
@@ -68,7 +59,7 @@ public static function arrayContainingInAnyOrder(/* args... */): IsArrayContaini
/**
* An array with elements that match the given matchers.
*/
- public static function containsInAnyOrder(/* args... */): IsArrayContainingInAnyOrder
+ public static function containsInAnyOrder(/* args... */): \Hamcrest\Arrays\IsArrayContainingInAnyOrder
{
$args = func_get_args();
return call_user_func_array(array('\Hamcrest\Arrays\IsArrayContainingInAnyOrder', 'arrayContainingInAnyOrder'), $args);
@@ -77,7 +68,7 @@ public static function containsInAnyOrder(/* args... */): IsArrayContainingInAny
/**
* An array with elements that match the given matchers in the same order.
*/
- public static function arrayContaining(/* args... */): IsArrayContainingInOrder
+ public static function arrayContaining(/* args... */): \Hamcrest\Arrays\IsArrayContainingInOrder
{
$args = func_get_args();
return call_user_func_array(array('\Hamcrest\Arrays\IsArrayContainingInOrder', 'arrayContaining'), $args);
@@ -86,7 +77,7 @@ public static function arrayContaining(/* args... */): IsArrayContainingInOrder
/**
* An array with elements that match the given matchers in the same order.
*/
- public static function contains(/* args... */): IsArrayContainingInOrder
+ public static function contains(/* args... */): \Hamcrest\Arrays\IsArrayContainingInOrder
{
$args = func_get_args();
return call_user_func_array(array('\Hamcrest\Arrays\IsArrayContainingInOrder', 'arrayContaining'), $args);
@@ -118,6 +109,7 @@ public static function hasKey($key): \Hamcrest\Arrays\IsArrayContainingKey
/**
* Test if an array has both an key and value in parity with each other.
+ *
* @param mixed $key
* @param mixed $value
*/
@@ -128,6 +120,7 @@ public static function hasKeyValuePair($key, $value): \Hamcrest\Arrays\IsArrayCo
/**
* Test if an array has both an key and value in parity with each other.
+ *
* @param mixed $key
* @param mixed $value
*/
@@ -182,6 +175,7 @@ public static function nonEmptyTraversable(): \Hamcrest\Collection\IsEmptyTraver
/**
* Does traversable size satisfy a given matcher?
+ *
* @param mixed $size
*/
public static function traversableWithSize($size): \Hamcrest\Collection\IsTraversableWithSize
@@ -192,7 +186,7 @@ public static function traversableWithSize($size): \Hamcrest\Collection\IsTraver
/**
* Evaluates to true only if ALL of the passed in matchers evaluate to true.
*/
- public static function allOf(/* args... */): AllOf
+ public static function allOf(/* args... */): \Hamcrest\Core\AllOf
{
$args = func_get_args();
return call_user_func_array(array('\Hamcrest\Core\AllOf', 'allOf'), $args);
@@ -201,7 +195,7 @@ public static function allOf(/* args... */): AllOf
/**
* Evaluates to true if ANY of the passed in matchers evaluate to true.
*/
- public static function anyOf(/* args... */): AnyOf
+ public static function anyOf(/* args... */): \Hamcrest\Core\AnyOf
{
$args = func_get_args();
return call_user_func_array(array('\Hamcrest\Core\AnyOf', 'anyOf'), $args);
@@ -210,7 +204,7 @@ public static function anyOf(/* args... */): AnyOf
/**
* Evaluates to false if ANY of the passed in matchers evaluate to true.
*/
- public static function noneOf(/* args... */): AnyOf
+ public static function noneOf(/* args... */): \Hamcrest\Core\IsNot
{
$args = func_get_args();
return call_user_func_array(array('\Hamcrest\Core\AnyOf', 'noneOf'), $args);
@@ -243,14 +237,14 @@ public static function either(\Hamcrest\Matcher $matcher): \Hamcrest\Core\Combin
/**
* Wraps an existing matcher and overrides the description when it fails.
*/
- public static function describedAs(/* args... */): DescribedAs
+ public static function describedAs(/* args... */): \Hamcrest\Core\DescribedAs
{
$args = func_get_args();
return call_user_func_array(array('\Hamcrest\Core\DescribedAs', 'describedAs'), $args);
}
/**
- * @param Matcher $itemMatcher
+ * @param \Hamcrest\Matcher $itemMatcher
* A matcher to apply to every element in an array.
*
* @return \Hamcrest\Core\Every
@@ -264,6 +258,8 @@ public static function everyItem(\Hamcrest\Matcher $itemMatcher): \Hamcrest\Core
/**
* Creates a matcher that matches any examined object whose toString or
* __toString() method returns a value equalTo the specified string.
+ *
+ * @param mixed $matcher
*/
public static function hasToString($matcher): \Hamcrest\Core\HasToString
{
@@ -276,6 +272,7 @@ public static function hasToString($matcher): \Hamcrest\Core\HasToString
*
* For example: assertThat($cheese, equalTo($smelly))
* vs. assertThat($cheese, is(equalTo($smelly)))
+ *
* @param mixed $value
*/
public static function is($value): \Hamcrest\Core\Is
@@ -287,8 +284,6 @@ public static function is($value): \Hamcrest\Core\Is
* This matcher always evaluates to true.
*
* @param string $description A meaningful string used when describing itself.
- *
- * @return \Hamcrest\Core\IsAnything
*/
public static function anything(string $description = 'ANYTHING'): \Hamcrest\Core\IsAnything
{
@@ -305,7 +300,7 @@ public static function anything(string $description = 'ANYTHING'): \Hamcrest\Cor
* assertThat(array('a', 'b'), hasItem('b'));
*
*/
- public static function hasItem(/* args... */): IsCollectionContaining
+ public static function hasItem(/* args... */): \Hamcrest\Core\IsCollectionContaining
{
$args = func_get_args();
return call_user_func_array(array('\Hamcrest\Core\IsCollectionContaining', 'hasItem'), $args);
@@ -320,7 +315,7 @@ public static function hasItem(/* args... */): IsCollectionContaining
* assertThat(array('a', 'b', 'c'), hasItems(equalTo('a'), equalTo('b')));
*
*/
- public static function hasItems(/* args... */): IsCollectionContaining
+ public static function hasItems(/* args... */): \Hamcrest\Core\AllOf
{
$args = func_get_args();
return call_user_func_array(array('\Hamcrest\Core\IsCollectionContaining', 'hasItems'), $args);
@@ -329,6 +324,7 @@ public static function hasItems(/* args... */): IsCollectionContaining
/**
* Is the value equal to another value, as tested by the use of the "=="
* comparison operator?
+ *
* @param mixed $item
*/
public static function equalTo($item): \Hamcrest\Core\IsEqual
@@ -338,6 +334,7 @@ public static function equalTo($item): \Hamcrest\Core\IsEqual
/**
* Tests of the value is identical to $value as tested by the "===" operator.
+ *
* @param mixed $value
*/
public static function identicalTo($value): \Hamcrest\Core\IsIdentical
@@ -369,6 +366,7 @@ public static function any(string $theClass): \Hamcrest\Core\IsInstanceOf
/**
* Matches if value does not match $value.
+ *
* @param mixed $value
*/
public static function not($value): \Hamcrest\Core\IsNot
@@ -387,7 +385,7 @@ public static function nullValue(): \Hamcrest\Core\IsNull
/**
* Matches if value is not null.
*/
- public static function notNullValue(): Matcher
+ public static function notNullValue(): \Hamcrest\Core\IsNot
{
return \Hamcrest\Core\IsNull::notNullValue();
}
@@ -408,6 +406,8 @@ public static function sameInstance($object): \Hamcrest\Core\IsSame
/**
* Is the value a particular built-in type?
+ *
+ * @param string $theType
*/
public static function typeOf(string $theType): \Hamcrest\Core\IsTypeOf
{
@@ -416,6 +416,7 @@ public static function typeOf(string $theType): \Hamcrest\Core\IsTypeOf
/**
* Matches if value (class, object, or array) has named $property.
+ *
* @param mixed $property
*/
public static function set($property): \Hamcrest\Core\Set
@@ -425,6 +426,7 @@ public static function set($property): \Hamcrest\Core\Set
/**
* Matches if value (class, object, or array) does not have named $property.
+ *
* @param mixed $property
*/
public static function notSet($property): \Hamcrest\Core\Set
@@ -435,6 +437,7 @@ public static function notSet($property): \Hamcrest\Core\Set
/**
* Matches if value is a number equal to $value within some range of
* acceptable error $delta.
+ *
* @param mixed $value
* @param mixed $delta
*/
@@ -445,6 +448,7 @@ public static function closeTo($value, $delta): \Hamcrest\Number\IsCloseTo
/**
* The value is not > $value, nor < $value.
+ *
* @param mixed $value
*/
public static function comparesEqualTo($value): \Hamcrest\Number\OrderingComparison
@@ -454,6 +458,7 @@ public static function comparesEqualTo($value): \Hamcrest\Number\OrderingCompari
/**
* The value is > $value.
+ *
* @param mixed $value
*/
public static function greaterThan($value): \Hamcrest\Number\OrderingComparison
@@ -463,6 +468,7 @@ public static function greaterThan($value): \Hamcrest\Number\OrderingComparison
/**
* The value is >= $value.
+ *
* @param mixed $value
*/
public static function greaterThanOrEqualTo($value): \Hamcrest\Number\OrderingComparison
@@ -472,6 +478,7 @@ public static function greaterThanOrEqualTo($value): \Hamcrest\Number\OrderingCo
/**
* The value is >= $value.
+ *
* @param mixed $value
*/
public static function atLeast($value): \Hamcrest\Number\OrderingComparison
@@ -481,6 +488,7 @@ public static function atLeast($value): \Hamcrest\Number\OrderingComparison
/**
* The value is < $value.
+ *
* @param mixed $value
*/
public static function lessThan($value): \Hamcrest\Number\OrderingComparison
@@ -490,6 +498,7 @@ public static function lessThan($value): \Hamcrest\Number\OrderingComparison
/**
* The value is <= $value.
+ *
* @param mixed $value
*/
public static function lessThanOrEqualTo($value): \Hamcrest\Number\OrderingComparison
@@ -499,6 +508,7 @@ public static function lessThanOrEqualTo($value): \Hamcrest\Number\OrderingCompa
/**
* The value is <= $value.
+ *
* @param mixed $value
*/
public static function atMost($value): \Hamcrest\Number\OrderingComparison
@@ -525,7 +535,7 @@ public static function emptyString(): \Hamcrest\Text\IsEmptyString
/**
* Matches if value is null or a zero-length string.
*/
- public static function isEmptyOrNullString(): Matcher
+ public static function isEmptyOrNullString(): \Hamcrest\Core\AnyOf
{
return \Hamcrest\Text\IsEmptyString::isEmptyOrNullString();
}
@@ -533,7 +543,7 @@ public static function isEmptyOrNullString(): Matcher
/**
* Matches if value is null or a zero-length string.
*/
- public static function nullOrEmptyString(): Matcher
+ public static function nullOrEmptyString(): \Hamcrest\Core\AnyOf
{
return \Hamcrest\Text\IsEmptyString::isEmptyOrNullString();
}
@@ -556,6 +566,7 @@ public static function nonEmptyString(): \Hamcrest\Text\IsEmptyString
/**
* Matches if value is a string equal to $string, regardless of the case.
+ *
* @param mixed $string
*/
public static function equalToIgnoringCase($string): \Hamcrest\Text\IsEqualIgnoringCase
@@ -565,6 +576,7 @@ public static function equalToIgnoringCase($string): \Hamcrest\Text\IsEqualIgnor
/**
* Matches if value is a string equal to $string, regardless of whitespace.
+ *
* @param mixed $string
*/
public static function equalToIgnoringWhiteSpace($string): \Hamcrest\Text\IsEqualIgnoringWhiteSpace
@@ -574,6 +586,7 @@ public static function equalToIgnoringWhiteSpace($string): \Hamcrest\Text\IsEqua
/**
* Matches if value is a string that matches regular expression $pattern.
+ *
* @param mixed $pattern
*/
public static function matchesPattern($pattern): \Hamcrest\Text\MatchesPattern
@@ -583,6 +596,7 @@ public static function matchesPattern($pattern): \Hamcrest\Text\MatchesPattern
/**
* Matches if value is a string that contains $substring.
+ *
* @param mixed $substring
*/
public static function containsString($substring): \Hamcrest\Text\StringContains
@@ -592,6 +606,7 @@ public static function containsString($substring): \Hamcrest\Text\StringContains
/**
* Matches if value is a string that contains $substring regardless of the case.
+ *
* @param mixed $substring
*/
public static function containsStringIgnoringCase($substring): \Hamcrest\Text\StringContainsIgnoringCase
@@ -602,7 +617,7 @@ public static function containsStringIgnoringCase($substring): \Hamcrest\Text\St
/**
* Matches if value contains $substrings in a constrained order.
*/
- public static function stringContainsInOrder(/* args... */): StringContainsInOrder
+ public static function stringContainsInOrder(/* args... */): \Hamcrest\Text\StringContainsInOrder
{
$args = func_get_args();
return call_user_func_array(array('\Hamcrest\Text\StringContainsInOrder', 'stringContainsInOrder'), $args);
@@ -610,6 +625,7 @@ public static function stringContainsInOrder(/* args... */): StringContainsInOrd
/**
* Matches if value is a string that ends with $substring.
+ *
* @param mixed $substring
*/
public static function endsWith($substring): \Hamcrest\Text\StringEndsWith
@@ -619,6 +635,7 @@ public static function endsWith($substring): \Hamcrest\Text\StringEndsWith
/**
* Matches if value is a string that starts with $substring.
+ *
* @param mixed $substring
*/
public static function startsWith($substring): \Hamcrest\Text\StringStartsWith
@@ -742,6 +759,8 @@ public static function stringValue(): \Hamcrest\Type\IsString
* Wraps $matcher with {@link Hamcrest\Core\IsEqual)
* if it's not a matcher and the XPath in count()
* if it's an integer.
+ *
+ * @param string $xpath
* @param null|Matcher|int|mixed $matcher
*/
public static function hasXPath(string $xpath, $matcher = null): \Hamcrest\Xml\HasXPath
From fb89dbcfba2b6fd3b3d68154f60e735c9c2ae231 Mon Sep 17 00:00:00 2001
From: Philipp Scheit