for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Nayjest\Grids;
use Exception;
use RuntimeException;
class ObjectDataRow extends DataRow
{
/**
* @param string $fieldName
*
* @throws Exception
* @return mixed
*/
protected function extractCellValue($fieldName)
if (strpos($fieldName, '.') !== false) {
$parts = explode('.', $fieldName);
$parts = array_reverse($parts);
$res = $this->src;
try {
foreach ($parts as $part) {
$res = is_object($res) ? $res->{$part} : $res[$part];
if ($res !== null) {
return $res;
}
} catch (Exception $e) {
throw new RuntimeException(
"Can't read '$fieldName' as '$part' property from DataRow",
0,
$e
);
"Can't read '$fieldName' property from DataRow",
0
} else {
return $this->src->{$fieldName};
catch (\Exception $e) { ...rom DataRow", 0, $e); }
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
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.