These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | declare(strict_types=1); |
||
4 | |||
5 | namespace Cortex\Auth\Transformers\Adminarea; |
||
6 | |||
7 | use Cortex\Auth\Models\Ability; |
||
8 | use Rinvex\Support\Traits\Escaper; |
||
9 | use League\Fractal\TransformerAbstract; |
||
10 | |||
11 | class AbilityTransformer extends TransformerAbstract |
||
12 | { |
||
13 | use Escaper; |
||
14 | |||
15 | /** |
||
16 | * @return array |
||
17 | */ |
||
18 | public function transform(Ability $ability): array |
||
19 | { |
||
20 | return $this->escape([ |
||
21 | 'id' => (string) $ability->getRouteKey(), |
||
22 | 'title' => (string) $ability->title, |
||
0 ignored issues
–
show
|
|||
23 | 'name' => (string) $ability->name, |
||
0 ignored issues
–
show
The property
name does not exist on object<Cortex\Auth\Models\Ability> . 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...
|
|||
24 | 'created_at' => (string) $ability->created_at, |
||
0 ignored issues
–
show
The property
created_at does not exist on object<Cortex\Auth\Models\Ability> . 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...
|
|||
25 | 'updated_at' => (string) $ability->updated_at, |
||
0 ignored issues
–
show
The property
updated_at does not exist on object<Cortex\Auth\Models\Ability> . 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...
|
|||
26 | ]); |
||
27 | } |
||
28 | } |
||
29 |
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.