Skip to content

Commit

Permalink
Use ConstantChangeDetector for constants, reflected from the actual v…
Browse files Browse the repository at this point in the history
…alue
  • Loading branch information
vudaltsov committed Aug 6, 2024
1 parent a199205 commit 8c23044
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Internal/NativeReflector/NativeReflector.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace Typhoon\Reflection\Internal\NativeReflector;

use Typhoon\ChangeDetector\ChangeDetector;
use Typhoon\ChangeDetector\ConstantChangeDetector;
use Typhoon\ChangeDetector\PhpExtensionVersionChangeDetector;
use Typhoon\ChangeDetector\PhpVersionChangeDetector;
use Typhoon\DeclarationId\ConstantId;
Expand Down Expand Up @@ -44,10 +45,11 @@ public function reflectConstant(ConstantId $id): ?TypedMap
$extension = $this->constantExtensions()[$id->name] ?? null;

return (new TypedMap())
->with(Data::Type, new TypeData(inferred: types::value(\constant($id->name))))
->with(Data::Type, new TypeData(inferred: types::value($value)))
->with(Data::Namespace, get_namespace($id->name))
->with(Data::ValueExpression, Value::from($value))
->with(Data::PhpExtension, $extension)
->with(Data::ChangeDetector, new ConstantChangeDetector(name: $id->name, exists: true, value: $value))
->with(Data::InternallyDefined, $extension !== null);
}

Expand Down

0 comments on commit 8c23044

Please sign in to comment.