Skip to content

Commit

Permalink
Bump box lockfile, work around php-scoper class alias issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
bobthecow committed Jun 9, 2024
1 parent aee429c commit a6d8ef4
Show file tree
Hide file tree
Showing 2 changed files with 231 additions and 240 deletions.
6 changes: 5 additions & 1 deletion src/CodeCleaner/StrictTypesPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
namespace Psy\CodeCleaner;

use PhpParser\Node;
use PhpParser\Node\DeclareItem;
use PhpParser\Node\Scalar\LNumber;
use PhpParser\Node\Stmt\Declare_;
use PhpParser\Node\Stmt\DeclareDeclare;
Expand Down Expand Up @@ -78,7 +79,10 @@ public function beforeTraverse(array $nodes)
if (!$first instanceof Declare_) {
// @todo Switch to PhpParser\Node\DeclareItem once we drop support for PHP-Parser 4.x
// @todo Rename LNumber to Int_ once we drop support for PHP-Parser 4.x
$declare = new Declare_([new DeclareDeclare('strict_types', new LNumber(1))]);
$declareItem = \class_exists('PhpParser\Node\DeclareItem') ?
new DeclareItem('strict_types', new LNumber(1)) :
new DeclareDeclare('strict_types', new LNumber(1));
$declare = new Declare_([$declareItem]);
\array_unshift($nodes, $declare);
}
}
Expand Down
Loading

0 comments on commit a6d8ef4

Please sign in to comment.