Custom method on extended classes are flagged as undefined.
How is drupal-check installed?
- [ ] drupal-check is installed using the phar
- [ ] drupal-check is installed globally via Composer
- [ ] drupal-check is installed globally using consolidation/cgr
- [X] drupal-check is installed as a dependency to my project
Environment:
- OS: Linux
- PHP Version: 7.3
- Drupal core: 8.8.x
Describe the bug Drupal-check flags every call to a custom method as undefined.
Console output
Paste the output of the console when running the command with -vvv
https://travis-ci.org/github/Beakerboy/sqlsrv/builds/671039483
Some of the “method not found” errors originate from prophecy objects. I installed jangregor/phpstan-prophecy and phpstan/extension-installer, but then get the error:
- /home/travis/build/Beakerboy/drupal-project/vendor/phpstan/phpstan-deprecation-rules/rules.neon
- /home/travis/build/Beakerboy/drupal-project/vendor/mglaman/phpstan-drupal/extension.neon
It can lead to unexpected results. If you're using phpstan/extension-installer, make sure you have removed corresponding neon files from your project config file.
I have no neon file, and I do not see one in your project repository either.
It looks like many of the errors are due to limitations in the way the core doc blocks are used. The function Connection::schema() will always return a child of \Drupal\Core\Database\Schema, not this particular “abstract for all intents and purposes” class.
If I break the following statement
$result = $this->connection->schema()->customFunction();
Into
/** @var \Drupal\Driver\Database\module\Schema $schema */
$schema = $this->connection->schema();
$result = $schema->customFunction();
Then the error goes away. If you think this is the expected behavior, feel free to close it. Prophecy is still an issue though.