These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Spatie\ServerMonitor\Exceptions; |
||
4 | |||
5 | use Exception; |
||
6 | use Spatie\ServerMonitor\Models\Check; |
||
7 | |||
8 | class InvalidCheckDefinition extends Exception |
||
9 | { |
||
10 | public static function unknownCheckType(Check $check) |
||
11 | { |
||
12 | $validValues = implode(', ', array_keys(config('server-monitor.checks'))); |
||
13 | |||
14 | return new static("The check with id `{$check->id}` has an unknown type `{$check->type}`. Valid values are {$validValues}"); |
||
0 ignored issues
–
show
The property
type does not exist on object<Spatie\ServerMonitor\Models\Check> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property.
Loading history...
|
|||
15 | } |
||
16 | |||
17 | public static function definitionClassDoesNotExist(Check $check, string $definitionClass) |
||
18 | { |
||
19 | return new static("The definition class {$definitionClass} specified in the configfile as `{$check->type}` does not exist"); |
||
0 ignored issues
–
show
The property
type does not exist on object<Spatie\ServerMonitor\Models\Check> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property.
Loading history...
|
|||
20 | } |
||
21 | } |
||
22 |
Since your code implements the magic getter
_get
, this function will be called for any read access on an undefined variable. You can add the@property
annotation to your class or interface to document the existence of this variable.If the property has read access only, you can use the @property-read annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.