apache / apache/netbeans

[PHP] Implicit implements Stringable declaration should produce warning

Open
#6,034 0 comments 0 reactions 0 assignees View on GitHub
kind:feature needs:triage PHP
Dominant language
Java
Stars
3.1k
Forks
935
Avg merge
2d 3h
Merged PRs (30d)
17

Description

### Apache NetBeans version

Apache NetBeans 18

### What happened

Stringable is implicitly present on any class that has the magic ```__toString()``` method defined. It is considered a bad habit not to explicitly state a class as Stringable while it has ```__toString()```.

### How to reproduce

```php

Contributor guide

Open the contributing guide

Research direction

Reproduce the example in Apache NetBeans 18 with a class defining __toString() without explicitly implementing Stringable, and compare it with the explicitly implemented class. Trace the PHP diagnostics for this case and verify that the implicit declaration produces a warning while the explicit implementation remains accepted.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
tooling
Issue type
Bug
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.