Skip to content

Commit

Permalink
Merge pull request #2 from zoonru/master
Browse files Browse the repository at this point in the history
Update to new psalm API
  • Loading branch information
orklah authored Jan 10, 2022
2 parents 770b9b5 + 4b1eb23 commit 6591645
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
5 changes: 5 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,10 @@
"require-dev": {
"vimeo/psalm": "^4.0",
"nikic/php-parser": "^4.0"
},
"config": {
"allow-plugins": {
"composer/package-versions-deprecated": true
}
}
}
23 changes: 11 additions & 12 deletions hooks/InsaneComparisonAnalyzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,29 @@
namespace Orklah\PsalmInsaneComparison\Hooks;

use PhpParser\Node\Expr;
use Psalm\Codebase;
use Psalm\CodeLocation;
use Psalm\Context;
use Psalm\Internal\Type\Comparator\UnionTypeComparator;
use Psalm\Issue\PluginIssue;
use Psalm\IssueBuffer;
use Psalm\Plugin\Hook\AfterExpressionAnalysisInterface;
use Psalm\StatementsSource;
use Psalm\Plugin\EventHandler\AfterExpressionAnalysisInterface;
use Psalm\Plugin\EventHandler\Event\AfterExpressionAnalysisEvent;
use Psalm\Type;
use Psalm\Type\Atomic\TLiteralInt;
use Psalm\Type\Atomic\TLiteralString;
use Psalm\Type\Atomic\TPositiveInt;
use Psalm\Type\Atomic\TSingleLetter;

class InsaneComparisonAnalyzer implements AfterExpressionAnalysisInterface
{
public static function afterExpressionAnalysis(
Expr $expr,
Context $context,
StatementsSource $statements_source,
Codebase $codebase,
array &$file_replacements = []
): ?bool
/**
* Called after an expression has been checked
*
* @return null|false
*/
public static function afterExpressionAnalysis(AfterExpressionAnalysisEvent $event): ?bool
{
$expr = $event->getExpr();
$statements_source = $event->getStatementsSource();
$codebase = $event->getCodebase();
if (!$expr instanceof Expr\BinaryOp\Equal && !$expr instanceof Expr\BinaryOp\NotEqual) {
return true;
}
Expand Down

0 comments on commit 6591645

Please sign in to comment.