Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix extra type of boundvariable object #96

Merged
merged 1 commit into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/PHPCfg/Operand/BoundVariable.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ class BoundVariable extends Variable

public $scope;

public ?Operand $extra;
public ?Literal $extra;

public function __construct($name, bool $byRef, int $scope = self::SCOPE_GLOBAL, ?Operand $extra = null)
public function __construct($name, bool $byRef, int $scope = self::SCOPE_GLOBAL, ?Literal $extra = null)
{
parent::__construct($name);
$this->byRef = $byRef;
Expand Down
27 changes: 27 additions & 0 deletions test/code/class_this.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

class NameOfClass {
function doSomething() {
echo $this->hello();
}
}
-----
Block#1
Stmt_Class
name: LITERAL('NameOfClass')
stmts: Block#2
Terminal_Return

Block#2
Stmt_ClassMethod<'doSomething'>
flags: public

Function 'NameOfClass::doSomething': mixed
Block#1
Expr_MethodCall
var: this<$this>
name: LITERAL('hello')
result: Var#1
Terminal_Echo
expr: Var#1
Terminal_Return
Loading