phan / phan/phan

Differences in output between phan and phan_client

Open
#4,584 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

language server question
Dominant language
PHP
Stars
5.6k
Forks
365
Avg merge
1h 25m
Merged PRs (30d)
6

Description

Using phan 5.2.1, i've noticed that running php vendor/bin/phan will surface issues that don't appear when using phan as a daemon with the phan_client.

=> php vendor/bin/phan --version                                            
Phan 5.2.1
php-ast version 1.0.15-dev
PHP version used to run Phan: 7.4.3

Running phan directly is producing the following error:

=> php vendor/bin/phan                                                 
tests/Unit/Factory/RetentionFactoryTest.php:118 PhanTypeMismatchArgument Argument 1 ($config) is [] of type array{} but \Hallnet\LaravelRetention\Factory\RetentionFactory::add() takes array{table:string,days?:int,connection?:string,column?:string} defined at src/Factory/RetentionFactory.php:62

whereas if i run phan as a daemon using the following command:

=> php vendor/bin/phan --daemonize-tcp-port default                                
Awaiting analysis requests for directory '/home/code/packages/laravel-retention

and then run phan_client in a separate terminal i get no errors:

=> php vendor/bin/phan_client -l tests/Unit/Factory/RetentionFactoryTest.php

In the phan_client, i've added a var_dump($response_lines); on line 239 to inspect the response and this is what i see:

array(1) {
  [0] =>
  string(44) "{"status":"ok","issue_count":0,"issues":[]}
"
}

indicating that the issue seems to be with phan and not the phan_client.

Am i approaching this incorrectly? or Is this a limitation of daemonized phan?

Thanks for your time and input.

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

Start by reproducing the mismatch with php vendor/bin/phan, --daemonize-tcp-port default, and phan_client -l tests/Unit/Factory/RetentionFactoryTest.php. Compare the daemon response with the direct analysis around tests/Unit/Factory/RetentionFactoryTest.php:118 and src/Factory/RetentionFactory.php:62. Done means daemonized analysis reports the same issue, or the limitation is documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.