Skip to content

Commit

Permalink
SCA with Php Inspections (EA Ultimate): tweak misused functions calls
Browse files Browse the repository at this point in the history
  • Loading branch information
kalessil committed Apr 27, 2018
1 parent fd0e9b8 commit c160b87
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/Filesystem/Folder.php
Expand Up @@ -345,7 +345,7 @@ public static function isAbsolute($path)
*/
public static function isRegisteredStreamWrapper($path)
{
return preg_match('/^[^:\/\/]+?(?=:\/\/)/i', $path, $matches) &&
return preg_match('/^[^:\/\/]+?(?=:\/\/)/', $path, $matches) &&
in_array($matches[0], stream_get_wrappers());
}

Expand Down
6 changes: 1 addition & 5 deletions src/Http/Client/Auth/Oauth.php
Expand Up @@ -360,11 +360,7 @@ protected function _buildAuth($data)
*/
protected function _encode($value)
{
return str_replace(
'+',
' ',
str_replace('%7E', '~', rawurlencode($value))
);
return str_replace(['%7E', '+'], ['~', ' '], rawurlencode($value));
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/ORM/Association/HasMany.php
Expand Up @@ -481,7 +481,7 @@ function ($ent) use ($primaryKey) {
)
->filter(
function ($v) {
return !in_array(null, array_values($v), true);
return !in_array(null, $v, true);
}
)
->toArray();
Expand Down
2 changes: 1 addition & 1 deletion src/Routing/Route/Route.php
Expand Up @@ -360,7 +360,7 @@ protected function _writeRoute()
$mode = 'u';
}
krsort($routeParams);
$parsed = str_replace(array_keys($routeParams), array_values($routeParams), $parsed);
$parsed = str_replace(array_keys($routeParams), $routeParams, $parsed);
$this->_compiledRoute = '#^' . $parsed . '[/]*$#' . $mode;
$this->keys = $names;

Expand Down
4 changes: 2 additions & 2 deletions src/TestSuite/Fixture/FixtureManager.php
Expand Up @@ -189,7 +189,7 @@ protected function _loadFixtures($test)
} elseif ($type === 'plugin') {
list($plugin, $name) = explode('.', $pathName);
// Flip vendored plugin separators
$path = implode('\\', explode('/', $plugin));
$path = str_replace('/', '\\', $plugin);
$baseNamespace = Inflector::camelize(str_replace('\\', '\ ', $path));
$additionalPath = null;
} else {
Expand All @@ -199,7 +199,7 @@ protected function _loadFixtures($test)

// Tweak subdirectory names, so camelize() can make the correct name
if (strpos($name, '/') > 0) {
$name = implode('\\ ', explode('/', $name));
$name = str_replace('/', '\\ ', $name);
}

$name = Inflector::camelize($name);
Expand Down
2 changes: 1 addition & 1 deletion src/Utility/Inflector.php
Expand Up @@ -764,7 +764,7 @@ public static function slug($string, $replacement = '-')

$string = str_replace(
array_keys(static::$_transliteration),
array_values(static::$_transliteration),
static::$_transliteration,
$string
);

Expand Down
3 changes: 1 addition & 2 deletions src/Validation/Validation.php
Expand Up @@ -718,8 +718,7 @@ public static function decimal($check, $places = null, $regex = null)
$decimalPoint = $formatter->getSymbol(NumberFormatter::DECIMAL_SEPARATOR_SYMBOL);
$groupingSep = $formatter->getSymbol(NumberFormatter::GROUPING_SEPARATOR_SYMBOL);

$check = str_replace($groupingSep, '', $check);
$check = str_replace($decimalPoint, '.', $check);
$check = str_replace([$groupingSep, $decimalPoint], ['', '.'], $check);

return static::_check($check, $regex);
}
Expand Down
2 changes: 1 addition & 1 deletion src/View/StringTemplate.php
Expand Up @@ -180,7 +180,7 @@ protected function _compileTemplates(array $templates = [])
}

$template = str_replace('%', '%%', $template);
preg_match_all('#\{\{([\w\d\._]+)\}\}#', $template, $matches);
preg_match_all('#\{\{([\w\._]+)\}\}#', $template, $matches);
$this->_compiled[$name] = [
str_replace($matches[0], '%s', $template),
$matches[1]
Expand Down

0 comments on commit c160b87

Please sign in to comment.