PHP: `extends` with a fully qualified name or an aliased import is resolved by short name — wrong or missing INHERITS edge
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 58/100
Hướng nghiên cứu
Start by locating the PHP inheritance edge resolver and its tests; the issue does not name their paths. Compare how it resolves imported names and fully qualified names against the eight-file reproduction in the issue. Done means all listed INHERITS edges point to the expected parent, including aliased imports and duplicate short names.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Version
codebase-memory-mcp 0.12.1
Platform
Linux (x64)
Install channel
GitHub release archive / install.sh
Binary variant
ui
What happened, and what did you expect?
For a PHP class, the INHERITS edge is resolved by the short name of the parent, not by the name the extends clause gives. Two things follow:
extends \Fully\Qualified\Namelinks to the wrong class when another class with the same short name exists in the child's own namespace. When that other class is the child itself, no edge is written.extends Alias, withuse Some\Class as Alias, writes no edge at all, also when the target is unique.
Expected: the edge goes to the class the fully qualified name or the alias names.
This pattern is common where one package overrides a controller of another package and keeps its class name (TYPO3 extensions, Symfony bundles). A query for all subclasses of a base class then misses the overriding classes, or follows a wrong edge.
Reproduction
- Code, a dummy project of eight files:
<?php // src/Base.php
namespace Acme\Shop;
class Base { public function run(): void {} }
<?php // src/Model/Imported.php
namespace Acme\Shop\Model;
use Acme\Shop\Base;
class Imported extends Base {}
<?php // src/Model/Qualified.php
namespace Acme\Shop\Model;
class Qualified extends \Acme\Shop\Base {}
<?php // src/Controller/NewController.php
namespace Acme\Shop\Controller;
class NewController extends \Acme\Shop\Base {}
<?php // portal/Controller/NewController.php
namespace Acme\Portal\Controller;
class NewController extends \Acme\Shop\Controller\NewController {}
<?php // portal/Controller/ListController.php
namespace Acme\Portal\Controller;
class ListController extends \Acme\Shop\Controller\NewController {}
<?php // portal/Controller/EditController.php
namespace Acme\Portal\Controller;
use Acme\Shop\Controller\NewController as ShopNewController;
class EditController extends ShopNewController {}
<?php // portal/Controller/AliasController.php
namespace Acme\Portal\Controller;
use Acme\Shop\Base as ShopBase;
class AliasController extends ShopBase {}
composer.json: {"name": "acme/shop", "autoload": {"psr-4": {"Acme\\Shop\\": "src/", "Acme\\Portal\\": "portal/"}}}
- MCP tool calls:
index_repository {"repo_path": "/tmp/repro-php", "mode": "full"}
query_graph {"project": "tmp-repro-php", "format": "json",
"query": "MATCH (a:Class)-[r:INHERITS]->(b) RETURN a.name, a.file_path, b.name, b.file_path"}
- Result against expectation:
| Child | extends |
Expected parent | Actual |
|---|---|---|---|
src/Model/Imported.php |
Base (imported) |
src/Base.php |
correct |
src/Model/Qualified.php |
\Acme\Shop\Base |
src/Base.php |
correct |
src/Controller/NewController.php |
\Acme\Shop\Base |
src/Base.php |
correct |
portal/Controller/ListController.php |
\Acme\Shop\Controller\NewController |
src/Controller/NewController.php |
edge to portal/Controller/NewController.php (wrong class) |
portal/Controller/NewController.php |
\Acme\Shop\Controller\NewController |
src/Controller/NewController.php |
no edge |
portal/Controller/EditController.php |
ShopNewController (alias) |
src/Controller/NewController.php |
no edge |
portal/Controller/AliasController.php |
ShopBase (alias) |
src/Base.php |
no edge |
The index reported no gaps: not_indexed_files_count 0, parse_partial_count 0.
My reading, not verified in the source: the resolver takes the last segment of the name and prefers the child's namespace, and it does not map use … as aliases for extends. #2923 describes a similar short-name fallback for Rust.
Project scale (if relevant)
32 nodes / 42 edges / 9 files
Confirmations
- I searched existing issues and this is not a duplicate.
- My reproduction uses shareable code (a dummy snippet or a public OSS repository), not proprietary code.
- Ngôn ngữ chính
- C
- Star
- 45.8k
- Fork
- 3.8k
- Merge trung bình
- 2 ngày 18 giờ
- Pull request đã merge (30 ngày)
- 108
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của DeusData/codebase-memory-mcp
-
bug ux/behavior
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
DeusData/codebase-memory-mcp#3191 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
documentation enhancement parsing/quality ux/behavior
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 82/100
DeusData/codebase-memory-mcp#3131 · 1 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
hook-augment: the five-row cap keeps the first five search_graph rows, so variables and modules displace function definitions (v0.12.1)Có thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởbug editor/integration parsing/quality ux/behavior
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
DeusData/codebase-memory-mcp#3062 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Generated client files (AGENTS.md block, SKILL.md) teach a call syntax no harness can executeĐang mởbug documentation editor/integration parsing/quality
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
DeusData/codebase-memory-mcp#3050 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
editor/integration parsing/quality
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
DeusData/codebase-memory-mcp#2286 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của DeusData/codebase-memory-mcp
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
NVIDIA/open-gpu-kernel-modules#1635 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
iOS: the "Edit controls" button never hides, even with a controller connected, and covers the gameĐang mởgame: 010065A014024000 ios
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
seedds/nxnative#3714 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày