for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Bmitch\Envsync\Finders;
class EnvironmentFinder
{
/**
* Gets the environment variables defined within $file.
* @param string $file Path and filename.
* @return array
*/
public function getFromFile($file)
if (preg_match("/.*.php/", $file)) {
return PhpFileFinder::find($file);
} else {
return EnvFileFinder::find($file);
}
return [];
return array();
This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.
Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.
return
die
exit
function fx() { try { doSomething(); return true; } catch (\Exception $e) { return false; } return false; }
In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.
return false
* Gets the environment variables defined within the $files.
* @param array $files Array of paths and filenames.
public function getFromFiles(array $files)
$envs = [];
foreach ($files as $file) {
$envs = array_merge($envs, $this->getFromFile($file));
return $envs;
This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.
Unreachable code is most often the result of
return
,die
orexit
statements that have been added for debug purposes.In the above example, the last
return false
will never be executed, because a return statement has already been met in every possible execution path.