for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace LunixREST\Request\BodyParser;
class BasicBodyParserFactory implements BodyParserFactory {
/**
* Parses API request data out of a url
* @param string $contentType
* @return BodyParser
*/
public function create(string $contentType): BodyParser {
switch($contentType) {
case 'application/x-www-form-urlencoded':
default:
return new URLEncodedBodyParser();
case 'application/json':
case 'application/json':...arser\JSONBodyParser();
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
return new JSONBodyParser();
}
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.