Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
ArgumentNullException
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
1 / 1
 throwIfNull
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
2
1<?php
2
3declare(strict_types=1);
4
5namespace PeServer\Core\Throws;
6
7use Throwable;
8use PeServer\Core\Throws\ArgumentException;
9
10class ArgumentNullException extends ArgumentException
11{
12    use ThrowableTrait;
13
14    #region function
15
16    /**
17     * `null` の場合に `self` を投げる。
18     * @param mixed $argument 評価対象。
19     * @param string $name
20     * @throws ArgumentNullException
21     * @phpstan-assert !null $argument
22     */
23    public static function throwIfNull(mixed $argument, string $name = ''): void
24    {
25        if ($argument === null) {
26            throw new ArgumentNullException($name);
27        }
28    }
29
30    #endregion
31}