Skip to content

Commit

Permalink
Changing function name from underscore to camel case
Browse files Browse the repository at this point in the history
  • Loading branch information
burzum committed Oct 8, 2017
1 parent 9eb5a52 commit 56ff8fa
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 9 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,
get_var_type($parser)
getVarType($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 = get_var_type($commands);
$type = getVarType($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/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,
get_var_type($cookie),
getVarType($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.', get_var_type($options['validate']))
sprintf('validate must be a boolean, a string or an object. Got %s.', getVarType($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,
get_var_type($context)
getVarType($context)
));
}

Expand Down
4 changes: 2 additions & 2 deletions src/basics.php
Expand Up @@ -156,14 +156,14 @@ function loadPHPUnitAliases()
}
}

if (!function_exists('get_var_type')) {
if (!function_exists('getVarType')) {
/**
* Returns the objects class or var type of it's not an object
*
* @param mixed $var Variable to check
* @return string Returns the class name or variable type
*/
function get_var_type($var)
function getVarType($var)
{
return is_object($var) ? get_class($var) : gettype($var);
}
Expand Down
16 changes: 14 additions & 2 deletions tests/TestCase/BasicsTest.php
Expand Up @@ -576,7 +576,7 @@ public function testCollection()
public function testEventManagerReset1()
{
$eventManager = EventManager::instance();
$this->assertInstanceOf('Cake\Event\EventManager', $eventManager);
$this->assertInstanceOf(EventManager::class, $eventManager);

return $eventManager;
}
Expand All @@ -589,7 +589,19 @@ public function testEventManagerReset1()
*/
public function testEventManagerReset2($prevEventManager)
{
$this->assertInstanceOf('Cake\Event\EventManager', $prevEventManager);
$this->assertInstanceOf(EventManager::class, $prevEventManager);
$this->assertNotSame($prevEventManager, EventManager::instance());
}

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

0 comments on commit 56ff8fa

Please sign in to comment.