summaryrefslogtreecommitdiffstatshomepage
path: root/core/tests/Drupal/TestTools/PhpUnitCompatibility/RunnerVersion.php
blob: 46c9fb1be88c61a4488141924c06060ed5724907 (plain) (blame)
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
30
31
32
<?php

declare(strict_types=1);

namespace Drupal\TestTools\PhpUnitCompatibility;

use PHPUnit\Runner\Version;

/**
 * Helper class to determine information about running PHPUnit version.
 *
 * This class contains static methods only and is not meant to be instantiated.
 */
final class RunnerVersion {

  /**
   * This class should not be instantiated.
   */
  private function __construct() {
  }

  /**
   * Returns the major version of the PHPUnit runner being used.
   *
   * @return int
   *   The major version of the PHPUnit runner being used.
   */
  public static function getMajor() {
    return (int) explode('.', Version::id())[0];
  }

}