Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
chadicus committed Jun 18, 2016
1 parent 6b6e3f7 commit d8ba2de
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
10 changes: 6 additions & 4 deletions Chadicus/Sniffs/Solid/DependencyInversionSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@ public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)

$tokens = $phpcsFile->getTokens();
$scopeStart = $tokens[$stackPtr]['scope_opener'];
$newUsage = $phpcsFile->findNext(T_NEW, ($scopeStart + 1), $tokens[$stackPtr]['scope_closer'], true);
if ($newUsage !== false) {
$error = 'Use of NEW within a constructor can be a sign of tight coupling. Consider injecting this dependency.';
$phpcsFile->addWarning($error, $newUsage, 'Discouraged');
$newUsage = $phpcsFile->findNext([T_NEW], ($scopeStart + 1), $tokens[$stackPtr]['scope_closer'], true);
if ($newUsage === false) {
return;
}

$error = 'Use of NEW within a constructor can be a sign of tight coupling. Consider injecting this dependency.';
$phpcsFile->addWarning($error, $newUsage, 'Discouraged');
}
}
17 changes: 11 additions & 6 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d8ba2de

Please sign in to comment.