\PHPUnit_Framework_Constraint_IsType
Constraint that asserts that the value it is evaluated for is of a specified type.
The expected value is passed in the constructor.
- Author: Sebastian Bergmann <sebastian@phpunit.de>
- Copyright: 2001-2014 Sebastian Bergmann <sebastian@phpunit.de>
- License: http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
Synopsis
- // constants
- const TYPE_ARRAY = 'array';
- const TYPE_BOOL = 'bool';
- const TYPE_FLOAT = 'float';
- const TYPE_INT = 'int';
- const TYPE_NULL = 'null';
- const TYPE_NUMERIC = 'numeric';
- const TYPE_OBJECT = 'object';
- const TYPE_RESOURCE = 'resource';
- const TYPE_STRING = 'string';
- const TYPE_SCALAR = 'scalar';
- const TYPE_CALLABLE = 'callable';
- // Inherited members from PHPUnit_Framework_Constraint
- protected $exporter;
- // methods
- public void __construct()
- protected bool matches()
- public string toString()
- // Inherited methods from PHPUnit_Framework_Constraint
- public void __construct()
- public mixed evaluate()
- protected bool matches()
- public integer count()
- protected void fail()
- protected string additionalFailureDescription()
- protected string failureDescription()
Hierarchy
Extends
Violations
PHPMessDetector
Line | Rule | Message |
---|---|---|
128 - 177 | CyclomaticComplexity | The method matches() has a Cyclomatic Complexity of 14. The configured cyclomatic complexity threshold is 10. |
Checkstyle
Line | Column | Severity | Message |
---|---|---|---|
131 | 13 | error | CASE statements must not be defined using curly braces |
136 | 13 | error | CASE statements must not be defined using curly braces |
140 | 13 | error | CASE statements must not be defined using curly braces |
144 | 13 | error | CASE statements must not be defined using curly braces |
149 | 13 | error | CASE statements must not be defined using curly braces |
153 | 13 | error | CASE statements must not be defined using curly braces |
157 | 13 | error | CASE statements must not be defined using curly braces |
161 | 13 | error | CASE statements must not be defined using curly braces |
165 | 13 | error | CASE statements must not be defined using curly braces |
169 | 13 | error | CASE statements must not be defined using curly braces |
173 | 13 | error | CASE statements must not be defined using curly braces |
Constants
Name | Value |
---|---|
TYPE_ARRAY | 'array' |
TYPE_BOOL | 'bool' |
TYPE_FLOAT | 'float' |
TYPE_INT | 'int' |
TYPE_NULL | 'null' |
TYPE_NUMERIC | 'numeric' |
TYPE_OBJECT | 'object' |
TYPE_RESOURCE | 'resource' |
TYPE_STRING | 'string' |
TYPE_SCALAR | 'scalar' |
TYPE_CALLABLE | 'callable' |
Members
protected
- $exporter
- $type — string
- $types — array
Methods
protected
- matches() — Evaluates the constraint for parameter $other. Returns true if the constraint is met, false otherwise.
public
- __construct()
- toString() — Returns a string representation of the constraint.
Inherited from PHPUnit_Framework_Constraint
protected
- additionalFailureDescription() — Return additional failure description where needed
- fail() — Throws an exception for the given compared value and test description
- failureDescription() — Returns the description of the failure
- matches() — Evaluates the constraint for parameter $other. Returns true if the constraint is met, false otherwise.
public
- count() — Counts the number of constraint elements.
- evaluate() — Evaluates the constraint for parameter $other
History
-
2014-08-12T07:25:32+02:00 (commit #55caa21)
Author: Sebastian Bergmann (sb@sebastian-bergmann.de) / Commiter: Sebastian Bergmann (sb@sebastian-bergmann.de)
Fix CS/WS issues
-
2014-08-12T06:43:31+02:00 (commit #50dfaba)
Author: Sebastian Bergmann (sb@sebastian-bergmann.de) / Commiter: Sebastian Bergmann (sb@sebastian-bergmann.de)
phpcbf --standard=PSR2 src tests
-
2014-01-22T19:43:07+01:00 (commit #02b42d7)
Author: Sebastian Bergmann (sb@sebastian-bergmann.de) / Commiter: Sebastian Bergmann (sb@sebastian-bergmann.de)
Initial work on formatting code according to PSR-2
-
2014-01-20T17:21:13+01:00 (commit #3a5808f)
Author: Sebastian Bergmann (sb@sebastian-bergmann.de) / Commiter: Sebastian Bergmann (sb@sebastian-bergmann.de)
Cleanup
-
2014-01-09T08:11:47+01:00 (commit #205e008)
Author: Sebastian Bergmann (sb@sebastian-bergmann.de) / Commiter: Sebastian Bergmann (sb@sebastian-bergmann.de)
Bump copyright year
-
2013-02-16T12:26:43+01:00 (commit #b8b3e1f)
Author: Sebastian Bergmann (sb@sebastian-bergmann.de) / Commiter: Sebastian Bergmann (sb@sebastian-bergmann.de)
Replace PHPUnit_Util_Type with SebastianBergmann\Exporter
-
2013-01-07T11:37:52+01:00 (commit #c517984)
Author: Sebastian Bergmann (sb@sebastian-bergmann.de) / Commiter: Sebastian Bergmann (sb@sebastian-bergmann.de)
Bump copyright year
-
2012-09-24T06:47:44+02:00 (commit #81ab540)
Author: Sebastian Bergmann (sb@sebastian-bergmann.de) / Commiter: Sebastian Bergmann (sb@sebastian-bergmann.de)
Do not perform string replacement for @package_version@ anymore.
-
2012-04-30T12:02:38+02:00 (commit #5786e50)
Author: Sebastian Bergmann (sb@sebastian-bergmann.de) / Commiter: Sebastian Bergmann (sb@sebastian-bergmann.de)
List The BSD 3-Clause License correctly and consistently. Thanks to Christian Aistleitner <christian@quelltextlich.at> for bringing this issue to my attention.
-
2012-01-01T11:21:16+01:00 (commit #aae6c38)
Author: Sebastian Bergmann (sb@sebastian-bergmann.de) / Commiter: Sebastian Bergmann (sb@sebastian-bergmann.de)
Bump copyright year.
-
2011-12-27T10:21:52+01:00 (commit #37cacc9)
Author: Sebastian Bergmann (sb@sebastian-bergmann.de) / Commiter: Sebastian Bergmann (sb@sebastian-bergmann.de)
PHPUnit no longer throws exceptions that do not extend PHPUnit_Framework_Exception.
-
2011-10-26T12:19:28+02:00 (commit #bfc351c)
Author: Sebastian Bergmann (sb@sebastian-bergmann.de) / Commiter: Sebastian Bergmann (sb@sebastian-bergmann.de)
Fix whitespace issues.
-
2011-09-15T16:17:16+02:00 (commit #20410c0)
Author: Sebastian Bergmann (sb@sebastian-bergmann.de) / Commiter: Sebastian Bergmann (sb@sebastian-bergmann.de)
Fix whitespace.
-
2011-09-15T14:53:03+02:00 (commit #d59cba6)
Author: Jan Prieser (jan@prieser.net) / Commiter: Jan Prieser (jan@prieser.net)
Revert "adds missing type "callable" to Constraint IsType"
-
2011-06-14T17:04:40+02:00 (commit #7b37221)
Author: Bernhard Schussek (bschussek@2bepublished.at) / Commiter: Bernhard Schussek (bschussek@2bepublished.at)
Modified constraint subframework to use the new comparator classes
-
2010-12-31T11:45:34+01:00 (commit #bee3344)
Author: Sebastian Bergmann (sb@sebastian-bergmann.de) / Commiter: Sebastian Bergmann (sb@sebastian-bergmann.de)
Bump copyright year.
-
2010-07-07T12:42:23+02:00 (commit #f0d9cdd)
Author: Sebastian Bergmann (sb@sebastian-bergmann.de) / Commiter: Sebastian Bergmann (sb@sebastian-bergmann.de)
Change email address.
-
2010-06-12T20:25:54+02:00 (commit #d19a737)
Author: Mark Story (mark@mark-story.com) / Commiter: Mark Story (mark@mark-story.com)
Removing trailing whitespace from files. Refs #1063
-
2010-04-05T17:41:26+02:00 (commit #471d69e)
Author: Sebastian Bergmann (sb@sebastian-bergmann.de) / Commiter: Sebastian Bergmann (sb@sebastian-bergmann.de)
Add @subpackage annotation.
-
2010-02-02T14:14:29+01:00 (commit #bc1aaaa)
Author: Sebastian Bergmann (sb@sebastian-bergmann.de) / Commiter: Sebastian Bergmann (sb@sebastian-bergmann.de)
Remove closing PHP tags.
-
2010-01-19T09:39:03+01:00 (commit #fb48a69)
Author: Sebastian Bergmann (sb@sebastian-bergmann.de) / Commiter: Sebastian Bergmann (sb@sebastian-bergmann.de)
Initial work on autoloading.
-
2009-12-31T09:26:09+01:00 (commit #37f75ff)
Author: Sebastian Bergmann (sb@sebastian-bergmann.de) / Commiter: Sebastian Bergmann (sb@sebastian-bergmann.de)
Bump copyright year.
-
2009-12-31T09:25:53+01:00 (commit #bddcc5f)
Author: Sebastian Bergmann (sb@sebastian-bergmann.de) / Commiter: Sebastian Bergmann (sb@sebastian-bergmann.de)
Bump copyright year.
-
2009-12-31T09:23:37+01:00 (commit #7a7d0b7)
Author: Sebastian Bergmann (sb@sebastian-bergmann.de) / Commiter: Sebastian Bergmann (sb@sebastian-bergmann.de)
Bump copyright year.
-
2009-12-25T10:32:26+01:00 (commit #60e7125)
Author: Sebastian Bergmann (sb@sebastian-bergmann.de) / Commiter: Sebastian Bergmann (sb@sebastian-bergmann.de)
Remove Subversion keywords.
-
2009-12-25T10:30:57+01:00 (commit #42294ad)
Author: Sebastian Bergmann (sb@sebastian-bergmann.de) / Commiter: Sebastian Bergmann (sb@sebastian-bergmann.de)
Remove Subversion keywords.
-
2009-12-25T10:26:35+01:00 (commit #8617133)
Author: Sebastian Bergmann (sb@sebastian-bergmann.de) / Commiter: Sebastian Bergmann (sb@sebastian-bergmann.de)
Remove Subversion keywords.
-
2009-12-12T13:19:40+01:00 (commit #69f050a)
Author: Sebastian Bergmann (sb@sebastian-bergmann.de) / Commiter: Sebastian Bergmann (sb@sebastian-bergmann.de)
Merge [5434].
-
2009-12-12T13:16:44+01:00 (commit #98484e5)
Author: Sebastian Bergmann (sb@sebastian-bergmann.de) / Commiter: Sebastian Bergmann (sb@sebastian-bergmann.de)
Merge [5434].
-
2009-12-12T13:15:06+01:00 (commit #89245e0)
Author: Sebastian Bergmann (sb@sebastian-bergmann.de) / Commiter: Sebastian Bergmann (sb@sebastian-bergmann.de)
Close #968.
-
2009-11-23T09:39:24+01:00 (commit #1503412)
Author: Sebastian Bergmann (sb@sebastian-bergmann.de) / Commiter: Sebastian Bergmann (sb@sebastian-bergmann.de)
Merge [5389].
-
2009-11-23T09:29:23+01:00 (commit #4c9cf4e)
Author: Sebastian Bergmann (sb@sebastian-bergmann.de) / Commiter: Sebastian Bergmann (sb@sebastian-bergmann.de)
Initial work on PHP_CodeCoverage migration.
-
2009-08-29T12:38:39+02:00 (commit #f5228c7)
Author: Sebastian Bergmann (sb@sebastian-bergmann.de) / Commiter: Sebastian Bergmann (sb@sebastian-bergmann.de)
Merge [5163].
-
2009-08-29T12:38:01+02:00 (commit #8b1804e)
Author: Sebastian Bergmann (sb@sebastian-bergmann.de) / Commiter: Sebastian Bergmann (sb@sebastian-bergmann.de)
Add missing docblocks.
-
2009-08-29T10:49:43+02:00 (commit #f144a51)
Author: Sebastian Bergmann (sb@sebastian-bergmann.de) / Commiter: Sebastian Bergmann (sb@sebastian-bergmann.de)
Merge [5161].
-
2009-08-29T10:24:37+02:00 (commit #86e29fa)
Author: Sebastian Bergmann (sb@sebastian-bergmann.de) / Commiter: Sebastian Bergmann (sb@sebastian-bergmann.de)
Fix CS/WS issues.
-
2009-08-29T08:06:40+02:00 (commit #3a04550)
Author: Sebastian Bergmann (sb@sebastian-bergmann.de) / Commiter: Sebastian Bergmann (sb@sebastian-bergmann.de)
Merge [5159].
-
2009-08-29T08:05:24+02:00 (commit #a920826)
Author: Sebastian Bergmann (sb@sebastian-bergmann.de) / Commiter: Sebastian Bergmann (sb@sebastian-bergmann.de)
Cleanup.
-
2008-12-31T10:26:51+01:00 (commit #a899cb2)
Author: Sebastian Bergmann (sb@sebastian-bergmann.de) / Commiter: Sebastian Bergmann (sb@sebastian-bergmann.de)
Merge [4402].
-
2008-12-31T10:25:57+01:00 (commit #4b26cea)
Author: Sebastian Bergmann (sb@sebastian-bergmann.de) / Commiter: Sebastian Bergmann (sb@sebastian-bergmann.de)
Bump copyright year.
-
2008-06-27T20:39:05+02:00 (commit #37d303e)
Author: Sebastian Bergmann (sb@sebastian-bergmann.de) / Commiter: Sebastian Bergmann (sb@sebastian-bergmann.de)
Merge [3268].
-
2008-06-27T20:38:30+02:00 (commit #24446cf)
Author: Sebastian Bergmann (sb@sebastian-bergmann.de) / Commiter: Sebastian Bergmann (sb@sebastian-bergmann.de)
Close #504.
-
2008-06-08T14:22:29+02:00 (commit #191a5d5)
Author: Sebastian Bergmann (sb@sebastian-bergmann.de) / Commiter: Sebastian Bergmann (sb@sebastian-bergmann.de)
Merge [3160].
-
2008-06-08T14:03:37+02:00 (commit #9d9b5e3)
Author: Sebastian Bergmann (sb@sebastian-bergmann.de) / Commiter: Sebastian Bergmann (sb@sebastian-bergmann.de)
Drop superfluous annotations.
-
2007-12-26T19:11:55+01:00 (commit #1bba1cc)
Author: Sebastian Bergmann (sb@sebastian-bergmann.de) / Commiter: Sebastian Bergmann (sb@sebastian-bergmann.de)
Bump copyright year.
-
2007-12-26T19:11:04+01:00 (commit #58121cf)
Author: Sebastian Bergmann (sb@sebastian-bergmann.de) / Commiter: Sebastian Bergmann (sb@sebastian-bergmann.de)
Bump copyright year.
-
2007-11-24T11:03:40+01:00 (commit #9c20935)
Author: Sebastian Bergmann (sb@sebastian-bergmann.de) / Commiter: Sebastian Bergmann (sb@sebastian-bergmann.de)
toString -> __toString()
-
2007-09-29T12:56:13+02:00 (commit #8feea89)
Author: Sebastian Bergmann (sb@sebastian-bergmann.de) / Commiter: Sebastian Bergmann (sb@sebastian-bergmann.de)
Merge [1361].
-
2007-07-05T18:21:20+02:00 (commit #85ff4b5)
Author: Sebastian Bergmann (sb@sebastian-bergmann.de) / Commiter: Sebastian Bergmann (sb@sebastian-bergmann.de)
Merge [750].
-
2007-02-24T07:58:18+01:00 (commit #203ee10)
Author: Sebastian Bergmann (sb@sebastian-bergmann.de) / Commiter: Sebastian Bergmann (sb@sebastian-bergmann.de)
Fugbix typo.
-
2007-02-24T07:58:18+01:00 (commit #ae2a7c2)
Author: Sebastian Bergmann (sb@sebastian-bergmann.de) / Commiter: Sebastian Bergmann (sb@sebastian-bergmann.de)
Fugbix typo.
-
2007-01-18T07:02:31+01:00 (commit #d1c9810)
Author: Sebastian Bergmann (sb@sebastian-bergmann.de) / Commiter: Sebastian Bergmann (sb@sebastian-bergmann.de)
Support resource type in assertType(). Closes #86.
-
2006-12-24T18:50:40+01:00 (commit #0189be1)
Author: Sebastian Bergmann (sb@sebastian-bergmann.de) / Commiter: Sebastian Bergmann (sb@sebastian-bergmann.de)
Bump year.
-
2006-11-17T14:43:45+01:00 (commit #e27bb59)
Author: Sebastian Bergmann (sb@sebastian-bergmann.de) / Commiter: Sebastian Bergmann (sb@sebastian-bergmann.de)
Clean up docblocks.
-
2006-11-10T18:01:22+01:00 (commit #fe4c50f)
Author: Sebastian Bergmann (sb@sebastian-bergmann.de) / Commiter: Sebastian Bergmann (sb@sebastian-bergmann.de)
More work on PHPUnit_Framework_Constraint_*.
-
2006-11-09T11:02:36+01:00 (commit #ab1a08d)
Author: Sebastian Bergmann (sb@sebastian-bergmann.de) / Commiter: Sebastian Bergmann (sb@sebastian-bergmann.de)
Cleanup PHPUnit_Framework_Constraint*.
-
2006-09-11T09:20:41+02:00 (commit #75e12fb)
Author: Sebastian Bergmann (sb@sebastian-bergmann.de) / Commiter: Sebastian Bergmann (sb@sebastian-bergmann.de)
No longer needed.
-
2006-07-06T11:50:42+02:00 (commit #dacd2f1)
Author: Sebastian Bergmann (sb@sebastian-bergmann.de) / Commiter: Sebastian Bergmann (sb@sebastian-bergmann.de)
Leftover: PHPUnit2 -> PHPUnit.
-
2006-06-30T10:38:41+02:00 (commit #210b621)
Author: Sebastian Bergmann (sb@sebastian-bergmann.de) / Commiter: Sebastian Bergmann (sb@sebastian-bergmann.de)
Make it easier to use a checkout of the trunk.
-
2006-06-29T20:56:08+02:00 (commit #6b0d2d5)
Author: Sebastian Bergmann (sb@sebastian-bergmann.de) / Commiter: Sebastian Bergmann (sb@sebastian-bergmann.de)
Post-PEAR cleanup, phase one: PHPUnit2_* -> PHPUnit_*, pear.php.net -> phpunit.de, etc.
-
2006-06-29T16:58:01+02:00 (commit #8b8c705)
Author: Sebastian Bergmann (sb@sebastian-bergmann.de) / Commiter: Sebastian Bergmann (sb@sebastian-bergmann.de)
Recreate trunk.