Skip to content

lint: Add linter that finds unused imports in php classes#10053

Merged
fichtner merged 1 commit into
masterfrom
php-use-linter
Apr 7, 2026
Merged

lint: Add linter that finds unused imports in php classes#10053
fichtner merged 1 commit into
masterfrom
php-use-linter

Conversation

@Monviech
Copy link
Copy Markdown
Member

Idea when thinking about this: #10052

Example output:

root@opn-dev-02:/src/git/core # make lint-import

src/www/firewall_rule_lookup.php: warning: stale import use OPNsense\Firewall\Filter
src/opnsense/mvc/tests/app/models/OPNsense/Base/FieldTypes/PortFieldTest.php: warning: stale import use OPNsense\Firewall\Util
src/opnsense/mvc/script/run_validations.php: warning: stale import use OPNsense\Core\Config
src/opnsense/mvc/app/library/OPNsense/Base/UIModelGrid.php: warning: stale import use OPNsense\Core\Type
src/opnsense/mvc/app/library/OPNsense/Auth/LDAPTOTP.php: warning: stale import use OPNsense\Core\Config
src/opnsense/mvc/app/library/OPNsense/Auth/Voucher.php: warning: stale import use OPNsense\Core\Config
...

@Monviech Monviech requested a review from fichtner March 27, 2026 15:28
@Monviech Monviech self-assigned this Mar 27, 2026
@Monviech Monviech added the feature Adding new functionality label Mar 27, 2026
@Monviech
Copy link
Copy Markdown
Member Author

Giving this an the linter PR to @fichtner for later to decide and adjust as needed.

@Monviech Monviech removed their assignment Mar 30, 2026
Copy link
Copy Markdown
Member

@fichtner fichtner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's a good idea... we should improve the pattern matching but otherwise this is great, thanks

@fichtner fichtner merged commit e6726ba into master Apr 7, 2026
@fichtner fichtner deleted the php-use-linter branch April 7, 2026 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature Adding new functionality

Development

Successfully merging this pull request may close these issues.

2 participants