Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

False positive `Dynamic call to static method` when mixing in another class and implementing `__call` and `__callStatic`

Open
#298 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
52/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
php
Domain
tooling

Research direction

Start with the linked PHPStan playground reproduction and trace the rule identified as staticMethod.dynamicCall, focusing on the interaction between mixed-in instance methods and __call/__callStatic. Done means the reported Bar::bar() false positive no longer occurs while genuine dynamic calls remain detected, with a regression test covering the example.

Written by the indexing model from the issue text.

Description

When you've a class Foo that:

  • provides implementations of both __call and __callStatic, and
  • mixes in another class Bar that has an instance method bar

creating an instance of Foo and calling that instance method results in an error of the form:

Dynamic call to static method Bar::bar(). [identifier=staticMethod.dynamicCall]

Playground: https://phpstan.org/r/bfd29cdb-749b-4b97-bd50-92ecb0fcfc92

Thanks!

Dominant language
PHP
Stars
711
Forks
62
Avg merge
3d 14h
Merged PRs (30d)
5

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

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.

More from phpstan/phpstan-strict-rules

All issues in phpstan/phpstan-strict-rules

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.