Skip to content

Commit

Permalink
Merge pull request monque#1 from paulovitorbal/analysis-z3p1EG
Browse files Browse the repository at this point in the history
Apply fixes from StyleCI
  • Loading branch information
paulovitorbal authored Jul 17, 2017
2 parents 7845cf7 + 41dd935 commit 43266cc
Show file tree
Hide file tree
Showing 47 changed files with 350 additions and 336 deletions.
18 changes: 9 additions & 9 deletions src/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ protected function handleArgs()
'--skip' => false,
'--export-posbit' => false,
'--pack' => false,
'--level' => 'ALL'
'--level' => 'ALL',
];

// Fill args
Expand Down Expand Up @@ -369,8 +369,9 @@ protected function commandMain()
$iterator = new \RegexIterator($iterator, '/\.php$/');
try {
foreach ($iterator as $file) {
if (strpos($file, $this->args['--skip']) !== FALSE)
if (strpos($file, $this->args['--skip']) !== false) {
continue;
}
$filelist[] = $file;
}
} catch (Exception $e) {
Expand Down Expand Up @@ -406,7 +407,7 @@ protected function commandMain()
if ($this->args['--verbose']) {
Logging::warning('Parse error {file}, error message "{exception}"', [
'exception' => $e,
'file' => $file,
'file' => $file,
]);
}
continue;
Expand All @@ -418,9 +419,8 @@ protected function commandMain()
}
$chgvisitor->finish();


$cates = ['NOTICE','WARNING','NEW','DEPRECATED','FATAL'];

$cates = ['NOTICE', 'WARNING', 'NEW', 'DEPRECATED', 'FATAL'];

$filter = array_slice($cates, array_search(strtoupper($this->args['--level']), $cates));

// Display
Expand All @@ -437,11 +437,11 @@ protected function commandMain()
// Remove uncertain
unset($spotlist[$key]);
}
if (!in_array($spot['cate'], $filter))
if (!in_array($spot['cate'], $filter)) {
unset($spotlist[$key]);

}
}
if (count($spotlist) == 0){
if (count($spotlist) == 0) {
continue;
}

Expand Down
24 changes: 12 additions & 12 deletions src/Changes/AbstractChange.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,25 @@
abstract class AbstractChange
{
/**
* Version represents when this change do perform
* Version represents when this change do perform.
*/
protected static $version;

/**
* Visitor who hold this change instance
* Visitor who hold this change instance.
*/
protected $visitor;

/**
* Assign visitor
* Assign visitor.
*/
public function setVisitor($visitor)
{
$this->visitor = $visitor;
}

/**
* Quick method to add spot to visitor
* Quick method to add spot to visitor.
*/
public function addSpot($cate, $identified, $message, $line = null, $file = null)
{
Expand All @@ -38,57 +38,57 @@ public function addSpot($cate, $identified, $message, $line = null, $file = null
}

/**
* Initialization of properties
* Initialization of properties.
*/
public function __construct()
{
}

/**
* Called before any processing, after __construct()
* Called before any processing, after __construct().
*/
public function prepare()
{
}

/**
* Called after all file have been parsed
* Usually process data collected in traversing, and return
* Usually process data collected in traversing, and return.
*/
public function finish()
{
}

/**
* De-initialization of properties, after finish()
* De-initialization of properties, after finish().
*/
public function __destruct()
{
}

/**
* Called before Traverser woking
* Called before Traverser woking.
*/
public function beforeTraverse(array $nodes)
{
}

/**
* Called after Traverser woking done
* Called after Traverser woking done.
*/
public function afterTraverse(array $nodes)
{
}

/**
* Called when Traverser enter a node
* Called when Traverser enter a node.
*/
public function enterNode($node)
{
}

/**
* Called when Traverser leave a node
* Called when Traverser leave a node.
*/
public function leaveNode($node)
{
Expand Down
7 changes: 5 additions & 2 deletions src/Changes/AbstractIntroduced.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ protected function isNewMethod($node, &$mname = null)
}

$mname = $class->migExtends.'::'.$node->migName;

return $this->methodTable->has($mname);
}

Expand All @@ -132,6 +133,7 @@ protected function isNewConst($node)
}

$name = $node->args[0]->value->value;

return $this->constTable->has($name) &&
(is_null($this->condConst) || $name != $this->condConst);
}
Expand All @@ -143,7 +145,7 @@ protected function isNewParam($node)
}

/**
* Conditional checking
* Conditional checking.
*/
protected function isConditionalDeclare($node, $testfunc)
{
Expand All @@ -152,6 +154,7 @@ protected function isConditionalDeclare($node, $testfunc)
}

$expr = $node->cond->expr;

return $expr instanceof Expr\FuncCall && ParserHelper::isSameFunc($expr->migName, $testfunc);
}

Expand All @@ -170,7 +173,7 @@ protected function getConditionalName($node)
if ($node->cond->expr->args[0]->value instanceof Scalar\String_) {
return $node->cond->expr->args[0]->value->value;
} else {
return null;
return;
}
}
}
2 changes: 1 addition & 1 deletion src/Changes/ClassTree.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function leaveNode($node)
}

$this->classTable[$name] = [
'parent' => $parent_name,
'parent' => $parent_name,
'children' => [],
'topentry' => true,
];
Expand Down
9 changes: 5 additions & 4 deletions src/Changes/v5dot3/Deprecated.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function __construct()

/**
* For another Changes to set whether skip the check for Call-time
* Pass-by-ref
* Pass-by-ref.
*/
public function skipCallTimePassByRef($off)
{
Expand All @@ -63,7 +63,7 @@ public function leaveNode($node)
} else {
$errmsg = sprintf('Function %s() is deprecated', $node->name);
}
/**
/*
* {Errmsg}
* Deprecated: Function {function} is deprecated
*
Expand All @@ -74,7 +74,7 @@ public function leaveNode($node)

// Assign new instance
} elseif ($this->isAssignNewByRef($node)) {
/**
/*
* {Description}
* Assigning the return value of new by reference is now deprecated.
*
Expand All @@ -88,7 +88,7 @@ public function leaveNode($node)

// Call-time pass-by-reference
} elseif ($this->checkCallTimePassByRef && $this->isCallTimePassByRef($node)) {
/**
/*
* {Description}
* Call-time pass-by-reference is now deprecated
*
Expand Down Expand Up @@ -122,6 +122,7 @@ protected function isCallTimePassByRef($node)
return true;
}
}

return false;
}
}
Loading

0 comments on commit 43266cc

Please sign in to comment.