diff --git a/_archive/src/Xmf/Template/Breadcrumb.php b/_archive/src/Xmf/Template/Breadcrumb.php
index ffe3ead..ecfd756 100644
--- a/_archive/src/Xmf/Template/Breadcrumb.php
+++ b/_archive/src/Xmf/Template/Breadcrumb.php
@@ -29,7 +29,7 @@ class Breadcrumb extends AbstractTemplate
/**
* @var array
*/
- private $items = array();
+ private $items = [];
/**
* initialization run by parent::__construct
diff --git a/_archive/src/Xmf/Template/Buttonbox.php b/_archive/src/Xmf/Template/Buttonbox.php
index f7e32fa..a854a78 100644
--- a/_archive/src/Xmf/Template/Buttonbox.php
+++ b/_archive/src/Xmf/Template/Buttonbox.php
@@ -29,7 +29,7 @@ class Buttonbox extends AbstractTemplate
/**
* @var array
*/
- private $items = array();
+ private $items = [];
/**
* @var string
diff --git a/_archive/src/Xmf/Template/Feed.php b/_archive/src/Xmf/Template/Feed.php
index bdf1dcf..97c6c1d 100644
--- a/_archive/src/Xmf/Template/Feed.php
+++ b/_archive/src/Xmf/Template/Feed.php
@@ -119,7 +119,7 @@ class Feed extends AbstractTemplate
/**
* @var array
*/
- private $items = array();
+ private $items = [];
/**
* init - called by parent::_construct
diff --git a/_archive/src/Xmf/Utilities.php b/_archive/src/Xmf/Utilities.php
index f477662..9ef1057 100644
--- a/_archive/src/Xmf/Utilities.php
+++ b/_archive/src/Xmf/Utilities.php
@@ -25,7 +25,6 @@
*/
class Utilities
{
-
/**
* purifyText
*
@@ -78,7 +77,7 @@ public static function purifyText($text, $keyword = false)
*/
public static function html2text($document)
{
- $search = array(
+ $search = [
"''si", // Strip out javascript
"''si", // Strip out img tags
"'<[\/\!]*?[^<>]*?>'si", // Strip out HTML tags
@@ -92,9 +91,9 @@ public static function html2text($document)
"'&(cent|#162);'i",
"'&(pound|#163);'i",
"'&(copy|#169);'i"
- );
+ ];
- $replace = array(
+ $replace = [
"",
"",
"",
@@ -108,7 +107,7 @@ public static function html2text($document)
chr(162),
chr(163),
chr(169)
- );
+ ];
$text = preg_replace($search, $replace, $document);
diff --git a/index.php b/index.php
index db4baed..2ea9b7d 100644
--- a/index.php
+++ b/index.php
@@ -1,2 +1,3 @@
getInfo('version'));
+ $module->getInfo('version')
+ );
$this->tableDefinitionFile = $this->helper->path("sql/{$dirname}_{$version}_migrate.yml");
$this->tableHandler = new Tables();
diff --git a/src/Database/TableLoad.php b/src/Database/TableLoad.php
index 4ba474f..53f8e62 100644
--- a/src/Database/TableLoad.php
+++ b/src/Database/TableLoad.php
@@ -27,7 +27,6 @@
*/
class TableLoad
{
-
/**
* loadTableFromArray
*
@@ -149,7 +148,7 @@ public static function countRows($table, $criteria = null)
*
* @return array of table rows
*/
- public static function extractRows($table, $criteria = null, $skipColumns = array())
+ public static function extractRows($table, $criteria = null, $skipColumns = [])
{
/** @var \XoopsDatabase */
$db = \XoopsDatabaseFactory::getDatabaseConnection();
@@ -160,7 +159,7 @@ public static function extractRows($table, $criteria = null, $skipColumns = arra
/** @var \CriteriaCompo $criteria */
$sql .= $criteria->renderWhere();
}
- $rows = array();
+ $rows = [];
$result = $db->query($sql);
if ($result) {
while (false !== ($row = $db->fetchArray($result))) {
@@ -191,7 +190,7 @@ public static function extractRows($table, $criteria = null, $skipColumns = arra
*
* @return bool true on success, false on error
*/
- public static function saveTableToYamlFile($table, $yamlFile, $criteria = null, $skipColumns = array())
+ public static function saveTableToYamlFile($table, $yamlFile, $criteria = null, $skipColumns = [])
{
$rows = static::extractRows($table, $criteria, $skipColumns);
diff --git a/src/Database/Tables.php b/src/Database/Tables.php
index 1f71a41..91b02ef 100644
--- a/src/Database/Tables.php
+++ b/src/Database/Tables.php
@@ -99,10 +99,10 @@ protected function name($table)
*/
public function addColumn($table, $column, $attributes)
{
- $columnDef = array(
+ $columnDef = [
'name' => $column,
'attributes' => $attributes
- );
+ ];
// Find table def.
if (isset($this->tables[$table])) {
@@ -237,16 +237,16 @@ public function addTable($table)
return true;
} else {
if ($tableDef === true) {
- $tableDef = array(
+ $tableDef = [
'name' => $this->name($table),
'options' => 'ENGINE=InnoDB',
- 'columns' => array(),
- 'keys' => array(),
+ 'columns' => [],
+ 'keys' => [],
'create' => true,
- );
+ ];
$this->tables[$table] = $tableDef;
- $this->queue[] = array('createtable' => $table);
+ $this->queue[] = ['createtable' => $table];
return true;
} else {
@@ -391,7 +391,7 @@ public function copyTable($table, $newTable, $withData = false)
$this->queue[] = "INSERT INTO `{$copy}` SELECT * FROM `{$original}` ;";
} else {
$tableDef['create'] = true;
- $this->queue[] = array('createtable' => $newTable);
+ $this->queue[] = ['createtable' => $newTable];
}
$this->tables[$newTable] = $tableDef;
@@ -575,8 +575,8 @@ public function setTableOptions($table, $options)
*/
public function resetQueue()
{
- $this->tables = array();
- $this->queue = array();
+ $this->tables = [];
+ $this->queue = [];
}
/**
@@ -815,7 +815,7 @@ protected function quoteDefaultClause($default)
{
// . (($column['COLUMN_DEFAULT'] === null) ? '' : " DEFAULT '" . $column['COLUMN_DEFAULT'] . "' ")
// no default specified
- if (null===$default) {
+ if (null === $default) {
return '';
}
@@ -840,7 +840,7 @@ protected function quoteDefaultClause($default)
*/
protected function getTable($table)
{
- $tableDef = array();
+ $tableDef = [];
$sql = 'SELECT TABLE_NAME, ENGINE, CHARACTER_SET_NAME ';
$sql .= ' FROM `INFORMATION_SCHEMA`.`TABLES` t, ';
@@ -876,10 +876,10 @@ protected function getTable($table)
//. $column['EXTRA'];
. str_replace('DEFAULT_GENERATED ', '', $column['EXTRA']);
- $columnDef = array(
+ $columnDef = [
'name' => $column['COLUMN_NAME'],
'attributes' => $attributes
- );
+ ];
$tableDef['columns'][] = $columnDef;
};
diff --git a/src/Database/index.php b/src/Database/index.php
index db4baed..2ea9b7d 100644
--- a/src/Database/index.php
+++ b/src/Database/index.php
@@ -1,2 +1,3 @@
key->getVerifying(), $this->algorithm));
diff --git a/src/Jwt/TokenReader.php b/src/Jwt/TokenReader.php
index 8bdb199..2228adc 100644
--- a/src/Jwt/TokenReader.php
+++ b/src/Jwt/TokenReader.php
@@ -38,7 +38,7 @@ class TokenReader
*
* @throws \InvalidArgumentException on unusable key name
*/
- public static function fromString($key, $token, $assertClaims = array())
+ public static function fromString($key, $token, $assertClaims = [])
{
$key = ($key instanceof KeyAbstract) ? $key : KeyFactory::build($key);
$jwt = new JsonWebToken($key);
@@ -56,7 +56,7 @@ public static function fromString($key, $token, $assertClaims = array())
*
* @throws \InvalidArgumentException on unusable key name
*/
- public static function fromCookie($key, $cookieName, $assertClaims = array())
+ public static function fromCookie($key, $cookieName, $assertClaims = [])
{
$token = Request::getString($cookieName, '', 'COOKIE');
if (empty($token)) {
@@ -76,7 +76,7 @@ public static function fromCookie($key, $cookieName, $assertClaims = array())
*
* @throws \InvalidArgumentException on unusable key name
*/
- public static function fromRequest($key, $attributeName, $assertClaims = array())
+ public static function fromRequest($key, $attributeName, $assertClaims = [])
{
$token = Request::getString($attributeName, '');
if (empty($token)) {
@@ -96,7 +96,7 @@ public static function fromRequest($key, $attributeName, $assertClaims = array()
*
* @throws \InvalidArgumentException on unusable key name
*/
- public static function fromHeader($key, $assertClaims = array(), $headerName = 'Authorization')
+ public static function fromHeader($key, $assertClaims = [], $headerName = 'Authorization')
{
$header = Request::getHeader($headerName, '');
if (empty($header)) {
diff --git a/src/Jwt/index.php b/src/Jwt/index.php
index db4baed..2ea9b7d 100644
--- a/src/Jwt/index.php
+++ b/src/Jwt/index.php
@@ -1,2 +1,3 @@
]*?>.*?'si", // Strip out javascript
"''si", // Strip out img tags
"'<[\/\!]*?[^<>]*?>'si", // Strip out HTML tags
@@ -453,9 +452,9 @@ protected static function html2text($document)
"'&(cent|#162);'i",
"'&(pound|#163);'i",
"'&(copy|#169);'i"
- );
+ ];
- $replace = array(
+ $replace = [
"",
"",
"",
@@ -469,7 +468,7 @@ protected static function html2text($document)
chr(162),
chr(163),
chr(169)
- );
+ ];
$text = preg_replace($search, $replace, $document);
diff --git a/src/Module/Admin.php b/src/Module/Admin.php
index 1cf2d91..7a2a7ae 100644
--- a/src/Module/Admin.php
+++ b/src/Module/Admin.php
@@ -28,7 +28,6 @@
*/
class Admin
{
-
/**
* The real ModuleAdmin object
*
@@ -61,11 +60,11 @@ public static function getInstance()
if ($instance === null) {
if (class_exists('\Xoops\Module\Admin', true)) {
- $instance = new \Xoops\Module\Admin;
+ $instance = new \Xoops\Module\Admin();
static::$ModuleAdmin = $instance;
} else {
include_once $GLOBALS['xoops']->path('Frameworks/moduleclasses/moduleadmin/moduleadmin.php');
- static::$ModuleAdmin = new \ModuleAdmin;
+ static::$ModuleAdmin = new \ModuleAdmin();
Language::load('xmf');
$instance = new static();
}
diff --git a/src/Module/Helper.php b/src/Module/Helper.php
index e5e886d..03a9950 100644
--- a/src/Module/Helper.php
+++ b/src/Module/Helper.php
@@ -38,7 +38,7 @@ class Helper extends GenericHelper
*/
public static function getHelper($dirname = 'system')
{
- static $instance = array();
+ static $instance = [];
if (!isset($instance[$dirname])) {
$instance[$dirname] = false;
diff --git a/src/Module/Helper/AbstractHelper.php b/src/Module/Helper/AbstractHelper.php
index 01d7c1b..57ba9e7 100644
--- a/src/Module/Helper/AbstractHelper.php
+++ b/src/Module/Helper/AbstractHelper.php
@@ -121,7 +121,7 @@ public function addLog($log)
if ($this->debug) {
$message = $this->serializeForHelperLog($log);
if (class_exists('Xoops', false)) {
- \Xoops::getInstance()->logger()->debug($message, array('channel'=>'Extra'));
+ \Xoops::getInstance()->logger()->debug($message, ['channel' => 'Extra']);
} elseif (is_object($GLOBALS['xoopsLogger'])) {
$GLOBALS['xoopsLogger']->addExtra(get_called_class(), $message);
}
diff --git a/src/Module/Helper/Cache.php b/src/Module/Helper/Cache.php
index f23f564..ddc408f 100644
--- a/src/Module/Helper/Cache.php
+++ b/src/Module/Helper/Cache.php
@@ -117,7 +117,7 @@ public function delete($key)
public function cacheRead($key, $regenFunction, $ttl = null, $args = null)
{
if (null === $args) {
- $varArgs = array();
+ $varArgs = [];
} else {
$varArgs = func_get_args();
array_shift($varArgs); // pull off $key
diff --git a/src/Module/Helper/index.php b/src/Module/Helper/index.php
index db4baed..2ea9b7d 100644
--- a/src/Module/Helper/index.php
+++ b/src/Module/Helper/index.php
@@ -1,2 +1,3 @@
proxyHeaderName || false===$this->proxyHeader) {
+ if (false === $this->proxyHeaderName || false === $this->proxyHeader) {
return false;
}
$proxyVars = $this->splitOnComma($this->proxyHeader);
@@ -129,7 +129,7 @@ protected function getFor($header)
if ($start === false) {
return false;
}
- $ip = substr($header, $start+4);
+ $ip = substr($header, $start + 4);
$end = strpos($ip, ';');
if ($end !== false) {
$ip = substr($ip, 0, $end);
diff --git a/src/Request.php b/src/Request.php
index c6a5265..3342c71 100644
--- a/src/Request.php
+++ b/src/Request.php
@@ -32,9 +32,9 @@ class Request
/**
* Available masks for cleaning variables
*/
- const MASK_NO_TRIM = 1;
- const MASK_ALLOW_RAW = 2;
- const MASK_ALLOW_HTML = 4;
+ public const MASK_NO_TRIM = 1;
+ public const MASK_ALLOW_RAW = 2;
+ public const MASK_ALLOW_HTML = 4;
/**
* Gets the request method
@@ -251,7 +251,7 @@ public static function getString($name, $default = '', $hash = 'default', $mask
*
* @return array
*/
- public static function getArray($name, $default = array(), $hash = 'default')
+ public static function getArray($name, $default = [], $hash = 'default')
{
return static::getVar($name, $default, $hash, 'array');
}
@@ -342,7 +342,7 @@ public static function getHeader($headerName, $default = '')
static $headers = null;
if (null === $headers) {
- $headers = array();
+ $headers = [];
if (function_exists('apache_request_headers')) {
$rawHeaders = apache_request_headers();
foreach ($rawHeaders as $name => $value) {
@@ -554,7 +554,7 @@ protected static function cleanVar($var, $mask = 0, $type = null)
// convert $var in array if $type is ARRAY
if ('array' === strtolower((string)$type) && !is_array($var)) {
- $var = array($var);
+ $var = [$var];
}
// If the no trim flag is not set, trim the variable
@@ -568,7 +568,7 @@ protected static function cleanVar($var, $mask = 0, $type = null)
if ($mask & static::MASK_ALLOW_HTML) {
// If the allow html flag is set, apply a safe html filter to the variable
if (null === $safeHtmlFilter) {
- $safeHtmlFilter = FilterInput::getInstance(array(), array(), 1, 1);
+ $safeHtmlFilter = FilterInput::getInstance([], [], 1, 1);
}
$var = $safeHtmlFilter->cleanVar($var, $type);
} else {
@@ -615,7 +615,7 @@ protected static function cleanVars($var, $mask = 0, $type = null)
protected static function stripSlashesRecursive($value)
{
$value = is_array($value)
- ? array_map(array(get_called_class(), 'stripSlashesRecursive'), $value)
+ ? array_map([get_called_class(), 'stripSlashesRecursive'], $value)
: stripslashes($value);
return $value;
diff --git a/src/StopWords.php b/src/StopWords.php
index 211a869..2962974 100644
--- a/src/StopWords.php
+++ b/src/StopWords.php
@@ -25,14 +25,13 @@
*/
class StopWords
{
-
/**
* mbstring encoding
*/
- const ENCODING = 'UTF-8';
+ public const ENCODING = 'UTF-8';
/** @var string[] */
- protected $stopwordList = array();
+ protected $stopwordList = [];
/**
* StopWords constructor - load stop words for current locale
diff --git a/src/Ulid.php b/src/Ulid.php
index 887119f..e058e56 100644
--- a/src/Ulid.php
+++ b/src/Ulid.php
@@ -22,8 +22,8 @@
*/
class Ulid
{
- const ENCODING_CHARS = '0123456789ABCDEFGHJKMNPQRSTVWXYZ';
- const ENCODING_LENGTH = 32;
+ public const ENCODING_CHARS = '0123456789ABCDEFGHJKMNPQRSTVWXYZ';
+ public const ENCODING_LENGTH = 32;
/**
* Generate a new ULID.
@@ -108,7 +108,7 @@ public static function decode(string $ulid): array
*/
public static function decodeTime(string $ulid): int
{
-// $encodingCharsArray = str_split(self::ENCODING_CHARS);
+ // $encodingCharsArray = str_split(self::ENCODING_CHARS);
// Check if the ULID string is valid.
if (!self::isValid($ulid)) {
@@ -169,8 +169,8 @@ public static function isValid(string $ulid): bool
try {
self::decodeRandomness($ulid);
} catch (\InvalidArgumentException $e) {
- return false;
-}
+ return false;
+ }
return true;
}
@@ -188,6 +188,3 @@ public static function microtimeToUlidTime(float $microtime): int
return (int)($timestamp - $unixEpoch);
}
}
-
-
-
diff --git a/src/Uuid.php b/src/Uuid.php
index c90f444..4156588 100644
--- a/src/Uuid.php
+++ b/src/Uuid.php
@@ -23,7 +23,7 @@
class Uuid
{
// match spec for version 4 UUID as per rfc4122
- const UUID_REGEX = '/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/';
+ public const UUID_REGEX = '/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/';
/**
* generate - generate a version 4 (random) UUID
diff --git a/src/index.php b/src/index.php
index db4baed..2ea9b7d 100644
--- a/src/index.php
+++ b/src/index.php
@@ -1,2 +1,3 @@
expectException($exceptionName);
if($exceptionMessage) {
$this->expectExceptionMessage($exceptionMessage);
}
- if( $exceptionCode) {
+ if($exceptionCode) {
$this->expectExceptionCode($exceptionCode);
}
return;
@@ -98,534 +99,534 @@ public function getTests()
{
$resource = self::getResource();
- return array(
- array('string', array('value'), true),
- array('string', array(''), true),
- array('string', array(1234), false),
- array('stringNotEmpty', array('value'), true),
- array('stringNotEmpty', array('0'), true),
- array('stringNotEmpty', array(''), false),
- array('stringNotEmpty', array(1234), false),
- array('integer', array(123), true),
- array('integer', array('123'), false),
- array('integer', array(1.0), false),
- array('integer', array(1.23), false),
- array('integerish', array(1.0), true),
- array('integerish', array(1.23), false),
- array('integerish', array(123), true),
- array('integerish', array('123'), true),
- array('float', array(1.0), true),
- array('float', array(1.23), true),
- array('float', array(123), false),
- array('float', array('123'), false),
- array('numeric', array(1.0), true),
- array('numeric', array(1.23), true),
- array('numeric', array(123), true),
- array('numeric', array('123'), true),
- array('numeric', array('foo'), false),
- array('natural', array(0), true),
- array('natural', array(1), true),
- array('natural', array(-1), false),
- array('natural', array('1'), false),
- array('natural', array(1.0), false),
- array('natural', array(1.23), false),
- array('boolean', array(true), true),
- array('boolean', array(false), true),
- array('boolean', array(1), false),
- array('boolean', array('1'), false),
- array('scalar', array('1'), true),
- array('scalar', array(123), true),
- array('scalar', array(true), true),
- array('scalar', array(null), false),
- array('scalar', array(array()), false),
- array('scalar', array(new stdClass()), false),
- array('object', array(new stdClass()), true),
- array('object', array(new RuntimeException()), true),
- array('object', array(null), false),
- array('object', array(true), false),
- array('object', array(1), false),
- array('object', array(array()), false),
- array('resource', array($resource), true),
- array('resource', array($resource, 'stream'), true),
- array('resource', array($resource, 'other'), false),
- array('resource', array(1), false),
- array('isCallable', array('strlen'), true),
- array('isCallable', array(array($this, 'getTests')), true),
- array('isCallable', array(function () {}), true),
- array('isCallable', array(1234), false),
- array('isCallable', array('foobar'), false),
- array('isArray', array(array()), true),
- array('isArray', array(array(1, 2, 3)), true),
- array('isArray', array(new ArrayIterator(array())), false),
- array('isArray', array(123), false),
- array('isArray', array(new stdClass()), false),
- array('isTraversable', array(array()), true),
- array('isTraversable', array(array(1, 2, 3)), true),
- array('isTraversable', array(new ArrayIterator(array())), true),
- array('isTraversable', array(123), false),
- array('isTraversable', array(new stdClass()), false),
- array('isArrayAccessible', array(array()), true),
- array('isArrayAccessible', array(array(1, 2, 3)), true),
- array('isArrayAccessible', array(new ArrayObject(array())), true),
- array('isArrayAccessible', array(123), false),
- array('isArrayAccessible', array(new stdClass()), false),
- array('isCountable', array(array()), true),
- array('isCountable', array(array(1, 2)), true),
- array('isCountable', array(new ArrayIterator(array())), true),
- array('isCountable', array(new stdClass()), false),
- array('isCountable', array(new \SimpleXMLElement('bar')), true),
- array('isCountable', array('abcd'), false),
- array('isCountable', array(123), false),
- array('isIterable', array(array()), true),
- array('isIterable', array(array(1, 2, 3)), true),
- array('isIterable', array(new ArrayIterator(array())), true),
- array('isIterable', array(123), false),
- array('isIterable', array(new stdClass()), false),
- array('isInstanceOf', array(new stdClass(), 'stdClass'), true),
- array('isInstanceOf', array(new Exception(), 'stdClass'), false),
- array('isInstanceOf', array(123, 'stdClass'), false),
- array('isInstanceOf', array(array(), 'stdClass'), false),
- array('isInstanceOf', array(null, 'stdClass'), false),
- array('notInstanceOf', array(new stdClass(), 'stdClass'), false),
- array('notInstanceOf', array(new Exception(), 'stdClass'), true),
- array('notInstanceOf', array(123, 'stdClass'), true),
- array('notInstanceOf', array(array(), 'stdClass'), true),
- array('isInstanceOfAny', array(new ArrayIterator(), array('Iterator', 'ArrayAccess')), true),
- array('isInstanceOfAny', array(new Exception(), array('Exception', 'Countable')), true),
- array('isInstanceOfAny', array(new Exception(), array('ArrayAccess', 'Countable')), false),
- array('isInstanceOfAny', array(123, array('stdClass')), false),
- array('isInstanceOfAny', array(array(), array('stdClass')), false),
- array('isAOf', array('stdClass', 'stdClass'), true),
- array('isAOf', array('stdClass', 123), false),
- array('isAOf', array('Iterator', 'ArrayIterator'), false),
- array('isAOf', array(123, 'Iterator'), false),
- array('isAOf', array(array(), 'Iterator'), false),
- array('isAnyOf', array('ArrayIterator', array('Iterator', 'ArrayAccess')), true),
- array('isAnyOf', array('ArrayIterator', array(123)), false),
- array('isAnyOf', array('Exception', array('Exception', 'Countable')), true),
- array('isAnyOf', array('Exception', array('ArrayAccess', 'Countable')), false),
- array('isAnyOf', array(123, array('stdClass')), false),
- array('isAnyOf', array(array(), array('stdClass')), false),
- array('isNotA', array('stdClass', 'stdClass'), false),
- array('isNotA', array('stdClass', 123), false),
- array('isNotA', array('Iterator', 'ArrayIterator'), true),
- array('isNotA', array(123, 'Iterator'), true),
- array('isNotA', array(array(), 'Iterator'), true),
- array('true', array(true), true),
- array('true', array(false), false),
- array('true', array(1), false),
- array('true', array(null), false),
- array('false', array(false), true),
- array('false', array(true), false),
- array('false', array(1), false),
- array('false', array(0), false),
- array('false', array(null), false),
- array('notFalse', array(false), false),
- array('notFalse', array(true), true),
- array('notFalse', array(1), true),
- array('notFalse', array(0), true),
- array('notFalse', array(null), true),
- array('null', array(null), true),
- array('null', array(false), false),
- array('null', array(0), false),
- array('notNull', array(false), true),
- array('notNull', array(0), true),
- array('notNull', array(null), false),
- array('isEmpty', array(null), true),
- array('isEmpty', array(false), true),
- array('isEmpty', array(0), true),
- array('isEmpty', array(''), true),
- array('isEmpty', array(1), false),
- array('isEmpty', array('a'), false),
- array('notEmpty', array(1), true),
- array('notEmpty', array('a'), true),
- array('notEmpty', array(null), false),
- array('notEmpty', array(false), false),
- array('notEmpty', array(0), false),
- array('notEmpty', array(''), false),
- array('eq', array(1, 1), true),
- array('eq', array(1, '1'), true),
- array('eq', array(1, true), true),
- array('eq', array(1, 0), false),
- array('notEq', array(1, 0), true),
- array('notEq', array(1, 1), false),
- array('notEq', array(1, '1'), false),
- array('notEq', array(1, true), false),
- array('same', array(1, 1), true),
- array('same', array(1, '1'), false),
- array('same', array(1, true), false),
- array('same', array(1, 0), false),
- array('notSame', array(1, 0), true),
- array('notSame', array(1, 1), false),
- array('notSame', array(1, '1'), true),
- array('notSame', array(1, true), true),
- array('greaterThan', array(1, 0), true),
- array('greaterThan', array(0, 0), false),
- array('greaterThanEq', array(2, 1), true),
- array('greaterThanEq', array(1, 1), true),
- array('greaterThanEq', array(0, 1), false),
- array('lessThan', array(0, 1), true),
- array('lessThan', array(1, 1), false),
- array('lessThanEq', array(0, 1), true),
- array('lessThanEq', array(1, 1), true),
- array('lessThanEq', array(2, 1), false),
- array('range', array(1, 1, 2), true),
- array('range', array(2, 1, 2), true),
- array('range', array(0, 1, 2), false),
- array('range', array(3, 1, 2), false),
- array('oneOf', array(1, array(1, 2, 3)), true),
- array('oneOf', array(1, array('1', '2', '3')), false),
- array('inArray', array(1, array(1, 2, 3)), true),
- array('inArray', array(1, array('1', '2', '3')), false),
- array('contains', array('abcd', 'ab'), true),
- array('contains', array('abcd', 'bc'), true),
- array('contains', array('abcd', 'cd'), true),
- array('contains', array('abcd', 'de'), false),
- array('contains', array('', 'de'), false),
- array('contains', array('äþçð', 'äþ'), true),
- array('contains', array('äþçð', 'þç'), true),
- array('contains', array('äþçð', 'çð'), true),
- array('contains', array('äþçð', 'ðé'), false),
- array('contains', array('', 'ðé'), false),
- array('contains', array('あいうえ', 'あい'), true),
- array('contains', array('あいうえ', 'いう'), true),
- array('contains', array('あいうえ', 'うえ'), true),
- array('contains', array('あいうえ', 'えお'), false),
- array('contains', array('', 'えお'), false),
- array('contains', array('😄😑☹️', '😄'), true),
- array('contains', array('😄😑☹️', '😑'), true),
- array('contains', array('😄😑☹️', '☹️'), true),
- array('contains', array('😄😑☹️', '😄☹️'), false),
- array('contains', array('', '😑'), false),
- array('notContains', array('abcd', 'ab'), false),
- array('notContains', array('abcd', 'bc'), false),
- array('notContains', array('abcd', 'cd'), false),
- array('notContains', array('abcd', 'de'), true),
- array('notContains', array('', 'de'), true),
- array('notContains', array('äþçð', 'äþ'), false),
- array('notContains', array('äþçð', 'þç'), false),
- array('notContains', array('äþçð', 'çð'), false),
- array('notContains', array('äþçð', 'ðé'), true),
- array('notContains', array('', 'ðé'), true),
- array('notContains', array('あいうえ', 'あい'), false),
- array('notContains', array('あいうえ', 'いう'), false),
- array('notContains', array('あいうえ', 'うえ'), false),
- array('notContains', array('あいうえ', 'えお'), true),
- array('notContains', array('', 'えお'), true),
- array('notContains', array('😄😑☹️', '😄'), false),
- array('notContains', array('😄😑☹️', '😑'), false),
- array('notContains', array('😄😑☹️', '☹️'), false),
- array('notContains', array('😄😑☹️', '😄☹️'), true),
- array('notContains', array('', '😑'), true),
- array('notWhitespaceOnly', array('abc'), true),
- array('notWhitespaceOnly', array('123'), true),
- array('notWhitespaceOnly', array(' abc '), true),
- array('notWhitespaceOnly', array('a b c'), true),
- array('notWhitespaceOnly', array(''), false),
- array('notWhitespaceOnly', array(' '), false),
- array('notWhitespaceOnly', array("\t"), false),
- array('notWhitespaceOnly', array("\n"), false),
- array('notWhitespaceOnly', array("\r"), false),
- array('notWhitespaceOnly', array("\r\n\t "), false),
- array('startsWith', array('abcd', 'ab'), true),
- array('startsWith', array('abcd', 'bc'), false),
- array('startsWith', array('', 'bc'), false),
- array('startsWith', array('äþçð', 'äþ'), true),
- array('startsWith', array('äþçð', 'þç'), false),
- array('startsWith', array('', 'þç'), false),
- array('startsWith', array('あいうえ', 'あい'), true),
- array('startsWith', array('あいうえ', 'いう'), false),
- array('startsWith', array('', 'いう'), false),
- array('startsWith', array('😄😑☹️', '😄'), true),
- array('startsWith', array('😄😑☹️', '😑'), false),
- array('startsWith', array('', '😑'), false),
- array('startsWithLetter', array('abcd'), true),
- array('startsWithLetter', array(array(66)), false),
- array('startsWithLetter', array('a'), true),
- array('startsWithLetter', array('a1'), true),
- array('startsWithLetter', array('1abcd'), false),
- array('startsWithLetter', array('1'), false),
- array('startsWithLetter', array(''), false),
- array('startsWithLetter', array(null), false),
- array('startsWithLetter', array(66), false),
- array('notStartsWith', array('abcd', 'ab'), false),
- array('notStartsWith', array('abcd', 'bc'), true),
- array('notStartsWith', array('', 'bc'), true),
- array('notStartsWith', array('äþçð', 'äþ'), false),
- array('notStartsWith', array('äþçð', 'þç'), true),
- array('notStartsWith', array('', 'þç'), true),
- array('notStartsWith', array('あいうえ', 'あい'), false),
- array('notStartsWith', array('あいうえ', 'いう'), true),
- array('notStartsWith', array('', 'いう'), true),
- array('notStartsWith', array('😄😑☹️', '😄'), false),
- array('notStartsWith', array('😄😑☹️', '😑'), true),
- array('notStartsWith', array('', '😑'), true),
- array('endsWith', array('abcd', 'cd'), true),
- array('endsWith', array('abcd', 'bc'), false),
- array('endsWith', array('', 'bc'), false),
- array('endsWith', array('äþçð', 'çð'), true),
- array('endsWith', array('äþçð', 'þç'), false),
- array('endsWith', array('', 'þç'), false),
- array('endsWith', array('あいうえ', 'うえ'), true),
- array('endsWith', array('あいうえ', 'いう'), false),
- array('endsWith', array('', 'いう'), false),
- array('endsWith', array('😄😑☹️', '☹️'), true),
- array('endsWith', array('😄😑☹️', '😑'), false),
- array('endsWith', array('', '😑'), false),
- array('notEndsWith', array('abcd', 'cd'), false),
- array('notEndsWith', array('abcd', 'bc'), true),
- array('notEndsWith', array('', 'bc'), true),
- array('notEndsWith', array('äþçð', 'çð'), false),
- array('notEndsWith', array('äþçð', 'þç'), true),
- array('notEndsWith', array('', 'þç'), true),
- array('notEndsWith', array('あいうえ', 'うえ'), false),
- array('notEndsWith', array('あいうえ', 'いう'), true),
- array('notEndsWith', array('', 'いう'), true),
- array('notEndsWith', array('😄😑☹️', '☹️'), false),
- array('notEndsWith', array('😄😑☹️', '😑'), true),
- array('notEndsWith', array('', '😑'), true),
- array('regex', array('abcd', '~^ab~'), true),
- array('regex', array('abcd', '~^bc~'), false),
- array('regex', array('', '~^bc~'), false),
- array('notRegex', array('abcd', '{^ab}'), false),
- array('notRegex', array('abcd', '{^bc}'), true),
- array('notRegex', array('', '{^bc}'), true),
- array('unicodeLetters', array('abcd'), true),
- array('unicodeLetters', array('ᴁڅਘธブ乶'), true),
- array('unicodeLetters', array('ȁȄ'), true),
- array('unicodeLetters', array('ȁ1Ȅ'), false),
- array('unicodeLetters', array('©'), false),
- array('unicodeLetters', array('🙁'), false),
- array('unicodeLetters', array(''), false),
- array('alpha', array('abcd'), true),
- array('alpha', array('ab1cd'), false),
- array('alpha', array(''), false),
- array('alpha', array(66), false),
- array('alpha', array(array()), false),
- array('digits', array('1234'), true),
- array('digits', array('12a34'), false),
- array('digits', array(''), false),
- array('alnum', array('ab12'), true),
- array('alnum', array('ab12$'), false),
- array('alnum', array(''), false),
- array('lower', array('abcd'), true),
- array('lower', array('abCd'), false),
- array('lower', array('ab_d'), false),
- array('lower', array(''), false),
- array('upper', array('ABCD'), true),
- array('upper', array('ABcD'), false),
- array('upper', array('AB_D'), false),
- array('upper', array(''), false),
- array('length', array('abcd', 4), true),
- array('length', array('abc', 4), false),
- array('length', array('abcde', 4), false),
- array('length', array('äbcd', 4), true, true),
- array('length', array('äbc', 4), false, true),
- array('length', array('äbcde', 4), false, true),
- array('length', array('あbcd', 4), true, true), // 'HIRAGANA LETTER A' (U+3042)
- array('length', array('あbc', 4), false, true),
- array('length', array('あbcde', 4), false, true),
- array('minLength', array('abcd', 4), true),
- array('minLength', array('abcde', 4), true),
- array('minLength', array('abc', 4), false),
- array('minLength', array('äbcd', 4), true, true),
- array('minLength', array('äbcde', 4), true, true),
- array('minLength', array('äbc', 4), false, true),
- array('minLength', array('あbcd', 4), true, true),
- array('minLength', array('あbcde', 4), true, true),
- array('minLength', array('あbc', 4), false, true),
- array('maxLength', array('abcd', 4), true),
- array('maxLength', array('abc', 4), true),
- array('maxLength', array('abcde', 4), false),
- array('maxLength', array('äbcd', 4), true, true),
- array('maxLength', array('äbc', 4), true, true),
- array('maxLength', array('äbcde', 4), false, true),
- array('maxLength', array('あbcd', 4), true, true),
- array('maxLength', array('あbc', 4), true, true),
- array('maxLength', array('あbcde', 4), false, true),
- array('lengthBetween', array('abcd', 3, 5), true),
- array('lengthBetween', array('abc', 3, 5), true),
- array('lengthBetween', array('abcde', 3, 5), true),
- array('lengthBetween', array('ab', 3, 5), false),
- array('lengthBetween', array('abcdef', 3, 5), false),
- array('lengthBetween', array('äbcd', 3, 5), true, true),
- array('lengthBetween', array('äbc', 3, 5), true, true),
- array('lengthBetween', array('äbcde', 3, 5), true, true),
- array('lengthBetween', array('äb', 3, 5), false, true),
- array('lengthBetween', array('äbcdef', 3, 5), false, true),
- array('lengthBetween', array('あbcd', 3, 5), true, true),
- array('lengthBetween', array('あbc', 3, 5), true, true),
- array('lengthBetween', array('あbcde', 3, 5), true, true),
- array('lengthBetween', array('あb', 3, 5), false, true),
- array('lengthBetween', array('あbcdef', 3, 5), false, true),
- array('fileExists', array(__FILE__), true),
- array('fileExists', array(__DIR__), true),
- array('fileExists', array(__DIR__.'/foobar'), false),
- array('file', array(__FILE__), true),
- array('file', array(__DIR__), false),
- array('file', array(__DIR__.'/foobar'), false),
- array('directory', array(__DIR__), true),
- array('directory', array(__FILE__), false),
- array('directory', array(__DIR__.'/foobar'), false),
+ return [
+ ['string', ['value'], true],
+ ['string', [''], true],
+ ['string', [1234], false],
+ ['stringNotEmpty', ['value'], true],
+ ['stringNotEmpty', ['0'], true],
+ ['stringNotEmpty', [''], false],
+ ['stringNotEmpty', [1234], false],
+ ['integer', [123], true],
+ ['integer', ['123'], false],
+ ['integer', [1.0], false],
+ ['integer', [1.23], false],
+ ['integerish', [1.0], true],
+ ['integerish', [1.23], false],
+ ['integerish', [123], true],
+ ['integerish', ['123'], true],
+ ['float', [1.0], true],
+ ['float', [1.23], true],
+ ['float', [123], false],
+ ['float', ['123'], false],
+ ['numeric', [1.0], true],
+ ['numeric', [1.23], true],
+ ['numeric', [123], true],
+ ['numeric', ['123'], true],
+ ['numeric', ['foo'], false],
+ ['natural', [0], true],
+ ['natural', [1], true],
+ ['natural', [-1], false],
+ ['natural', ['1'], false],
+ ['natural', [1.0], false],
+ ['natural', [1.23], false],
+ ['boolean', [true], true],
+ ['boolean', [false], true],
+ ['boolean', [1], false],
+ ['boolean', ['1'], false],
+ ['scalar', ['1'], true],
+ ['scalar', [123], true],
+ ['scalar', [true], true],
+ ['scalar', [null], false],
+ ['scalar', [[]], false],
+ ['scalar', [new stdClass()], false],
+ ['object', [new stdClass()], true],
+ ['object', [new RuntimeException()], true],
+ ['object', [null], false],
+ ['object', [true], false],
+ ['object', [1], false],
+ ['object', [[]], false],
+ ['resource', [$resource], true],
+ ['resource', [$resource, 'stream'], true],
+ ['resource', [$resource, 'other'], false],
+ ['resource', [1], false],
+ ['isCallable', ['strlen'], true],
+ ['isCallable', [[$this, 'getTests']], true],
+ ['isCallable', [function () {}], true],
+ ['isCallable', [1234], false],
+ ['isCallable', ['foobar'], false],
+ ['isArray', [[]], true],
+ ['isArray', [[1, 2, 3]], true],
+ ['isArray', [new ArrayIterator([])], false],
+ ['isArray', [123], false],
+ ['isArray', [new stdClass()], false],
+ ['isTraversable', [[]], true],
+ ['isTraversable', [[1, 2, 3]], true],
+ ['isTraversable', [new ArrayIterator([])], true],
+ ['isTraversable', [123], false],
+ ['isTraversable', [new stdClass()], false],
+ ['isArrayAccessible', [[]], true],
+ ['isArrayAccessible', [[1, 2, 3]], true],
+ ['isArrayAccessible', [new ArrayObject([])], true],
+ ['isArrayAccessible', [123], false],
+ ['isArrayAccessible', [new stdClass()], false],
+ ['isCountable', [[]], true],
+ ['isCountable', [[1, 2]], true],
+ ['isCountable', [new ArrayIterator([])], true],
+ ['isCountable', [new stdClass()], false],
+ ['isCountable', [new \SimpleXMLElement('bar')], true],
+ ['isCountable', ['abcd'], false],
+ ['isCountable', [123], false],
+ ['isIterable', [[]], true],
+ ['isIterable', [[1, 2, 3]], true],
+ ['isIterable', [new ArrayIterator([])], true],
+ ['isIterable', [123], false],
+ ['isIterable', [new stdClass()], false],
+ ['isInstanceOf', [new stdClass(), 'stdClass'], true],
+ ['isInstanceOf', [new Exception(), 'stdClass'], false],
+ ['isInstanceOf', [123, 'stdClass'], false],
+ ['isInstanceOf', [[], 'stdClass'], false],
+ ['isInstanceOf', [null, 'stdClass'], false],
+ ['notInstanceOf', [new stdClass(), 'stdClass'], false],
+ ['notInstanceOf', [new Exception(), 'stdClass'], true],
+ ['notInstanceOf', [123, 'stdClass'], true],
+ ['notInstanceOf', [[], 'stdClass'], true],
+ ['isInstanceOfAny', [new ArrayIterator(), ['Iterator', 'ArrayAccess']], true],
+ ['isInstanceOfAny', [new Exception(), ['Exception', 'Countable']], true],
+ ['isInstanceOfAny', [new Exception(), ['ArrayAccess', 'Countable']], false],
+ ['isInstanceOfAny', [123, ['stdClass']], false],
+ ['isInstanceOfAny', [[], ['stdClass']], false],
+ ['isAOf', ['stdClass', 'stdClass'], true],
+ ['isAOf', ['stdClass', 123], false],
+ ['isAOf', ['Iterator', 'ArrayIterator'], false],
+ ['isAOf', [123, 'Iterator'], false],
+ ['isAOf', [[], 'Iterator'], false],
+ ['isAnyOf', ['ArrayIterator', ['Iterator', 'ArrayAccess']], true],
+ ['isAnyOf', ['ArrayIterator', [123]], false],
+ ['isAnyOf', ['Exception', ['Exception', 'Countable']], true],
+ ['isAnyOf', ['Exception', ['ArrayAccess', 'Countable']], false],
+ ['isAnyOf', [123, ['stdClass']], false],
+ ['isAnyOf', [[], ['stdClass']], false],
+ ['isNotA', ['stdClass', 'stdClass'], false],
+ ['isNotA', ['stdClass', 123], false],
+ ['isNotA', ['Iterator', 'ArrayIterator'], true],
+ ['isNotA', [123, 'Iterator'], true],
+ ['isNotA', [[], 'Iterator'], true],
+ ['true', [true], true],
+ ['true', [false], false],
+ ['true', [1], false],
+ ['true', [null], false],
+ ['false', [false], true],
+ ['false', [true], false],
+ ['false', [1], false],
+ ['false', [0], false],
+ ['false', [null], false],
+ ['notFalse', [false], false],
+ ['notFalse', [true], true],
+ ['notFalse', [1], true],
+ ['notFalse', [0], true],
+ ['notFalse', [null], true],
+ ['null', [null], true],
+ ['null', [false], false],
+ ['null', [0], false],
+ ['notNull', [false], true],
+ ['notNull', [0], true],
+ ['notNull', [null], false],
+ ['isEmpty', [null], true],
+ ['isEmpty', [false], true],
+ ['isEmpty', [0], true],
+ ['isEmpty', [''], true],
+ ['isEmpty', [1], false],
+ ['isEmpty', ['a'], false],
+ ['notEmpty', [1], true],
+ ['notEmpty', ['a'], true],
+ ['notEmpty', [null], false],
+ ['notEmpty', [false], false],
+ ['notEmpty', [0], false],
+ ['notEmpty', [''], false],
+ ['eq', [1, 1], true],
+ ['eq', [1, '1'], true],
+ ['eq', [1, true], true],
+ ['eq', [1, 0], false],
+ ['notEq', [1, 0], true],
+ ['notEq', [1, 1], false],
+ ['notEq', [1, '1'], false],
+ ['notEq', [1, true], false],
+ ['same', [1, 1], true],
+ ['same', [1, '1'], false],
+ ['same', [1, true], false],
+ ['same', [1, 0], false],
+ ['notSame', [1, 0], true],
+ ['notSame', [1, 1], false],
+ ['notSame', [1, '1'], true],
+ ['notSame', [1, true], true],
+ ['greaterThan', [1, 0], true],
+ ['greaterThan', [0, 0], false],
+ ['greaterThanEq', [2, 1], true],
+ ['greaterThanEq', [1, 1], true],
+ ['greaterThanEq', [0, 1], false],
+ ['lessThan', [0, 1], true],
+ ['lessThan', [1, 1], false],
+ ['lessThanEq', [0, 1], true],
+ ['lessThanEq', [1, 1], true],
+ ['lessThanEq', [2, 1], false],
+ ['range', [1, 1, 2], true],
+ ['range', [2, 1, 2], true],
+ ['range', [0, 1, 2], false],
+ ['range', [3, 1, 2], false],
+ ['oneOf', [1, [1, 2, 3]], true],
+ ['oneOf', [1, ['1', '2', '3']], false],
+ ['inArray', [1, [1, 2, 3]], true],
+ ['inArray', [1, ['1', '2', '3']], false],
+ ['contains', ['abcd', 'ab'], true],
+ ['contains', ['abcd', 'bc'], true],
+ ['contains', ['abcd', 'cd'], true],
+ ['contains', ['abcd', 'de'], false],
+ ['contains', ['', 'de'], false],
+ ['contains', ['äþçð', 'äþ'], true],
+ ['contains', ['äþçð', 'þç'], true],
+ ['contains', ['äþçð', 'çð'], true],
+ ['contains', ['äþçð', 'ðé'], false],
+ ['contains', ['', 'ðé'], false],
+ ['contains', ['あいうえ', 'あい'], true],
+ ['contains', ['あいうえ', 'いう'], true],
+ ['contains', ['あいうえ', 'うえ'], true],
+ ['contains', ['あいうえ', 'えお'], false],
+ ['contains', ['', 'えお'], false],
+ ['contains', ['😄😑☹️', '😄'], true],
+ ['contains', ['😄😑☹️', '😑'], true],
+ ['contains', ['😄😑☹️', '☹️'], true],
+ ['contains', ['😄😑☹️', '😄☹️'], false],
+ ['contains', ['', '😑'], false],
+ ['notContains', ['abcd', 'ab'], false],
+ ['notContains', ['abcd', 'bc'], false],
+ ['notContains', ['abcd', 'cd'], false],
+ ['notContains', ['abcd', 'de'], true],
+ ['notContains', ['', 'de'], true],
+ ['notContains', ['äþçð', 'äþ'], false],
+ ['notContains', ['äþçð', 'þç'], false],
+ ['notContains', ['äþçð', 'çð'], false],
+ ['notContains', ['äþçð', 'ðé'], true],
+ ['notContains', ['', 'ðé'], true],
+ ['notContains', ['あいうえ', 'あい'], false],
+ ['notContains', ['あいうえ', 'いう'], false],
+ ['notContains', ['あいうえ', 'うえ'], false],
+ ['notContains', ['あいうえ', 'えお'], true],
+ ['notContains', ['', 'えお'], true],
+ ['notContains', ['😄😑☹️', '😄'], false],
+ ['notContains', ['😄😑☹️', '😑'], false],
+ ['notContains', ['😄😑☹️', '☹️'], false],
+ ['notContains', ['😄😑☹️', '😄☹️'], true],
+ ['notContains', ['', '😑'], true],
+ ['notWhitespaceOnly', ['abc'], true],
+ ['notWhitespaceOnly', ['123'], true],
+ ['notWhitespaceOnly', [' abc '], true],
+ ['notWhitespaceOnly', ['a b c'], true],
+ ['notWhitespaceOnly', [''], false],
+ ['notWhitespaceOnly', [' '], false],
+ ['notWhitespaceOnly', ["\t"], false],
+ ['notWhitespaceOnly', ["\n"], false],
+ ['notWhitespaceOnly', ["\r"], false],
+ ['notWhitespaceOnly', ["\r\n\t "], false],
+ ['startsWith', ['abcd', 'ab'], true],
+ ['startsWith', ['abcd', 'bc'], false],
+ ['startsWith', ['', 'bc'], false],
+ ['startsWith', ['äþçð', 'äþ'], true],
+ ['startsWith', ['äþçð', 'þç'], false],
+ ['startsWith', ['', 'þç'], false],
+ ['startsWith', ['あいうえ', 'あい'], true],
+ ['startsWith', ['あいうえ', 'いう'], false],
+ ['startsWith', ['', 'いう'], false],
+ ['startsWith', ['😄😑☹️', '😄'], true],
+ ['startsWith', ['😄😑☹️', '😑'], false],
+ ['startsWith', ['', '😑'], false],
+ ['startsWithLetter', ['abcd'], true],
+ ['startsWithLetter', [[66]], false],
+ ['startsWithLetter', ['a'], true],
+ ['startsWithLetter', ['a1'], true],
+ ['startsWithLetter', ['1abcd'], false],
+ ['startsWithLetter', ['1'], false],
+ ['startsWithLetter', [''], false],
+ ['startsWithLetter', [null], false],
+ ['startsWithLetter', [66], false],
+ ['notStartsWith', ['abcd', 'ab'], false],
+ ['notStartsWith', ['abcd', 'bc'], true],
+ ['notStartsWith', ['', 'bc'], true],
+ ['notStartsWith', ['äþçð', 'äþ'], false],
+ ['notStartsWith', ['äþçð', 'þç'], true],
+ ['notStartsWith', ['', 'þç'], true],
+ ['notStartsWith', ['あいうえ', 'あい'], false],
+ ['notStartsWith', ['あいうえ', 'いう'], true],
+ ['notStartsWith', ['', 'いう'], true],
+ ['notStartsWith', ['😄😑☹️', '😄'], false],
+ ['notStartsWith', ['😄😑☹️', '😑'], true],
+ ['notStartsWith', ['', '😑'], true],
+ ['endsWith', ['abcd', 'cd'], true],
+ ['endsWith', ['abcd', 'bc'], false],
+ ['endsWith', ['', 'bc'], false],
+ ['endsWith', ['äþçð', 'çð'], true],
+ ['endsWith', ['äþçð', 'þç'], false],
+ ['endsWith', ['', 'þç'], false],
+ ['endsWith', ['あいうえ', 'うえ'], true],
+ ['endsWith', ['あいうえ', 'いう'], false],
+ ['endsWith', ['', 'いう'], false],
+ ['endsWith', ['😄😑☹️', '☹️'], true],
+ ['endsWith', ['😄😑☹️', '😑'], false],
+ ['endsWith', ['', '😑'], false],
+ ['notEndsWith', ['abcd', 'cd'], false],
+ ['notEndsWith', ['abcd', 'bc'], true],
+ ['notEndsWith', ['', 'bc'], true],
+ ['notEndsWith', ['äþçð', 'çð'], false],
+ ['notEndsWith', ['äþçð', 'þç'], true],
+ ['notEndsWith', ['', 'þç'], true],
+ ['notEndsWith', ['あいうえ', 'うえ'], false],
+ ['notEndsWith', ['あいうえ', 'いう'], true],
+ ['notEndsWith', ['', 'いう'], true],
+ ['notEndsWith', ['😄😑☹️', '☹️'], false],
+ ['notEndsWith', ['😄😑☹️', '😑'], true],
+ ['notEndsWith', ['', '😑'], true],
+ ['regex', ['abcd', '~^ab~'], true],
+ ['regex', ['abcd', '~^bc~'], false],
+ ['regex', ['', '~^bc~'], false],
+ ['notRegex', ['abcd', '{^ab}'], false],
+ ['notRegex', ['abcd', '{^bc}'], true],
+ ['notRegex', ['', '{^bc}'], true],
+ ['unicodeLetters', ['abcd'], true],
+ ['unicodeLetters', ['ᴁڅਘธブ乶'], true],
+ ['unicodeLetters', ['ȁȄ'], true],
+ ['unicodeLetters', ['ȁ1Ȅ'], false],
+ ['unicodeLetters', ['©'], false],
+ ['unicodeLetters', ['🙁'], false],
+ ['unicodeLetters', [''], false],
+ ['alpha', ['abcd'], true],
+ ['alpha', ['ab1cd'], false],
+ ['alpha', [''], false],
+ ['alpha', [66], false],
+ ['alpha', [[]], false],
+ ['digits', ['1234'], true],
+ ['digits', ['12a34'], false],
+ ['digits', [''], false],
+ ['alnum', ['ab12'], true],
+ ['alnum', ['ab12$'], false],
+ ['alnum', [''], false],
+ ['lower', ['abcd'], true],
+ ['lower', ['abCd'], false],
+ ['lower', ['ab_d'], false],
+ ['lower', [''], false],
+ ['upper', ['ABCD'], true],
+ ['upper', ['ABcD'], false],
+ ['upper', ['AB_D'], false],
+ ['upper', [''], false],
+ ['length', ['abcd', 4], true],
+ ['length', ['abc', 4], false],
+ ['length', ['abcde', 4], false],
+ ['length', ['äbcd', 4], true, true],
+ ['length', ['äbc', 4], false, true],
+ ['length', ['äbcde', 4], false, true],
+ ['length', ['あbcd', 4], true, true], // 'HIRAGANA LETTER A' (U+3042)
+ ['length', ['あbc', 4], false, true],
+ ['length', ['あbcde', 4], false, true],
+ ['minLength', ['abcd', 4], true],
+ ['minLength', ['abcde', 4], true],
+ ['minLength', ['abc', 4], false],
+ ['minLength', ['äbcd', 4], true, true],
+ ['minLength', ['äbcde', 4], true, true],
+ ['minLength', ['äbc', 4], false, true],
+ ['minLength', ['あbcd', 4], true, true],
+ ['minLength', ['あbcde', 4], true, true],
+ ['minLength', ['あbc', 4], false, true],
+ ['maxLength', ['abcd', 4], true],
+ ['maxLength', ['abc', 4], true],
+ ['maxLength', ['abcde', 4], false],
+ ['maxLength', ['äbcd', 4], true, true],
+ ['maxLength', ['äbc', 4], true, true],
+ ['maxLength', ['äbcde', 4], false, true],
+ ['maxLength', ['あbcd', 4], true, true],
+ ['maxLength', ['あbc', 4], true, true],
+ ['maxLength', ['あbcde', 4], false, true],
+ ['lengthBetween', ['abcd', 3, 5], true],
+ ['lengthBetween', ['abc', 3, 5], true],
+ ['lengthBetween', ['abcde', 3, 5], true],
+ ['lengthBetween', ['ab', 3, 5], false],
+ ['lengthBetween', ['abcdef', 3, 5], false],
+ ['lengthBetween', ['äbcd', 3, 5], true, true],
+ ['lengthBetween', ['äbc', 3, 5], true, true],
+ ['lengthBetween', ['äbcde', 3, 5], true, true],
+ ['lengthBetween', ['äb', 3, 5], false, true],
+ ['lengthBetween', ['äbcdef', 3, 5], false, true],
+ ['lengthBetween', ['あbcd', 3, 5], true, true],
+ ['lengthBetween', ['あbc', 3, 5], true, true],
+ ['lengthBetween', ['あbcde', 3, 5], true, true],
+ ['lengthBetween', ['あb', 3, 5], false, true],
+ ['lengthBetween', ['あbcdef', 3, 5], false, true],
+ ['fileExists', [__FILE__], true],
+ ['fileExists', [__DIR__], true],
+ ['fileExists', [__DIR__.'/foobar'], false],
+ ['file', [__FILE__], true],
+ ['file', [__DIR__], false],
+ ['file', [__DIR__.'/foobar'], false],
+ ['directory', [__DIR__], true],
+ ['directory', [__FILE__], false],
+ ['directory', [__DIR__.'/foobar'], false],
// no tests for readable()/writable() for now
- array('classExists', array(__CLASS__), true),
- array('classExists', array(__NAMESPACE__.'\Foobar'), false),
- array('subclassOf', array(__CLASS__, __NAMESPACE__.'\BaseTestCase'), true),
- array('subclassOf', array(__CLASS__, 'stdClass'), false),
- array('interfaceExists', array('\Countable'), true),
- array('interfaceExists', array(__CLASS__), false),
- array('implementsInterface', array('ArrayIterator', 'Traversable'), true),
- array('implementsInterface', array(__CLASS__, 'Traversable'), false),
- array('propertyExists', array((object) array('property' => 0), 'property'), true),
- array('propertyExists', array((object) array('property' => null), 'property'), true),
- array('propertyExists', array((object) array('property' => null), 'foo'), false),
- array('propertyNotExists', array((object) array('property' => 0), 'property'), false),
- array('propertyNotExists', array((object) array('property' => null), 'property'), false),
- array('propertyNotExists', array((object) array('property' => null), 'foo'), true),
- array('methodExists', array('RuntimeException', 'getMessage'), true),
- array('methodExists', array(new RuntimeException(), 'getMessage'), true),
- array('methodExists', array('stdClass', 'getMessage'), false),
- array('methodExists', array(new stdClass(), 'getMessage'), false),
- array('methodExists', array(null, 'getMessage'), false),
- array('methodExists', array(true, 'getMessage'), false),
- array('methodExists', array(1, 'getMessage'), false),
- array('methodNotExists', array('RuntimeException', 'getMessage'), false),
- array('methodNotExists', array(new RuntimeException(), 'getMessage'), false),
- array('methodNotExists', array('stdClass', 'getMessage'), true),
- array('methodNotExists', array(new stdClass(), 'getMessage'), true),
- array('methodNotExists', array(null, 'getMessage'), true),
- array('methodNotExists', array(true, 'getMessage'), true),
- array('methodNotExists', array(1, 'getMessage'), true),
- array('keyExists', array(array('key' => 0), 'key'), true),
- array('keyExists', array(array('key' => null), 'key'), true),
- array('keyExists', array(array('key' => null), 'foo'), false),
- array('keyNotExists', array(array('key' => 0), 'key'), false),
- array('keyNotExists', array(array('key' => null), 'key'), false),
- array('keyNotExists', array(array('key' => null), 'foo'), true),
- array('validArrayKey', array('abcd'), true),
- array('validArrayKey', array(1), true),
- array('validArrayKey', array(false), false),
- array('validArrayKey', array(true), false),
- array('validArrayKey', array(new stdClass()), false),
- array('validArrayKey', array(new ToStringClass('testString')), false),
- array('validArrayKey', array(self::getResource()), false),
- array('count', array(array(0, 1, 2), 3), true),
- array('count', array(array(0, 1, 2), 2), false),
- array('minCount', array(array(0), 2), false),
- array('minCount', array(array(0, 1), 2), true),
- array('minCount', array(array(0, 1, 2), 2), true),
- array('maxCount', array(array(0, 1, 2), 2), false),
- array('maxCount', array(array(0, 1), 2), true),
- array('maxCount', array(array(0), 2), true),
- array('countBetween', array(array(0, 1, 2), 4, 5), false),
- array('countBetween', array(array(0, 1, 2), 3, 5), true),
- array('countBetween', array(array(0, 1, 2), 1, 2), false),
- array('countBetween', array(array(0, 1, 2), 2, 5), true),
- array('countBetween', array(array(0, 1, 2), 2, 3), true),
- array('isList', array(array(1, 2, 3)), true),
- array('isList', array(array()), true),
- array('isList', array(array(0 => 1, 2 => 3)), false),
- array('isList', array(array('key' => 1, 'foo' => 2)), false),
- array('isList', array(true), false),
- array('isList', array(false), false),
- array('isList', array(array(true)), true),
- array('isList', array(array(false)), true),
- array('isList', array(array(array(1), array(2))), true),
- array('isList', array(array(array('foo' => 'bar'), array('baz' => 'tab'))), true),
- array('isNonEmptyList', array(array(1, 2, 3)), true),
- array('isNonEmptyList', array(array()), false),
- array('isNonEmptyList', array(array(0 => 1, 2 => 3)), false),
- array('isNonEmptyList', array(array('key' => 1, 'foo' => 2)), false),
- array('isNonEmptyList', array(true), false),
- array('isNonEmptyList', array(false), false),
- array('isNonEmptyList', array(array(true)), true),
- array('isNonEmptyList', array(array(false)), true),
- array('isNonEmptyList', array(array(array(1), array(2))), true),
- array('isNonEmptyList', array(array(array('foo' => 'bar'), array('baz' => 'tab'))), true),
- array('isMap', array(array('key' => 1, 'foo' => 2)), true),
- array('isMap', array(array()), true),
- array('isMap', array(array(1, 2, 3)), false),
- array('isMap', array(array(0 => 1, 2 => 3)), false),
- array('isNonEmptyMap', array(array('key' => 1, 'foo' => 2)), true),
- array('isNonEmptyMap', array(array()), false),
- array('isNonEmptyMap', array(array(1, 2, 3)), false),
- array('isNonEmptyMap', array(array(0 => 1, 2 => 3)), false),
- array('uuid', array('00000000-0000-0000-0000-000000000000'), true),
- array('uuid', array('urn:ff6f8cb0-c57d-21e1-9b21-0800200c9a66'), true),
- array('uuid', array('uuid:{ff6f8cb0-c57d-21e1-9b21-0800200c9a66}'), true),
- array('uuid', array('ff6f8cb0-c57d-21e1-9b21-0800200c9a66'), true),
- array('uuid', array('ff6f8cb0-c57d-11e1-9b21-0800200c9a66'), true),
- array('uuid', array('ff6f8cb0-c57d-31e1-9b21-0800200c9a66'), true),
- array('uuid', array('ff6f8cb0-c57d-41e1-9b21-0800200c9a66'), true),
- array('uuid', array('ff6f8cb0-c57d-51e1-9b21-0800200c9a66'), true),
- array('uuid', array('FF6F8CB0-C57D-11E1-9B21-0800200C9A66'), true),
- array('uuid', array('zf6f8cb0-c57d-11e1-9b21-0800200c9a66'), false),
- array('uuid', array('af6f8cb0c57d11e19b210800200c9a66'), false),
- array('uuid', array('ff6f8cb0-c57da-51e1-9b21-0800200c9a66'), false),
- array('uuid', array('af6f8cb-c57d-11e1-9b21-0800200c9a66'), false),
- array('uuid', array('3f6f8cb0-c57d-11e1-9b21-0800200c9a6'), false),
- array('throws', array(function() { throw new LogicException('test'); }, 'LogicException'), true),
- array('throws', array(function() { throw new LogicException('test'); }, 'IllogicException'), false),
- array('throws', array(function() { throw new Exception('test'); }), true),
- array('throws', array(function() { trigger_error('test'); }, 'Throwable'), true, false, 70000),
- array('throws', array(function() { trigger_error('test'); }, 'Unthrowable'), false, false, 70000),
- array('throws', array(function() { throw new Error(); }, 'Throwable'), true, true, 70000),
- array('ip', array('192.168.0.1'), true),
- array('ip', array(new ToStringClass('192.168.0.1')), true),
- array('ip', array('255.255.255.255'), true),
- array('ip', array('0.0.0.0'), true),
- array('ip', array('2001:0db8:0000:0042:0000:8a2e:0370:7334'), true),
- array('ip', array('::ffff:192.0.2.1'), true),
- array('ip', array('::1'), true),
- array('ip', array('::'), true),
- array('ip', array('foo'), false),
- array('ip', array(123), false),
- array('ip', array(array()), false),
- array('ip', array(null), false),
- array('ip', array(false), false),
- array('ipv4', array('192.168.0.1'), true),
- array('ipv4', array(new ToStringClass('192.168.0.1')), true),
- array('ipv4', array('255.255.255.255'), true),
- array('ipv4', array('0.0.0.0'), true),
- array('ipv4', array('2001:0db8:0000:0042:0000:8a2e:0370:7334'), false),
- array('ipv4', array('::ffff:192.0.2.1'), false),
- array('ipv4', array('::1'), false),
- array('ipv4', array('::'), false),
- array('ipv4', array('foo'), false),
- array('ipv4', array(123), false),
- array('ipv4', array(array()), false),
- array('ipv4', array(null), false),
- array('ipv4', array(false), false),
- array('ipv6', array('192.168.0.1'), false),
- array('ipv6', array('255.255.255.255'), false),
- array('ipv6', array('0.0.0.0'), false),
- array('ipv6', array('2001:0db8:0000:0042:0000:8a2e:0370:7334'), true),
- array('ipv6', array(new ToStringClass('2001:0db8:0000:0042:0000:8a2e:0370:7334')), true),
- array('ipv6', array('::ffff:192.0.2.1'), true),
- array('ipv6', array('::1'), true),
- array('ipv6', array('::'), true),
- array('ipv6', array('foo'), false),
- array('ipv6', array(123), false),
- array('ipv6', array(array()), false),
- array('ipv6', array(null), false),
- array('ipv6', array(false), false),
- array('email', array('foo'), false),
- array('email', array(123), false),
- array('email', array('foo.com'), false),
- array('email', array('foo@bar.com'), true),
- array('email', array(new ToStringClass('foo@bar.com')), true),
- array('uniqueValues', array(array('qwerty', 'qwerty')), false),
- array('uniqueValues', array(array('asdfg', 'qwerty')), true),
- array('uniqueValues', array(array(123, '123')), false),
- );
+ ['classExists', [__CLASS__], true],
+ ['classExists', [__NAMESPACE__.'\Foobar'], false],
+ ['subclassOf', [__CLASS__, __NAMESPACE__.'\BaseTestCase'], true],
+ ['subclassOf', [__CLASS__, 'stdClass'], false],
+ ['interfaceExists', ['\Countable'], true],
+ ['interfaceExists', [__CLASS__], false],
+ ['implementsInterface', ['ArrayIterator', 'Traversable'], true],
+ ['implementsInterface', [__CLASS__, 'Traversable'], false],
+ ['propertyExists', [(object) ['property' => 0], 'property'], true],
+ ['propertyExists', [(object) ['property' => null], 'property'], true],
+ ['propertyExists', [(object) ['property' => null], 'foo'], false],
+ ['propertyNotExists', [(object) ['property' => 0], 'property'], false],
+ ['propertyNotExists', [(object) ['property' => null], 'property'], false],
+ ['propertyNotExists', [(object) ['property' => null], 'foo'], true],
+ ['methodExists', ['RuntimeException', 'getMessage'], true],
+ ['methodExists', [new RuntimeException(), 'getMessage'], true],
+ ['methodExists', ['stdClass', 'getMessage'], false],
+ ['methodExists', [new stdClass(), 'getMessage'], false],
+ ['methodExists', [null, 'getMessage'], false],
+ ['methodExists', [true, 'getMessage'], false],
+ ['methodExists', [1, 'getMessage'], false],
+ ['methodNotExists', ['RuntimeException', 'getMessage'], false],
+ ['methodNotExists', [new RuntimeException(), 'getMessage'], false],
+ ['methodNotExists', ['stdClass', 'getMessage'], true],
+ ['methodNotExists', [new stdClass(), 'getMessage'], true],
+ ['methodNotExists', [null, 'getMessage'], true],
+ ['methodNotExists', [true, 'getMessage'], true],
+ ['methodNotExists', [1, 'getMessage'], true],
+ ['keyExists', [['key' => 0], 'key'], true],
+ ['keyExists', [['key' => null], 'key'], true],
+ ['keyExists', [['key' => null], 'foo'], false],
+ ['keyNotExists', [['key' => 0], 'key'], false],
+ ['keyNotExists', [['key' => null], 'key'], false],
+ ['keyNotExists', [['key' => null], 'foo'], true],
+ ['validArrayKey', ['abcd'], true],
+ ['validArrayKey', [1], true],
+ ['validArrayKey', [false], false],
+ ['validArrayKey', [true], false],
+ ['validArrayKey', [new stdClass()], false],
+ ['validArrayKey', [new ToStringClass('testString')], false],
+ ['validArrayKey', [self::getResource()], false],
+ ['count', [[0, 1, 2], 3], true],
+ ['count', [[0, 1, 2], 2], false],
+ ['minCount', [[0], 2], false],
+ ['minCount', [[0, 1], 2], true],
+ ['minCount', [[0, 1, 2], 2], true],
+ ['maxCount', [[0, 1, 2], 2], false],
+ ['maxCount', [[0, 1], 2], true],
+ ['maxCount', [[0], 2], true],
+ ['countBetween', [[0, 1, 2], 4, 5], false],
+ ['countBetween', [[0, 1, 2], 3, 5], true],
+ ['countBetween', [[0, 1, 2], 1, 2], false],
+ ['countBetween', [[0, 1, 2], 2, 5], true],
+ ['countBetween', [[0, 1, 2], 2, 3], true],
+ ['isList', [[1, 2, 3]], true],
+ ['isList', [[]], true],
+ ['isList', [[0 => 1, 2 => 3]], false],
+ ['isList', [['key' => 1, 'foo' => 2]], false],
+ ['isList', [true], false],
+ ['isList', [false], false],
+ ['isList', [[true]], true],
+ ['isList', [[false]], true],
+ ['isList', [[[1], [2]]], true],
+ ['isList', [[['foo' => 'bar'], ['baz' => 'tab']]], true],
+ ['isNonEmptyList', [[1, 2, 3]], true],
+ ['isNonEmptyList', [[]], false],
+ ['isNonEmptyList', [[0 => 1, 2 => 3]], false],
+ ['isNonEmptyList', [['key' => 1, 'foo' => 2]], false],
+ ['isNonEmptyList', [true], false],
+ ['isNonEmptyList', [false], false],
+ ['isNonEmptyList', [[true]], true],
+ ['isNonEmptyList', [[false]], true],
+ ['isNonEmptyList', [[[1], [2]]], true],
+ ['isNonEmptyList', [[['foo' => 'bar'], ['baz' => 'tab']]], true],
+ ['isMap', [['key' => 1, 'foo' => 2]], true],
+ ['isMap', [[]], true],
+ ['isMap', [[1, 2, 3]], false],
+ ['isMap', [[0 => 1, 2 => 3]], false],
+ ['isNonEmptyMap', [['key' => 1, 'foo' => 2]], true],
+ ['isNonEmptyMap', [[]], false],
+ ['isNonEmptyMap', [[1, 2, 3]], false],
+ ['isNonEmptyMap', [[0 => 1, 2 => 3]], false],
+ ['uuid', ['00000000-0000-0000-0000-000000000000'], true],
+ ['uuid', ['urn:ff6f8cb0-c57d-21e1-9b21-0800200c9a66'], true],
+ ['uuid', ['uuid:{ff6f8cb0-c57d-21e1-9b21-0800200c9a66}'], true],
+ ['uuid', ['ff6f8cb0-c57d-21e1-9b21-0800200c9a66'], true],
+ ['uuid', ['ff6f8cb0-c57d-11e1-9b21-0800200c9a66'], true],
+ ['uuid', ['ff6f8cb0-c57d-31e1-9b21-0800200c9a66'], true],
+ ['uuid', ['ff6f8cb0-c57d-41e1-9b21-0800200c9a66'], true],
+ ['uuid', ['ff6f8cb0-c57d-51e1-9b21-0800200c9a66'], true],
+ ['uuid', ['FF6F8CB0-C57D-11E1-9B21-0800200C9A66'], true],
+ ['uuid', ['zf6f8cb0-c57d-11e1-9b21-0800200c9a66'], false],
+ ['uuid', ['af6f8cb0c57d11e19b210800200c9a66'], false],
+ ['uuid', ['ff6f8cb0-c57da-51e1-9b21-0800200c9a66'], false],
+ ['uuid', ['af6f8cb-c57d-11e1-9b21-0800200c9a66'], false],
+ ['uuid', ['3f6f8cb0-c57d-11e1-9b21-0800200c9a6'], false],
+ ['throws', [function () { throw new LogicException('test'); }, 'LogicException'], true],
+ ['throws', [function () { throw new LogicException('test'); }, 'IllogicException'], false],
+ ['throws', [function () { throw new Exception('test'); }], true],
+ ['throws', [function () { trigger_error('test'); }, 'Throwable'], true, false, 70000],
+ ['throws', [function () { trigger_error('test'); }, 'Unthrowable'], false, false, 70000],
+ ['throws', [function () { throw new Error(); }, 'Throwable'], true, true, 70000],
+ ['ip', ['192.168.0.1'], true],
+ ['ip', [new ToStringClass('192.168.0.1')], true],
+ ['ip', ['255.255.255.255'], true],
+ ['ip', ['0.0.0.0'], true],
+ ['ip', ['2001:0db8:0000:0042:0000:8a2e:0370:7334'], true],
+ ['ip', ['::ffff:192.0.2.1'], true],
+ ['ip', ['::1'], true],
+ ['ip', ['::'], true],
+ ['ip', ['foo'], false],
+ ['ip', [123], false],
+ ['ip', [[]], false],
+ ['ip', [null], false],
+ ['ip', [false], false],
+ ['ipv4', ['192.168.0.1'], true],
+ ['ipv4', [new ToStringClass('192.168.0.1')], true],
+ ['ipv4', ['255.255.255.255'], true],
+ ['ipv4', ['0.0.0.0'], true],
+ ['ipv4', ['2001:0db8:0000:0042:0000:8a2e:0370:7334'], false],
+ ['ipv4', ['::ffff:192.0.2.1'], false],
+ ['ipv4', ['::1'], false],
+ ['ipv4', ['::'], false],
+ ['ipv4', ['foo'], false],
+ ['ipv4', [123], false],
+ ['ipv4', [[]], false],
+ ['ipv4', [null], false],
+ ['ipv4', [false], false],
+ ['ipv6', ['192.168.0.1'], false],
+ ['ipv6', ['255.255.255.255'], false],
+ ['ipv6', ['0.0.0.0'], false],
+ ['ipv6', ['2001:0db8:0000:0042:0000:8a2e:0370:7334'], true],
+ ['ipv6', [new ToStringClass('2001:0db8:0000:0042:0000:8a2e:0370:7334')], true],
+ ['ipv6', ['::ffff:192.0.2.1'], true],
+ ['ipv6', ['::1'], true],
+ ['ipv6', ['::'], true],
+ ['ipv6', ['foo'], false],
+ ['ipv6', [123], false],
+ ['ipv6', [[]], false],
+ ['ipv6', [null], false],
+ ['ipv6', [false], false],
+ ['email', ['foo'], false],
+ ['email', [123], false],
+ ['email', ['foo.com'], false],
+ ['email', ['foo@bar.com'], true],
+ ['email', [new ToStringClass('foo@bar.com')], true],
+ ['uniqueValues', [['qwerty', 'qwerty']], false],
+ ['uniqueValues', [['asdfg', 'qwerty']], true],
+ ['uniqueValues', [[123, '123']], false],
+ ];
}
public function getMethods()
{
- $methods = array();
+ $methods = [];
foreach ($this->getTests() as $params) {
- $methods[$params[0]] = array($params[0]);
+ $methods[$params[0]] = [$params[0]];
}
return array_values($methods);
@@ -649,7 +650,7 @@ public function testAssert($method, $args, $success, $multibyte = false, $minVer
$this->setExpectedException('\InvalidArgumentException');
}
- call_user_func_array(array('Webmozart\Assert\Assert', $method), $args);
+ call_user_func_array(['Webmozart\Assert\Assert', $method], $args);
$this->addToAssertionCount(1);
}
@@ -671,7 +672,7 @@ public function testNullOr($method, $args, $success, $multibyte = false, $minVer
$this->setExpectedException('\InvalidArgumentException');
}
- call_user_func_array(array('Webmozart\Assert\Assert', 'nullOr'.ucfirst($method)), $args);
+ call_user_func_array(['Webmozart\Assert\Assert', 'nullOr'.ucfirst($method)], $args);
$this->addToAssertionCount(1);
}
@@ -680,7 +681,7 @@ public function testNullOr($method, $args, $success, $multibyte = false, $minVer
*/
public function testNullOrAcceptsNull($method)
{
- call_user_func(array('Webmozart\Assert\Assert', 'nullOr'.ucfirst($method)), null);
+ call_user_func(['Webmozart\Assert\Assert', 'nullOr'.ucfirst($method)], null);
$this->addToAssertionCount(1);
}
@@ -703,9 +704,9 @@ public function testAllArray($method, $args, $success, $multibyte = false, $minV
}
$arg = array_shift($args);
- array_unshift($args, array($arg));
+ array_unshift($args, [$arg]);
- call_user_func_array(array('Webmozart\Assert\Assert', 'all'.ucfirst($method)), $args);
+ call_user_func_array(['Webmozart\Assert\Assert', 'all'.ucfirst($method)], $args);
$this->addToAssertionCount(1);
}
@@ -728,35 +729,35 @@ public function testAllTraversable($method, $args, $success, $multibyte = false,
}
$arg = array_shift($args);
- array_unshift($args, new ArrayIterator(array($arg)));
+ array_unshift($args, new ArrayIterator([$arg]));
- call_user_func_array(array('Webmozart\Assert\Assert', 'all'.ucfirst($method)), $args);
+ call_user_func_array(['Webmozart\Assert\Assert', 'all'.ucfirst($method)], $args);
$this->addToAssertionCount(1);
}
public function getStringConversions()
{
- return array(
- array('integer', array('foobar'), 'Expected an integer. Got: string'),
- array('string', array(1), 'Expected a string. Got: integer'),
- array('string', array(true), 'Expected a string. Got: boolean'),
- array('string', array(null), 'Expected a string. Got: NULL'),
- array('string', array(array()), 'Expected a string. Got: array'),
- array('string', array(new stdClass()), 'Expected a string. Got: stdClass'),
- array('string', array(self::getResource()), 'Expected a string. Got: resource'),
-
- array('eq', array('1', '2'), 'Expected a value equal to "2". Got: "1"'),
- array('eq', array(new ToStringClass("XXX"), new ToStringClass("YYY")), 'Expected a value equal to '. __NAMESPACE__ . '\ToStringClass: "YYY". Got: '. __NAMESPACE__ . '\ToStringClass: "XXX"'),
- array('eq', array(1, 2), 'Expected a value equal to 2. Got: 1'),
- array('eq', array(true, false), 'Expected a value equal to false. Got: true'),
- array('eq', array(true, null), 'Expected a value equal to null. Got: true'),
- array('eq', array(null, true), 'Expected a value equal to true. Got: null'),
- array('eq', array(array(1), array(2)), 'Expected a value equal to array. Got: array'),
- array('eq', array(new ArrayIterator(array()), new stdClass()), 'Expected a value equal to stdClass. Got: ArrayIterator'),
- array('eq', array(1, self::getResource()), 'Expected a value equal to resource. Got: 1'),
-
- array('lessThan', array(new \DateTime('2020-01-01 00:00:00'), new \DateTime('1999-01-01 00:00:00')), 'Expected a value less than DateTime: "1999-01-01T00:00:00+00:00". Got: DateTime: "2020-01-01T00:00:00+00:00"'),
- );
+ return [
+ ['integer', ['foobar'], 'Expected an integer. Got: string'],
+ ['string', [1], 'Expected a string. Got: integer'],
+ ['string', [true], 'Expected a string. Got: boolean'],
+ ['string', [null], 'Expected a string. Got: NULL'],
+ ['string', [[]], 'Expected a string. Got: array'],
+ ['string', [new stdClass()], 'Expected a string. Got: stdClass'],
+ ['string', [self::getResource()], 'Expected a string. Got: resource'],
+
+ ['eq', ['1', '2'], 'Expected a value equal to "2". Got: "1"'],
+ ['eq', [new ToStringClass("XXX"), new ToStringClass("YYY")], 'Expected a value equal to '. __NAMESPACE__ . '\ToStringClass: "YYY". Got: '. __NAMESPACE__ . '\ToStringClass: "XXX"'],
+ ['eq', [1, 2], 'Expected a value equal to 2. Got: 1'],
+ ['eq', [true, false], 'Expected a value equal to false. Got: true'],
+ ['eq', [true, null], 'Expected a value equal to null. Got: true'],
+ ['eq', [null, true], 'Expected a value equal to true. Got: null'],
+ ['eq', [[1], [2]], 'Expected a value equal to array. Got: array'],
+ ['eq', [new ArrayIterator([]), new stdClass()], 'Expected a value equal to stdClass. Got: ArrayIterator'],
+ ['eq', [1, self::getResource()], 'Expected a value equal to resource. Got: 1'],
+
+ ['lessThan', [new \DateTime('2020-01-01 00:00:00'), new \DateTime('1999-01-01 00:00:00')], 'Expected a value less than DateTime: "1999-01-01T00:00:00+00:00". Got: DateTime: "2020-01-01T00:00:00+00:00"'],
+ ];
}
/**
@@ -766,7 +767,7 @@ public function testConvertValuesToStrings($method, $args, $exceptionMessage)
{
$this->setExpectedException('\InvalidArgumentException', $exceptionMessage);
- call_user_func_array(array('Webmozart\Assert\Assert', $method), $args);
+ call_user_func_array(['Webmozart\Assert\Assert', $method], $args);
}
public function testAnUnknownMethodThrowsABadMethodCall()
@@ -780,8 +781,8 @@ public function testAnUnknownMethodThrowsABadMethodCall()
/**
* @ignore
*/
-class ToStringClass {
-
+class ToStringClass
+{
/**
* @var string
*/
@@ -796,4 +797,4 @@ public function __toString()
{
return $this->value;
}
-}
\ No newline at end of file
+}
diff --git a/tests/unit/FilterInputTest.php b/tests/unit/FilterInputTest.php
index 94da793..9d1bfe9 100644
--- a/tests/unit/FilterInputTest.php
+++ b/tests/unit/FilterInputTest.php
@@ -1,4 +1,5 @@
assertSame($instance, $this->object);
- $instance = FilterInput::getInstance(array(), array(), 0, 0, 0);
+ $instance = FilterInput::getInstance([], [], 0, 0, 0);
$this->assertNotSame($instance, $this->object);
}
@@ -72,7 +73,7 @@ public function testCleanVarDefault()
public function testCleanVarFilter()
{
- $filter = FilterInput::getInstance(array(), array(), 1, 1);
+ $filter = FilterInput::getInstance([], [], 1, 1);
$safeTest = '
This is a simple test.
';
$this->assertEquals($safeTest, $filter->cleanVar($safeTest));
@@ -80,7 +81,7 @@ public function testCleanVarFilter()
public function testCleanVarFilterXss()
{
- $filter = FilterInput::getInstance(array(), array(), 1, 1);
+ $filter = FilterInput::getInstance([], [], 1, 1);
$xssTest = 'This is a xss test.
';
$xssTestExpect = 'This is a xss alert(); test.
';
@@ -89,19 +90,19 @@ public function testCleanVarFilterXss()
public function getTestForCleanVarType()
{
- return array(
- array('100', 'int', 100),
- array('100', 'INTEGER', 100),
- array('55.1', 'FLOAT', 55.1),
- array('55.1', 'DOUBLE', 55.1),
- array('1', 'BOOL', true),
- array('0', 'BOOLEAN', false),
- array('Value', 'WORD', 'Value'),
- array('Alpha99', 'ALPHANUM', 'Alpha99'),
- array('Alpha99', 'ALNUM', 'Alpha99'),
- array('value', 'ARRAY', array('value')),
+ return [
+ ['100', 'int', 100],
+ ['100', 'INTEGER', 100],
+ ['55.1', 'FLOAT', 55.1],
+ ['55.1', 'DOUBLE', 55.1],
+ ['1', 'BOOL', true],
+ ['0', 'BOOLEAN', false],
+ ['Value', 'WORD', 'Value'],
+ ['Alpha99', 'ALPHANUM', 'Alpha99'],
+ ['Alpha99', 'ALNUM', 'Alpha99'],
+ ['value', 'ARRAY', ['value']],
// ['value', 'type', 'expected'],
- );
+ ];
}
/**
diff --git a/tests/unit/HighlighterTest.php b/tests/unit/HighlighterTest.php
index 9012e5c..fa9bfd2 100644
--- a/tests/unit/HighlighterTest.php
+++ b/tests/unit/HighlighterTest.php
@@ -1,4 +1,5 @@
object = new Highlighter;
+ $this->object = new Highlighter();
$this->assertInstanceOf('Xmf\Highlighter', $this->object);
}
@@ -33,13 +34,13 @@ public function testApply()
$output = Highlighter::apply('test', 'This test is OK.');
$this->assertEquals('This test is OK.', $output);
- $output = Highlighter::apply(array('test','ok'), 'This test is OK.', '', '');
+ $output = Highlighter::apply(['test','ok'], 'This test is OK.', '', '');
$this->assertEquals('This test is OK.', $output);
$output = Highlighter::apply('test ok', 'This test is OK.', '', '');
$this->assertEquals('This test is OK.', $output);
- $output = Highlighter::apply(array('test','ok'), 'This test is OK.', '', '');
+ $output = Highlighter::apply(['test','ok'], 'This test is OK.', '', '');
$this->assertEquals('This test is OK.', $output);
}
}
diff --git a/tests/unit/Jwt/KeyFactoryTest.php b/tests/unit/Jwt/KeyFactoryTest.php
index 510fb9a..6833e90 100644
--- a/tests/unit/Jwt/KeyFactoryTest.php
+++ b/tests/unit/Jwt/KeyFactoryTest.php
@@ -1,4 +1,5 @@
expectException('\InvalidArgumentException');
- $instance = KeyFactory::build(array('muck'), $this->storage);
+ $instance = KeyFactory::build(['muck'], $this->storage);
}
}
diff --git a/tests/unit/Jwt/TokenFactoryTest.php b/tests/unit/Jwt/TokenFactoryTest.php
index 35ff794..5d63a4c 100644
--- a/tests/unit/Jwt/TokenFactoryTest.php
+++ b/tests/unit/Jwt/TokenFactoryTest.php
@@ -1,4 +1,5 @@
'cute');
+ $claims = ['rat' => 'cute'];
$token = TokenFactory::build($this->testKey, $claims);
$this->assertTrue(is_string($token));
@@ -58,7 +59,7 @@ public function testBuild()
$this->assertEquals($value, $actual->$name);
}
- $claims = array('rat' => 'cute', 'exp' => (time() - 30));
+ $claims = ['rat' => 'cute', 'exp' => (time() - 30)];
$token = TokenFactory::build($this->testKey, $claims);
//$this->expectException('\PHPUnit\Framework\Error\Notice');
$actual = @$jwt->decode($token);
diff --git a/tests/unit/Jwt/TokenReaderTest.php b/tests/unit/Jwt/TokenReaderTest.php
index b4ec364..2f421d5 100644
--- a/tests/unit/Jwt/TokenReaderTest.php
+++ b/tests/unit/Jwt/TokenReaderTest.php
@@ -1,4 +1,5 @@
'cute');
+ $claims = ['rat' => 'cute'];
$jwt = new JsonWebToken($this->testKey);
$token = $jwt->create($claims);
@@ -54,7 +55,7 @@ public function testFromString()
$this->assertEquals($value, $actual->$name);
}
- $actual = TokenReader::fromString($this->testKey, $token, array('rat' => 'odd'));
+ $actual = TokenReader::fromString($this->testKey, $token, ['rat' => 'odd']);
$this->assertFalse($actual);
}
diff --git a/tests/unit/Key/ArrayStorageTest.php b/tests/unit/Key/ArrayStorageTest.php
index fe6e799..c3582c9 100644
--- a/tests/unit/Key/ArrayStorageTest.php
+++ b/tests/unit/Key/ArrayStorageTest.php
@@ -1,4 +1,5 @@
object = new ArrayStorage;
+ $this->object = new ArrayStorage();
}
/**
diff --git a/tests/unit/Key/KeyAbstractTest.php b/tests/unit/Key/KeyAbstractTest.php
index 0239098..c0ec82c 100644
--- a/tests/unit/Key/KeyAbstractTest.php
+++ b/tests/unit/Key/KeyAbstractTest.php
@@ -1,4 +1,5 @@
storage = new ArrayStorage();
- $this->object = $this->getMockForAbstractClass('Xmf\Key\KeyAbstract', array($this->storage, 'test'));
+ $this->object = $this->getMockForAbstractClass('Xmf\Key\KeyAbstract', [$this->storage, 'test']);
}
/**
diff --git a/tests/unit/MetagenTest.php b/tests/unit/MetagenTest.php
index 6b2e773..14edf5f 100644
--- a/tests/unit/MetagenTest.php
+++ b/tests/unit/MetagenTest.php
@@ -1,4 +1,5 @@
object = new Metagen;
+ $this->object = new Metagen();
}
/**
@@ -58,7 +59,7 @@ public function testAssignTitle()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
- 'This test has not been implemented yet.'
+ 'This test has not been implemented yet.'
);
}
@@ -66,7 +67,7 @@ public function testAssignKeywords()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
- 'This test has not been implemented yet.'
+ 'This test has not been implemented yet.'
);
}
@@ -74,7 +75,7 @@ public function testAssignDescription()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
- 'This test has not been implemented yet.'
+ 'This test has not been implemented yet.'
);
}
@@ -85,7 +86,7 @@ public function testGenerateKeywords()
);
$body = self::DOI_TEXT;
$numKeys = 20;
- $forced = array('declaration', 'independence');
+ $forced = ['declaration', 'independence'];
$keys = $this->object->generateKeywords($body, $numKeys, 3, $forced);
$this->assertTrue(count($keys) == $numKeys);
// test that forced keywords and words with more than 2 occurances are present
@@ -132,7 +133,7 @@ public function testGenerateMetaTags()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
- 'This test has not been implemented yet.'
+ 'This test has not been implemented yet.'
);
}
@@ -163,43 +164,43 @@ public function testGetSearchSummary()
significant keywords.
EOT;
- $needles = array();
+ $needles = [];
$expected = 'Testing this method will require a long' . $ellipsis;
$actual = Metagen::getSearchSummary($haystack, $needles, 40);
$this->assertEquals($expected, $actual, $actual);
- $needles = array('testing');
+ $needles = ['testing'];
$expected = 'Testing this method will require a long' . $ellipsis;
$actual = Metagen::getSearchSummary($haystack, $needles, 40);
$this->assertEquals($expected, $actual, $actual);
- $needles = array('significant');
+ $needles = ['significant'];
$expected = $ellipsis . 'very different significant keywords.';
$actual = Metagen::getSearchSummary($haystack, $needles, 40);
$this->assertEquals($expected, $actual, $actual);
- $needles = array('one hundred');
+ $needles = ['one hundred'];
$expected = $ellipsis . 'that will exceed one hundred twenty' . $ellipsis;
$actual = Metagen::getSearchSummary($haystack, $needles, 40);
$this->assertEquals($expected, $actual, $actual);
- $needles = array('testing', 'significant', 'one hundred');
+ $needles = ['testing', 'significant', 'one hundred'];
$expected = 'Testing this method will require a long' . $ellipsis;
$actual = Metagen::getSearchSummary($haystack, $needles, 40);
$this->assertEquals($expected, $actual, $actual);
- $needles = array('significant', 'one hundred', 'testing');
+ $needles = ['significant', 'one hundred', 'testing'];
$expected = 'Testing this method will require a long' . $ellipsis;
$actual = Metagen::getSearchSummary($haystack, $needles, 40);
$this->assertEquals($expected, $actual, $actual);
- $needles = array('will');
+ $needles = ['will'];
$expected = 'Testing this method will require a long' . $ellipsis;
$actual = Metagen::getSearchSummary($haystack, $needles, 40);
$this->assertEquals($expected, $actual, $actual);
$nowhitespace = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0abcdefghijklmnopqrstuvwxyz';
- $needles = array('0');
+ $needles = ['0'];
$expected = $ellipsis . 'GHIJKLMNOPQRSTUVWXYZ0abcdefghijklmnopqrs' . $ellipsis;
$actual = Metagen::getSearchSummary($nowhitespace, $needles, 40);
$this->assertEquals($expected, $actual, $actual);
@@ -211,7 +212,7 @@ public function testAsPlainText()
$method->setAccessible(true);
$input = " This is\r\na test of\ncleaning\rup a string.
";
$expected = 'This is a test of cleaning up a string.';
- $actual = $method->invokeArgs($this->object, array($input));
+ $actual = $method->invokeArgs($this->object, [$input]);
$this->assertEquals($expected, $actual, $actual);
}
}
diff --git a/tests/unit/ProxyCheckTest.php b/tests/unit/ProxyCheckTest.php
index b99d11c..e6d712c 100644
--- a/tests/unit/ProxyCheckTest.php
+++ b/tests/unit/ProxyCheckTest.php
@@ -1,4 +1,5 @@
assertSame($expected, $obj->get());
}
-}
\ No newline at end of file
+}
diff --git a/tests/unit/RequestTest.php b/tests/unit/RequestTest.php
index 76b6145..b43033b 100644
--- a/tests/unit/RequestTest.php
+++ b/tests/unit/RequestTest.php
@@ -1,4 +1,5 @@
object = new Request;
+ $this->object = new Request();
}
/**
@@ -31,7 +32,7 @@ public function testGetMethod()
{
$_SERVER['REQUEST_METHOD'] = 'GET';
$method = Request::getMethod();
- $this->assertTrue(in_array($method, array('GET', 'HEAD', 'POST', 'PUT')));
+ $this->assertTrue(in_array($method, ['GET', 'HEAD', 'POST', 'PUT']));
}
public function testGetVar()
@@ -176,14 +177,14 @@ public function testGetArray()
{
$varname = 'RequestTest';
- $testArray = array('one', 'two', 'three');
+ $testArray = ['one', 'two', 'three'];
$_REQUEST[$varname] = $testArray;
$get = Request::getArray($varname, null, 'request');
$this->assertTrue(is_array($get));
$this->assertEquals($get, $testArray);
- $testArray2 = array('one', 'two', '');
+ $testArray2 = ['one', 'two', ''];
$_REQUEST[$varname] = $testArray2;
$get = Request::getArray($varname, null, 'request');
@@ -233,7 +234,7 @@ public function testGet()
public function testSet()
{
$varname = 'RequestTest';
- Request::set(array($varname => 'Pourquoi'), 'get');
+ Request::set([$varname => 'Pourquoi'], 'get');
$this->assertEquals($_REQUEST[$varname], 'Pourquoi');
}
}
diff --git a/tests/unit/StopWordsTest.php b/tests/unit/StopWordsTest.php
index d8d3215..ec0e351 100644
--- a/tests/unit/StopWordsTest.php
+++ b/tests/unit/StopWordsTest.php
@@ -1,4 +1,5 @@
stopwordList = array_fill_keys(array('it', 'is', 'our', 'mock'), true);
+ $this->stopwordList = array_fill_keys(['it', 'is', 'our', 'mock'], true);
}
}
@@ -27,7 +28,7 @@ class StopWordsTest extends \PHPUnit\Framework\TestCase
*/
protected function setUp()
{
- $this->object = new MockStopWords;
+ $this->object = new MockStopWords();
}
/**
diff --git a/tests/unit/YamlTest.php b/tests/unit/YamlTest.php
index f6114ce..bfb4c07 100644
--- a/tests/unit/YamlTest.php
+++ b/tests/unit/YamlTest.php
@@ -1,4 +1,5 @@
1, 'two' => array(1, 2), 'three' => '');
+ $inputArray = ['one' => 1, 'two' => [1, 2], 'three' => ''];
$string = Yaml::dump($inputArray);
$this->assertTrue(!empty($string));
@@ -37,7 +38,7 @@ public function testDumpAndLoad()
public function testSaveAndRead()
{
$tmpfname = tempnam(sys_get_temp_dir(), 'TEST');
- $inputArray = array('one' => 1, 'two' => array(1, 2), 'three' => '');
+ $inputArray = ['one' => 1, 'two' => [1, 2], 'three' => ''];
$byteCount = Yaml::save($inputArray, $tmpfname);
$this->assertFalse($byteCount === false);
@@ -52,7 +53,7 @@ public function testSaveAndRead()
public function testDumpAndLoadWrapped()
{
- $inputArray = array('one' => 1, 'two' => array(1, 2), 'three' => '');
+ $inputArray = ['one' => 1, 'two' => [1, 2], 'three' => ''];
$string = Yaml::dumpWrapped($inputArray);
$this->assertTrue(!empty($string));
@@ -65,7 +66,7 @@ public function testDumpAndLoadWrapped()
public function testDumpAndLoadWrappedStress()
{
- $inputArray = array('start' => '---', 'end' => '...', 'misc' => 'stuff');
+ $inputArray = ['start' => '---', 'end' => '...', 'misc' => 'stuff'];
$string = Yaml::dumpWrapped($inputArray);
$this->assertTrue(!empty($string));
@@ -78,7 +79,7 @@ public function testDumpAndLoadWrappedStress()
public function testDumpAndLoadWrappedStress2()
{
- $inputArray = array('start' => '---', 'end' => '...', 'misc' => 'stuff');
+ $inputArray = ['start' => '---', 'end' => '...', 'misc' => 'stuff'];
$string = Yaml::dump($inputArray);
$this->assertTrue(!empty($string));
@@ -92,7 +93,7 @@ public function testDumpAndLoadWrappedStress2()
public function testSaveAndReadWrapped()
{
$tmpfname = tempnam(sys_get_temp_dir(), 'TEST');
- $inputArray = array('one' => 1, 'two' => array(1, 2), 'three' => '');
+ $inputArray = ['one' => 1, 'two' => [1, 2], 'three' => ''];
$byteCount = Yaml::saveWrapped($inputArray, $tmpfname);
$this->assertFalse($byteCount === false);