Skip to content

Commit

Permalink
[UtilitiesBundle] Code improvement found by static code analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
acrobat committed May 21, 2019
1 parent 6cc410f commit ff332ac
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Helper/Cipher/UrlSafeCipher.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ public function hex2bin($hexString)
{
$pos = 0;
$result = '';
while ($pos < strlen($hexString)) {
while ($pos < \strlen($hexString)) {
if (strpos(" \t\n\r", $hexString[$pos]) !== false) {
++$pos;
} else {
$code = hexdec(substr($hexString, $pos, 2));
$pos += 2;
$result .= chr($code);
$result .= \chr($code);
}
}

Expand Down
4 changes: 2 additions & 2 deletions Helper/ClassLookup.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class ClassLookup
*/
public static function getClass($object)
{
return ($object instanceof Proxy) ? get_parent_class($object) : get_class($object);
return ($object instanceof Proxy) ? get_parent_class($object) : \get_class($object);
}

/**
Expand All @@ -30,7 +30,7 @@ public static function getClass($object)
*/
public static function getClassName($reference)
{
$reference = is_string($reference) ? $reference : ClassLookup::getClass($reference);
$reference = \is_string($reference) ? $reference : self::getClass($reference);
$className = explode('\\', $reference);

return array_pop($className);
Expand Down
2 changes: 1 addition & 1 deletion Helper/Shell/Shell.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function isRunning($pid)
{
exec("ps $pid", $processState);

return count($processState) >= 2;
return \count($processState) >= 2;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use Kunstmaan\UtilitiesBundle\DependencyInjection\Compiler\DeprecateClassParametersPass;
use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractCompilerPassTestCase;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;

class DeprecateClassParametersPassTest extends AbstractCompilerPassTestCase
{
Expand Down
4 changes: 2 additions & 2 deletions Twig/UtilitiesTwigExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ public function __construct($slugifier)
*/
public function getFilters()
{
return array(
return [
new \Twig_SimpleFilter('slugify', [$this, 'slugify']),
);
];
}

/**
Expand Down

0 comments on commit ff332ac

Please sign in to comment.