1 | <?php |
||
31 | class CacheClearCommand extends Command |
||
32 | { |
||
33 | /** @var Smarty */ |
||
34 | protected $smarty; |
||
35 | |||
36 | /** |
||
37 | * @param Smarty $smarty |
||
38 | */ |
||
39 | public function __construct(Smarty $smarty) |
||
44 | |||
45 | /** |
||
46 | * The console command name. |
||
47 | * |
||
48 | * @var string |
||
49 | */ |
||
50 | protected $name = 'ytake:smarty-clear-cache'; |
||
51 | |||
52 | /** |
||
53 | * The console command description. |
||
54 | * |
||
55 | * @var string |
||
56 | */ |
||
57 | protected $description = 'Flush the Smarty cache.'; |
||
58 | |||
59 | /** |
||
60 | * Execute the console command. |
||
61 | * |
||
62 | */ |
||
63 | public function handle() |
||
64 | { |
||
65 | // clear all cache |
||
66 | if (is_null($this->option('file'))) { |
||
67 | $this->smarty->clearAllCache($this->option('time')); |
||
68 | $this->info('Smarty cache cleared!'); |
||
69 | |||
70 | return 0; |
||
71 | } |
||
72 | // file specified |
||
73 | if (!$this->smarty->clearCache($this->option('file'), $this->option('cache_id'), null, $this->option('time'))) { |
||
|
|||
74 | $this->error('Specified file not found'); |
||
75 | |||
76 | return 1; |
||
77 | } |
||
78 | $this->info('Specified file was cache cleared!'); |
||
79 | |||
80 | return 0; |
||
81 | } |
||
82 | |||
83 | /** |
||
84 | * Get the console command options. |
||
85 | * |
||
86 | * @return array |
||
87 | */ |
||
88 | protected function getOptions() |
||
96 | } |
||
97 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: