Skip to content

Commit 9ca27b3

Browse files
authored
Deprecate form methods (#144)
1 parent 24030ec commit 9ca27b3

File tree

3 files changed

+78
-2
lines changed

3 files changed

+78
-2
lines changed

src/Form/Type/CKEditorType.php

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,20 +143,35 @@ public function __construct(
143143
*/
144144
public function isEnable($enable = null)
145145
{
146+
$this->triggerMethodDeprecation('isEnable');
147+
146148
if (null !== $enable) {
147149
$this->enable = (bool) $enable;
148150
}
149151

150152
return $this->enable;
151153
}
152154

155+
private function triggerMethodDeprecation($name)
156+
{
157+
@trigger_error(
158+
sprintf(
159+
'Method "%s" is deprecated since 1.x and will be removed with the 2.0 release. ',
160+
$name
161+
),
162+
E_USER_DEPRECATED
163+
);
164+
}
165+
153166
/**
154167
* @param bool|null $async
155168
*
156169
* @return bool
157170
*/
158171
public function isAsync($async = null)
159172
{
173+
$this->triggerMethodDeprecation('isAsync');
174+
160175
if (null !== $async) {
161176
$this->async = (bool) $async;
162177
}
@@ -171,6 +186,8 @@ public function isAsync($async = null)
171186
*/
172187
public function isAutoload($autoload = null)
173188
{
189+
$this->triggerMethodDeprecation('isAutoload');
190+
174191
if (null !== $autoload) {
175192
$this->autoload = (bool) $autoload;
176193
}
@@ -185,6 +202,8 @@ public function isAutoload($autoload = null)
185202
*/
186203
public function isAutoInline($autoInline = null)
187204
{
205+
$this->triggerMethodDeprecation('isAutoInline');
206+
188207
if (null !== $autoInline) {
189208
$this->autoInline = (bool) $autoInline;
190209
}
@@ -199,6 +218,8 @@ public function isAutoInline($autoInline = null)
199218
*/
200219
public function isInline($inline = null)
201220
{
221+
$this->triggerMethodDeprecation('isInline');
222+
202223
if (null !== $inline) {
203224
$this->inline = (bool) $inline;
204225
}
@@ -213,6 +234,8 @@ public function isInline($inline = null)
213234
*/
214235
public function useJquery($jquery = null)
215236
{
237+
$this->triggerMethodDeprecation('useJquery');
238+
216239
if (null !== $jquery) {
217240
$this->jquery = (bool) $jquery;
218241
}
@@ -227,6 +250,8 @@ public function useJquery($jquery = null)
227250
*/
228251
public function useRequireJs($requireJs = null)
229252
{
253+
$this->triggerMethodDeprecation('useRequireJs');
254+
230255
if (null !== $requireJs) {
231256
$this->requireJs = (bool) $requireJs;
232257
}
@@ -241,6 +266,8 @@ public function useRequireJs($requireJs = null)
241266
*/
242267
public function isInputSync($inputSync = null)
243268
{
269+
$this->triggerMethodDeprecation('isInputSync');
270+
244271
if (null !== $inputSync) {
245272
$this->inputSync = (bool) $inputSync;
246273
}
@@ -253,6 +280,8 @@ public function isInputSync($inputSync = null)
253280
*/
254281
public function hasFilebrowsers()
255282
{
283+
$this->triggerMethodDeprecation('hasFilebrowsers');
284+
256285
return !empty($this->filebrowsers);
257286
}
258287

@@ -261,6 +290,8 @@ public function hasFilebrowsers()
261290
*/
262291
public function getFilebrowsers()
263292
{
293+
$this->triggerMethodDeprecation('getFilebrowsers');
294+
264295
return $this->filebrowsers;
265296
}
266297

@@ -269,6 +300,8 @@ public function getFilebrowsers()
269300
*/
270301
public function setFilebrowsers(array $filebrowsers)
271302
{
303+
$this->triggerMethodDeprecation('setFilebrowsers');
304+
272305
foreach ($filebrowsers as $filebrowser) {
273306
$this->addFilebrowser($filebrowser);
274307
}
@@ -281,6 +314,8 @@ public function setFilebrowsers(array $filebrowsers)
281314
*/
282315
public function hasFilebrowser($filebrowser)
283316
{
317+
$this->triggerMethodDeprecation('hasFilebrowser');
318+
284319
return in_array($filebrowser, $this->filebrowsers, true);
285320
}
286321

@@ -289,6 +324,8 @@ public function hasFilebrowser($filebrowser)
289324
*/
290325
public function addFilebrowser($filebrowser)
291326
{
327+
$this->triggerMethodDeprecation('addFilebrowser');
328+
292329
if (!$this->hasFilebrowser($filebrowser)) {
293330
$this->filebrowsers[] = $filebrowser;
294331
}
@@ -299,6 +336,8 @@ public function addFilebrowser($filebrowser)
299336
*/
300337
public function removeFilebrowser($filebrowser)
301338
{
339+
$this->triggerMethodDeprecation('removeFilebrowser');
340+
302341
unset($this->filebrowsers[array_search($filebrowser, $this->filebrowsers, true)]);
303342
}
304343

@@ -307,6 +346,8 @@ public function removeFilebrowser($filebrowser)
307346
*/
308347
public function getBasePath()
309348
{
349+
$this->triggerMethodDeprecation('getBasePath');
350+
310351
return $this->basePath;
311352
}
312353

@@ -315,6 +356,8 @@ public function getBasePath()
315356
*/
316357
public function setBasePath($basePath)
317358
{
359+
$this->triggerMethodDeprecation('setBasePath');
360+
318361
$this->basePath = $basePath;
319362
}
320363

@@ -323,6 +366,8 @@ public function setBasePath($basePath)
323366
*/
324367
public function getJsPath()
325368
{
369+
$this->triggerMethodDeprecation('getJsPath');
370+
326371
return $this->jsPath;
327372
}
328373

@@ -331,6 +376,8 @@ public function getJsPath()
331376
*/
332377
public function setJsPath($jsPath)
333378
{
379+
$this->triggerMethodDeprecation('setJsPath');
380+
334381
$this->jsPath = $jsPath;
335382
}
336383

@@ -339,6 +386,8 @@ public function setJsPath($jsPath)
339386
*/
340387
public function getJqueryPath()
341388
{
389+
$this->triggerMethodDeprecation('getJqueryPath');
390+
342391
return $this->jqueryPath;
343392
}
344393

@@ -347,6 +396,8 @@ public function getJqueryPath()
347396
*/
348397
public function setJqueryPath($jqueryPath)
349398
{
399+
$this->triggerMethodDeprecation('setJqueryPath');
400+
350401
$this->jqueryPath = $jqueryPath;
351402
}
352403

@@ -355,6 +406,8 @@ public function setJqueryPath($jqueryPath)
355406
*/
356407
public function getConfigManager()
357408
{
409+
$this->triggerMethodDeprecation('getConfigManager');
410+
358411
return $this->configManager;
359412
}
360413

@@ -363,6 +416,8 @@ public function getConfigManager()
363416
*/
364417
public function setConfigManager(ConfigManagerInterface $configManager)
365418
{
419+
$this->triggerMethodDeprecation('setConfigManager');
420+
366421
$this->configManager = $configManager;
367422
}
368423

@@ -371,6 +426,8 @@ public function setConfigManager(ConfigManagerInterface $configManager)
371426
*/
372427
public function getPluginManager()
373428
{
429+
$this->triggerMethodDeprecation('getPluginManager');
430+
374431
return $this->pluginManager;
375432
}
376433

@@ -379,6 +436,8 @@ public function getPluginManager()
379436
*/
380437
public function setPluginManager(PluginManagerInterface $pluginManager)
381438
{
439+
$this->triggerMethodDeprecation('setPluginManager');
440+
382441
$this->pluginManager = $pluginManager;
383442
}
384443

@@ -387,6 +446,8 @@ public function setPluginManager(PluginManagerInterface $pluginManager)
387446
*/
388447
public function getStylesSetManager()
389448
{
449+
$this->triggerMethodDeprecation('getStylesSetManager');
450+
390451
return $this->stylesSetManager;
391452
}
392453

@@ -395,6 +456,8 @@ public function getStylesSetManager()
395456
*/
396457
public function setStylesSetManager(StylesSetManagerInterface $stylesSetManager)
397458
{
459+
$this->triggerMethodDeprecation('setStylesSetManager');
460+
398461
$this->stylesSetManager = $stylesSetManager;
399462
}
400463

@@ -403,6 +466,8 @@ public function setStylesSetManager(StylesSetManagerInterface $stylesSetManager)
403466
*/
404467
public function getTemplateManager()
405468
{
469+
$this->triggerMethodDeprecation('getTemplateManager');
470+
406471
return $this->templateManager;
407472
}
408473

@@ -411,6 +476,8 @@ public function getTemplateManager()
411476
*/
412477
public function setTemplateManager(TemplateManagerInterface $templateManager)
413478
{
479+
$this->triggerMethodDeprecation('setTemplateManager');
480+
414481
$this->templateManager = $templateManager;
415482
}
416483

@@ -419,6 +486,8 @@ public function setTemplateManager(TemplateManagerInterface $templateManager)
419486
*/
420487
public function getToolbarManager()
421488
{
489+
$this->triggerMethodDeprecation('getToolbarManager');
490+
422491
return $this->toolbarManager;
423492
}
424493

@@ -427,6 +496,8 @@ public function getToolbarManager()
427496
*/
428497
public function setToolbarManager(ToolbarManagerInterface $toolbarManager)
429498
{
499+
$this->triggerMethodDeprecation('setToolbarManager');
500+
430501
$this->toolbarManager = $toolbarManager;
431502
}
432503

tests/DependencyInjection/AbstractFOSCKEditorExtensionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ abstract class AbstractFOSCKEditorExtensionTest extends AbstractTestCase
6565
private $templating;
6666

6767
/**
68-
* {@inheritdoc}
68+
* @group legacy
6969
*/
7070
protected function setUp()
7171
{

tests/Form/Type/CKEditorTypeTest.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
use Symfony\Component\Form\Forms;
2525

2626
/**
27+
* @group legacy
28+
*
2729
* @author GeLo <[email protected]>
2830
*/
2931
class CKEditorTypeTest extends AbstractTestCase
@@ -69,7 +71,7 @@ class CKEditorTypeTest extends AbstractTestCase
6971
private $toolbarManager;
7072

7173
/**
72-
* {@inheritdooc}.
74+
* @group legacy
7375
*/
7476
protected function setUp()
7577
{
@@ -94,6 +96,9 @@ protected function setUp()
9496
$this->formType = method_exists(AbstractType::class, 'getBlockPrefix') ? CKEditorType::class : 'ckeditor';
9597
}
9698

99+
/**
100+
* @group legacy
101+
*/
97102
public function testInitialState()
98103
{
99104
$this->assertTrue($this->ckEditorType->isEnable());

0 commit comments

Comments
 (0)