These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | /** |
||
4 | * Virtual Linked Element. |
||
5 | * |
||
6 | * As elemental is based on widgets which have a natural has_one relation to an |
||
7 | * object, this is a workaround for allowing the same element to be linked to |
||
8 | * multiple pages. |
||
9 | * |
||
10 | * {@see ElementalGridFieldAddExistingAutocompleter} |
||
11 | * |
||
12 | * @package elemental |
||
13 | */ |
||
14 | class ElementVirtualLinked extends BaseElement { |
||
0 ignored issues
–
show
|
|||
15 | |||
16 | private static $has_one = array( |
||
0 ignored issues
–
show
|
|||
17 | 'LinkedElement' => 'BaseElement' |
||
18 | ); |
||
19 | |||
20 | public function getTitle() |
||
0 ignored issues
–
show
The return type could not be reliably inferred; please add a
@return annotation.
Our type inference engine in quite powerful, but sometimes the code does not
provide enough clues to go by. In these cases we request you to add a
Loading history...
|
|||
21 | { |
||
22 | return $this->LinkedElement()->getTitle(); |
||
0 ignored issues
–
show
The method
LinkedElement does not exist on object<ElementVirtualLinked> ? Since you implemented __call , maybe consider adding a @method annotation.
If you implement This is often the case, when class ParentClass {
private $data = array();
public function __call($method, array $args) {
if (0 === strpos($method, 'get')) {
return $this->data[strtolower(substr($method, 3))];
}
throw new \LogicException(sprintf('Unsupported method: %s', $method));
}
}
/**
* If this class knows which fields exist, you can specify the methods here:
*
* @method string getName()
*/
class SomeClass extends ParentClass { }
Loading history...
|
|||
23 | } |
||
24 | |||
25 | public function i18n_singular_name() |
||
26 | { |
||
27 | return _t(__CLASS__, $this->LinkedElement()->config()->title); |
||
0 ignored issues
–
show
The method
LinkedElement does not exist on object<ElementVirtualLinked> ? Since you implemented __call , maybe consider adding a @method annotation.
If you implement This is often the case, when class ParentClass {
private $data = array();
public function __call($method, array $args) {
if (0 === strpos($method, 'get')) {
return $this->data[strtolower(substr($method, 3))];
}
throw new \LogicException(sprintf('Unsupported method: %s', $method));
}
}
/**
* If this class knows which fields exist, you can specify the methods here:
*
* @method string getName()
*/
class SomeClass extends ParentClass { }
Loading history...
|
|||
28 | } |
||
29 | |||
30 | public function getCMSFields() { |
||
0 ignored issues
–
show
The return type could not be reliably inferred; please add a
@return annotation.
Our type inference engine in quite powerful, but sometimes the code does not
provide enough clues to go by. In these cases we request you to add a
Loading history...
|
|||
31 | $message = sprintf('<p>%s</p><p><a href="%2$s">%2$s</a></p>', |
||
32 | _t('ElementVirtualLinked.DESCRIBE', 'This is a virtual copy of a block. To edit, visit'), |
||
33 | $this->LinkedElement()->getEditLink() |
||
0 ignored issues
–
show
The method
LinkedElement does not exist on object<ElementVirtualLinked> ? Since you implemented __call , maybe consider adding a @method annotation.
If you implement This is often the case, when class ParentClass {
private $data = array();
public function __call($method, array $args) {
if (0 === strpos($method, 'get')) {
return $this->data[strtolower(substr($method, 3))];
}
throw new \LogicException(sprintf('Unsupported method: %s', $method));
}
}
/**
* If this class knows which fields exist, you can specify the methods here:
*
* @method string getName()
*/
class SomeClass extends ParentClass { }
Loading history...
|
|||
34 | ); |
||
35 | |||
36 | $fields = new FieldList( |
||
37 | new LiteralField('Existing', $message) |
||
38 | ); |
||
39 | |||
40 | $this->extend('updateCMSFields', $fields); |
||
41 | |||
42 | return $fields; |
||
43 | } |
||
44 | } |
||
45 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.