File: bootstrap_phpstan.php

package info (click to toggle)
php-composer-xdebug-handler 3.0.5-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 460 kB
  • sloc: php: 2,501; makefile: 18
file content (29 lines) | stat: -rw-r--r-- 797 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php
/**
 * Provides flexibilty for using either simple-phpunit or phpunit
 */

$vendorBin = __DIR__.'/../vendor/bin';

// See if we using simple-phpunit
$path = realpath($vendorBin.'/simple-phpunit');

if ($path !== false) {
    // simple-phpunit will update the .phpunit symlink/junction
    $phpunit = escapeshellarg(PHP_BINARY).' '.escapeshellarg($path);
    passthru($phpunit.' install');

    $autoloader = $vendorBin.'/.phpunit/phpunit/vendor/autoload.php';
    if (!file_exists($autoloader)) {
        echo 'Cannot run PHPStan: simple-phpunit did not install PHPUnit as expected'.PHP_EOL;
        exit(1);
    }

    include $autoloader;
    return;
}

if (realpath($vendorBin.'/phpunit') === false) {
    echo 'Cannot run PHPStan: PHPUnit has not been installed'.PHP_EOL;
    exit(1);
}