PHPStan can't find the classes I installed with pear.
Why? How can I fix it?
Steps
- Run:
pear install HTTP_Request2-2.5.1
- Check:
pear config-get php_dir
/usr/share/pear
- Check:
php -i | grep include_path
include_path => .:/usr/share/pear:/usr/share/php => .:/usr/share/pear:/usr/share/php
- Check:
ls -l /usr/share/pear/HTTP/Request2.php
-rw-r--r--. 1 root root 36102 Aug 19 11:38 /usr/share/pear/HTTP/Request2.php
- Write
test.php
<?php
require_once 'HTTP/Request2.php';
$request = new \HTTP_Request2("http://example.com");
- Run
phpstan analyze test.php
------ ---------------------------------------------------------------------
Line test.php
------ ---------------------------------------------------------------------
5 Instantiated class HTTP_Request2 not found.
Learn more at https://phpstan.org/user-guide/discovering-symbols
------ ---------------------------------------------------------------------