Skip to content

Commit 9f4509d

Browse files
authored
[Php85] Handle crash on no arg on OrdSingleByteRector (#7682)
* [Php85] Handle crash on no arg on OrdSingleByteRector * fix
1 parent 0221a95 commit 9f4509d

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?php
2+
namespace Rector\Tests\Php85\Rector\FuncCall\OrdSingleByteRector\Fixture;
3+
4+
echo ord();
5+
echo "test";

rules/Php85/Rector/FuncCall/OrdSingleByteRector.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ public function refactor(Node $node): ?Node
6767
}
6868

6969
$args = $node->getArgs();
70+
if (! isset($args[0])) {
71+
return null;
72+
}
73+
7074
$firstArg = $args[0];
7175

7276
$argExpr = $firstArg->value;

0 commit comments

Comments
 (0)