for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Psr7Middlewares\Utils;
/**
* Common functions to work with paths.
*/
class Path
{
* helper function to fix paths '//' or '/./' or '/foo/../' in a path.
*
* @param string $path Path to resolve
* @return string
public static function fix($path)
$path = str_replace('\\', '/', $path); //windows paths
$replace = ['#(/\.?/)#', '#/(?!\.\.)[^/]+/\.\./#'];
do {
$path = preg_replace($replace, '/', $path, -1, $n);
} while ($n > 0);
return $path;
}
* Join several pieces into a path.
* @param string $piece1
$piece1
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter $italy is not defined by the method finale(...).
$italy
finale(...)
/** * @param array $germany * @param array $island * @param array $italy */ function finale($germany, $island) { return "2:1"; }
The most likely cause is that the parameter was removed, but the annotation was not.
* @param string $piece2
$piece2
* ...
public static function join()
return self::fix(implode('/', func_get_args()));
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.