phan / phan/phan

Check for inheritance issues when analyzing php 8.2 readonly classes

Open
#4,696 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement php8.2
Dominant language
PHP
Stars
5.6k
Forks
365
Avg merge
1h 25m
Merged PRs (30d)
6

Description

Phan should warn about invalid inheritance for https://wiki.php.net/rfc/readonly_classes

Related to #4684

php > readonly class B {}
php > class C extends B{}
Fatal error: Non-readonly class C cannot extend readonly class B in php shell code on line 1
php > readonly class D extends stdClass{}
Fatal error: Readonly class D cannot extend non-readonly class stdClass in php shell code on line 1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no source file, test, or entry point. Reproduce the two PHP 8.2 inheritance examples, then trace Phan's class-inheritance analysis to determine where readonly compatibility is checked; done when both invalid combinations produce appropriate warnings without false positives.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
devtools
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.