Skip to content

Commit

Permalink
Renaming getVarType() to getTypeName()
Browse files Browse the repository at this point in the history
  • Loading branch information
burzum committed Oct 9, 2017
1 parent 6d301e3 commit 61d6e68
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/Console/Command.php
Expand Up @@ -116,7 +116,7 @@ public function getOptionParser()
throw new RuntimeException(sprintf(
"Invalid option parser returned from buildOptionParser(). Expected %s, got %s",
ConsoleOptionParser::class,
getVarType($parser)
getTypeName($parser)
));
}

Expand Down
2 changes: 1 addition & 1 deletion src/Console/CommandRunner.php
Expand Up @@ -119,7 +119,7 @@ public function run(array $argv, ConsoleIo $io = null)
]);
$commands = $this->app->console($commands);
if (!($commands instanceof CommandCollection)) {
$type = getVarType($commands);
$type = getTypeName($commands);
throw new RuntimeException(
"The application's `console` method did not return a CommandCollection." .
" Got '{$type}' instead."
Expand Down
2 changes: 1 addition & 1 deletion src/Core/functions.php
Expand Up @@ -288,7 +288,7 @@ function deprecationWarning($message, $stackFrame = 2)
* @param mixed $var Variable to check
* @return string Returns the class name or variable type
*/
function getVarType($var)
function getTypeName($var)
{
return is_object($var) ? get_class($var) : gettype($var);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Cookie/CookieCollection.php
Expand Up @@ -183,7 +183,7 @@ protected function checkCookies(array $cookies)
sprintf(
'Expected `%s[]` as $cookies but instead got `%s` at index %d',
static::class,
getVarType($cookie),
getTypeName($cookie),
$index
)
);
Expand Down
2 changes: 1 addition & 1 deletion src/ORM/Marshaller.php
Expand Up @@ -247,7 +247,7 @@ protected function _validate($data, $options, $isNew)
}
if (!is_object($options['validate'])) {
throw new RuntimeException(
sprintf('validate must be a boolean, a string or an object. Got %s.', getVarType($options['validate']))
sprintf('validate must be a boolean, a string or an object. Got %s.', getTypeName($options['validate']))
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/View/Form/ContextFactory.php
Expand Up @@ -146,7 +146,7 @@ public function get(ServerRequest $request, array $data = [])
throw new RuntimeException(sprintf(
'Context providers must return object implementing %s. Got "%s" instead.',
ContextInterface::class,
getVarType($context)
getTypeName($context)
));
}

Expand Down
10 changes: 5 additions & 5 deletions tests/TestCase/Core/FunctionsTest.php
Expand Up @@ -79,14 +79,14 @@ public function testDeprecationWarningLevelDisabled()
}

/**
* testing getVarType()
* testing getTypeName()
*
* @return void
*/
public function testGetVarType()
public function testgetTypeName()
{
$this->assertEquals('stdClass', getVarType(new \stdClass()));
$this->assertEquals('array', getVarType([]));
$this->assertEquals('string', getVarType(''));
$this->assertEquals('stdClass', getTypeName(new \stdClass()));
$this->assertEquals('array', getTypeName([]));
$this->assertEquals('string', getTypeName(''));
}
}

0 comments on commit 61d6e68

Please sign in to comment.