From 47049f4988a167c5136c6b58936fc5494c513a17 Mon Sep 17 00:00:00 2001 From: Valentin Udaltsov Date: Mon, 5 Aug 2024 07:47:03 +0300 Subject: [PATCH] Reflect trait @use PHPDoc in classes without a class-level PHPDoc --- CHANGELOG.md | 12 ++++++++++++ Internal/PhpDoc/PhpDocReflector.php | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..e8f3999 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,12 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +### Fixed + +- Reflect trait @use PHPDoc in classes without a class-level PHPDoc. diff --git a/Internal/PhpDoc/PhpDocReflector.php b/Internal/PhpDoc/PhpDocReflector.php index bc9dce4..00815c6 100644 --- a/Internal/PhpDoc/PhpDocReflector.php +++ b/Internal/PhpDoc/PhpDocReflector.php @@ -124,6 +124,7 @@ public function processClass(NamedClassId|AnonymousClassId $id, TypedMap $data, $context = $data[Data::Context]; $data = $data + ->with(Data::UnresolvedTraits, $this->reflectUses($context, $data)) ->with(Data::Constants, array_map( fn(TypedMap $constant): TypedMap => $this->reflectNativeConstant($context, $constant), $data[Data::Constants], @@ -151,7 +152,6 @@ public function processClass(NamedClassId|AnonymousClassId $id, TypedMap $data, ->with(Data::Aliases, $this->reflectAliases($context, $phpDoc)) ->with(Data::UnresolvedParent, $this->reflectParent($context, $data, $phpDoc)) ->with(Data::UnresolvedInterfaces, $this->reflectInterfaces($context, $data, $phpDoc)) - ->with(Data::UnresolvedTraits, $this->reflectUses($context, $data)) ->with(Data::Properties, [ ...$data[Data::Properties], ...$this->reflectPhpDocProperties($context, $phpDoc->propertyTags()),