phpstan: Constant not found
I have fake error https://phpstan.org/r/05b59186b28d090c4d27f859dc106a21
Run
php vendor/bin/phpstan analyse -l max -c phpstan.neon src app
Output:
201/201 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
------ ----------------------------------
Line app/cron/cron.php
------ ----------------------------------
14 Constant CONSOLE_PATH not found.
23 Constant CONSOLE_PATH not found.
32 Constant CONSOLE_PATH not found.
41 Constant CONSOLE_PATH not found.
50 Constant CONSOLE_PATH not found.
60 Constant CONSOLE_PATH not found.
------ ----------------------------------
app/cron/cron.php
<?php
require_once __DIR__ . '/../../vendor/autoload.php';
const CONSOLE_PATH = __DIR__ . '/../../bin/console';
$cron = new Jobby\Jobby([
'output' => 'logs/output.log',
]);
/**
* Update popular list on main page
*/
$cron->add('UpdatePopularToday', [
'command' => CONSOLE_PATH . ' cron:update-popular-today --no-debug',
'schedule' => '0 */6 * * *',
'output' => 'logs/update-popular-today.log',
]);
// ...
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 21 (14 by maintainers)
Commits related to this issue
- Use existing constant from bootstrap to fix PHPStan error Via https://github.com/phpstan/phpstan/issues/768 — committed to sebastianbergmann/phpunit by deleted user 6 years ago
Unfortunately current Docker image has PHP 7.2 😦
It will be fixed with PHPStan 0.12,
phpstan/phpstan:nightlyhas a new base Dockerfile. Feel free to try it out, although the ecosystem (other extensions) aren’t ready yet. But you can build your own image using https://github.com/phpstan/docker-image/blob/master/Dockerfile and0.11.18asPHPSTAN_VERSIONarg.Right now you have to define your constants separately in some kind of a bootstrap file loaded by PHPStan. I’m adding this under Static reflection milestone because it might be possible to tackle this there.