I am trying to instantiate a class by reflection like this:
$class = new ReflectionClass('App\\Widgets\\TestWidget');
But that always throws a ReflectionException with this message:
[2017-02-20 19:05:25] local.ERROR: ReflectionException while trying to reflect C:\Users\Asier\PhpstormProjects\web-cms\app\Widgets\TestWidget\TestWidget.php
Class App\Widgets\TestWidget implements Widget {
/**
* It is called when the widget is used in a template to render it.
* @return string
*/
public function render() {
return "Hello world from TestWidget";
}
/**
* Returns the widget's name
* @return string
*/
public static function getWidgetName() {
return "TestWidget";
}
/**
* Returns the widget's info
* @return string|array
*/
public static function getWidgetInfo() {
return "";
}
/**
* It is called when the widget is uploaded to make the proper setup for it if needed
* @return void
*/
public static function setup() {
}
// POR ALGUN MOTIVO EL ULTIMO METODO SIEMPRE ME DICE QUE NO EXISTE
public function dummy() does not exist
And this is the class:
<?php
namespace App\Widgets;
class TestWidget implements Widget {
/**
* It is called when the widget is used in a template to render it.
* @return string
*/
public function render() {
return "Hello world from TestWidget";
}
/**
* Returns the widget's name
* @return string
*/
public static function getWidgetName() {
return "TestWidget";
}
/**
* Returns the widget's info
* @return string|array
*/
public static function getWidgetInfo() {
return "";
}
/**
* It is called when the widget is uploaded to make the proper setup for it if needed
* @return void
*/
public static function setup() {
}
public function dummy() {}
}
If I delete the last method (dummy), then it says the same "does not exists" with the last method in the class.
Any ideas?
Aucun commentaire:
Enregistrer un commentaire