From ee0e11dd462dd6e3344dc227175347ee1360b262 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Sun, 11 Aug 2024 15:12:09 +0200 Subject: [PATCH] Fix update "new class() {..." CS (#2217) --- demos/_unit-test/console_run.php | 2 +- demos/basic/columns.php | 2 +- demos/collection/crud.php | 2 +- demos/collection/crud3.php | 2 +- demos/collection/multitable.php | 2 +- demos/collection/tablecolumns.php | 2 +- demos/data-action/factory-view.php | 2 +- demos/data-action/factory.php | 2 +- demos/form/form2.php | 2 +- demos/init-app.php | 2 +- demos/interactive/console.php | 2 +- demos/interactive/popup.php | 4 ++-- demos/interactive/wizard.php | 2 +- demos/others/recursive.php | 2 +- demos/others/sticky.php | 2 +- tests/AppTest.php | 2 +- tests/ExecutorFactoryTest.php | 4 ++-- tests/FormTest.php | 6 +++--- tests/JsIntegrationTest.php | 2 +- tests/JsTest.php | 2 +- tests/Table/ColumnTest.php | 2 +- tests/ViewTest.php | 2 +- 22 files changed, 26 insertions(+), 26 deletions(-) diff --git a/demos/_unit-test/console_run.php b/demos/_unit-test/console_run.php index 1c84d5a171..c646d95372 100644 --- a/demos/_unit-test/console_run.php +++ b/demos/_unit-test/console_run.php @@ -13,7 +13,7 @@ /** @var App $app */ require_once __DIR__ . '/../init-app.php'; -$testRunClass = AnonymousClassNameCache::get_class(fn () => new class() extends View { +$testRunClass = AnonymousClassNameCache::get_class(fn () => new class extends View { use DebugTrait; public function test(): int diff --git a/demos/basic/columns.php b/demos/basic/columns.php index 559e5639ff..e41f7bdb4b 100644 --- a/demos/basic/columns.php +++ b/demos/basic/columns.php @@ -72,7 +72,7 @@ // Example box component with some content, good for putting into columns. -$boxClass = AnonymousClassNameCache::get_class(fn () => new class() extends View { +$boxClass = AnonymousClassNameCache::get_class(fn () => new class extends View { public $ui = 'segment'; #[\Override] diff --git a/demos/collection/crud.php b/demos/collection/crud.php index 0ac096634c..c7bb39022d 100644 --- a/demos/collection/crud.php +++ b/demos/collection/crud.php @@ -74,7 +74,7 @@ $column = $columns->addColumn(); Header::addTo($column, ['Customizations']); -$myExecutorClass = AnonymousClassNameCache::get_class(fn () => new class() extends ModalExecutor { +$myExecutorClass = AnonymousClassNameCache::get_class(fn () => new class extends ModalExecutor { #[\Override] public function addFormTo(View $view): Form { diff --git a/demos/collection/crud3.php b/demos/collection/crud3.php index dba70f158f..e7ce79a625 100644 --- a/demos/collection/crud3.php +++ b/demos/collection/crud3.php @@ -13,7 +13,7 @@ /** @var App $app */ require_once __DIR__ . '/../init-app.php'; -$modelClass = AnonymousClassNameCache::get_class(fn () => new class() extends Model { +$modelClass = AnonymousClassNameCache::get_class(fn () => new class extends Model { public $table = 'test'; public $caption = 'Country'; diff --git a/demos/collection/multitable.php b/demos/collection/multitable.php index 68a9de4ebd..f0cc53ce75 100644 --- a/demos/collection/multitable.php +++ b/demos/collection/multitable.php @@ -20,7 +20,7 @@ // re-usable component implementing counter -$finderClass = AnonymousClassNameCache::get_class(fn () => new class() extends Columns { +$finderClass = AnonymousClassNameCache::get_class(fn () => new class extends Columns { public array $route = []; /** diff --git a/demos/collection/tablecolumns.php b/demos/collection/tablecolumns.php index 2c1702d662..28c18aae42 100644 --- a/demos/collection/tablecolumns.php +++ b/demos/collection/tablecolumns.php @@ -13,7 +13,7 @@ /** @var App $app */ require_once __DIR__ . '/../init-app.php'; -$modelColorClass = AnonymousClassNameCache::get_class(fn () => new class() extends Model { +$modelColorClass = AnonymousClassNameCache::get_class(fn () => new class extends Model { #[\Override] protected function init(): void { diff --git a/demos/data-action/factory-view.php b/demos/data-action/factory-view.php index 66ed50ec63..2d19d01955 100644 --- a/demos/data-action/factory-view.php +++ b/demos/data-action/factory-view.php @@ -20,7 +20,7 @@ View::addTo($app, ['ui' => 'clearing divider']); // overriding basic ExecutorFactory in order to change Card button -$myFactory = AnonymousClassNameCache::get_class(fn () => new class() extends ExecutorFactory { +$myFactory = AnonymousClassNameCache::get_class(fn () => new class extends ExecutorFactory { public $buttonPrimaryColor = 'green'; protected array $actionIcon = [ diff --git a/demos/data-action/factory.php b/demos/data-action/factory.php index aae6592fe8..396f23e481 100644 --- a/demos/data-action/factory.php +++ b/demos/data-action/factory.php @@ -30,7 +30,7 @@ // overriding basic ExecutorFactory in order to change Table and Modal button // and also changing default add action label -$myFactory = AnonymousClassNameCache::get_class(static fn () => new class() extends ExecutorFactory { +$myFactory = AnonymousClassNameCache::get_class(static fn () => new class extends ExecutorFactory { public $buttonPrimaryColor = 'green'; protected $triggerSeed = [ diff --git a/demos/form/form2.php b/demos/form/form2.php index e271c8bf5e..228e50ae4a 100644 --- a/demos/form/form2.php +++ b/demos/form/form2.php @@ -85,7 +85,7 @@ return new JsToast($countryEntity->getUserAction('add')->execute()); }); -$personClass = AnonymousClassNameCache::get_class(fn () => new class() extends Model { +$personClass = AnonymousClassNameCache::get_class(fn () => new class extends Model { public $table = 'person'; #[\Override] diff --git a/demos/init-app.php b/demos/init-app.php index 97c96b0666..7a27baaa98 100644 --- a/demos/init-app.php +++ b/demos/init-app.php @@ -30,7 +30,7 @@ 'callExit' => (bool) ($_GET['APP_CALL_EXIT'] ?? true), 'catchExceptions' => (bool) ($_GET['APP_CATCH_EXCEPTIONS'] ?? true), 'alwaysRun' => (bool) ($_GET['APP_ALWAYS_RUN'] ?? true), - 'uiPersistence' => new class() extends UiPersistence { + 'uiPersistence' => new class extends UiPersistence { #[\Override] protected function _typecastLoadField(Field $field, $value) { diff --git a/demos/interactive/console.php b/demos/interactive/console.php index 71f192a8e1..0d3dcde1ad 100644 --- a/demos/interactive/console.php +++ b/demos/interactive/console.php @@ -20,7 +20,7 @@ /** @var App $app */ require_once __DIR__ . '/../init-app.php'; -$testRunClass = AnonymousClassNameCache::get_class(fn () => new class() extends View { +$testRunClass = AnonymousClassNameCache::get_class(fn () => new class extends View { use DebugTrait; /** diff --git a/demos/interactive/popup.php b/demos/interactive/popup.php index 6cc7aecbaf..953ea4a679 100644 --- a/demos/interactive/popup.php +++ b/demos/interactive/popup.php @@ -32,7 +32,7 @@ * Cart will memorize and restore its items into session. Cart will also * render the items. */ -$cartClass = AnonymousClassNameCache::get_class(fn () => new class() extends Lister { +$cartClass = AnonymousClassNameCache::get_class(fn () => new class extends Lister { use SessionTrait; public array $items = []; @@ -101,7 +101,7 @@ protected function renderView(): void * Method linkCart allow you to link ItemShelf with Cart. Clicking on a shelf item will place that * item inside a cart reloading it afterwards. */ -$itemShelfClass = AnonymousClassNameCache::get_class(fn () => new class() extends View { +$itemShelfClass = AnonymousClassNameCache::get_class(fn () => new class extends View { public $ui = 'green segment'; #[\Override] diff --git a/demos/interactive/wizard.php b/demos/interactive/wizard.php index a2e1c75c98..295df1bc91 100644 --- a/demos/interactive/wizard.php +++ b/demos/interactive/wizard.php @@ -18,7 +18,7 @@ /** @var App $app */ require_once __DIR__ . '/../init-app.php'; -$wizardClass = AnonymousClassNameCache::get_class(static fn () => new class() extends Wizard { +$wizardClass = AnonymousClassNameCache::get_class(static fn () => new class extends Wizard { use SessionTrait; }); diff --git a/demos/others/recursive.php b/demos/others/recursive.php index 89b4d27514..0d337433cf 100644 --- a/demos/others/recursive.php +++ b/demos/others/recursive.php @@ -14,7 +14,7 @@ /** @var App $app */ require_once __DIR__ . '/../init-app.php'; -$mySwitcherClass = AnonymousClassNameCache::get_class(fn () => new class() extends View { +$mySwitcherClass = AnonymousClassNameCache::get_class(fn () => new class extends View { #[\Override] protected function init(): void { diff --git a/demos/others/sticky.php b/demos/others/sticky.php index 2aae0ccfbf..921f344ddd 100644 --- a/demos/others/sticky.php +++ b/demos/others/sticky.php @@ -17,7 +17,7 @@ 'ui' => 'ignored info message', ]); -$myButtonClass = AnonymousClassNameCache::get_class(fn () => new class() extends Button { +$myButtonClass = AnonymousClassNameCache::get_class(fn () => new class extends Button { #[\Override] protected function renderView(): void { diff --git a/tests/AppTest.php b/tests/AppTest.php index ef29b10f6c..ef26a5d32d 100644 --- a/tests/AppTest.php +++ b/tests/AppTest.php @@ -71,7 +71,7 @@ public function testTemplateClassDefault(): void public function testTemplateClassCustom(): void { - $anotherTemplateClass = get_class(new class() extends HtmlTemplate {}); + $anotherTemplateClass = get_class(new class extends HtmlTemplate {}); $app = $this->createApp([ 'templateClass' => $anotherTemplateClass, diff --git a/tests/ExecutorFactoryTest.php b/tests/ExecutorFactoryTest.php index a431b98db1..b0d58d9f2d 100644 --- a/tests/ExecutorFactoryTest.php +++ b/tests/ExecutorFactoryTest.php @@ -112,10 +112,10 @@ public function testRegisterTrigger(): void $editAction = $this->model->getUserAction('edit'); $p = new Persistence\Array_(); - $otherModelClass = get_class(new class() extends Model {}); + $otherModelClass = get_class(new class extends Model {}); $secondEditAction = (new $otherModelClass($p))->getUserAction('edit'); - $specialClass = get_class(new class() extends Model { + $specialClass = get_class(new class extends Model { public $caption = 'Special Test'; }); $specialEditAction = (new $specialClass($p))->getUserAction('edit'); diff --git a/tests/FormTest.php b/tests/FormTest.php index 5e7b777d4c..f70394296c 100644 --- a/tests/FormTest.php +++ b/tests/FormTest.php @@ -246,7 +246,7 @@ public function testLoadPostConvertedWarningNotWrappedException(): void try { $this->assertFormSubmit(static function (App $app) { $m = new Model(); - $m->addField('foo', new class() extends Field { + $m->addField('foo', new class extends Field { #[\Override] public function normalize($value) { @@ -279,7 +279,7 @@ public function testCreateControlException(): void $form->setApp($this->createApp()); $form->invokeInit(); - $controlClass = get_class(new class() extends Form\Control { + $controlClass = get_class(new class extends Form\Control { public static bool $firstCreate = true; public function __construct() // @phpstan-ignore constructor.missingParentCall @@ -314,7 +314,7 @@ public function testCreateControlConvertedWarningNotWrappedException(): void $form->setApp($this->createApp()); $form->invokeInit(); - $controlClass = get_class(new class() extends Form\Control { + $controlClass = get_class(new class extends Form\Control { public static bool $firstCreate = true; public function __construct() // @phpstan-ignore constructor.missingParentCall diff --git a/tests/JsIntegrationTest.php b/tests/JsIntegrationTest.php index b6ffeaec03..4ffd621d5d 100644 --- a/tests/JsIntegrationTest.php +++ b/tests/JsIntegrationTest.php @@ -156,7 +156,7 @@ public function testChainJsCallbackLazyExecuteRender(): void $v->invokeInit(); $b = Button::addTo($v); - $jsCallback = new class() extends JsCallback { + $jsCallback = new class extends JsCallback { public int $counter = 0; #[\Override] diff --git a/tests/JsTest.php b/tests/JsTest.php index e92cccc41f..e3475cb84d 100644 --- a/tests/JsTest.php +++ b/tests/JsTest.php @@ -221,7 +221,7 @@ public function testBlockEndSemicolon(): void new JsExpression('let fx = () => { a(); b(); }'), new JsExpression(''), new JsBlock(), - new class() extends JsBlock { + new class extends JsBlock { #[\Override] public function jsRender(): string { diff --git a/tests/Table/ColumnTest.php b/tests/Table/ColumnTest.php index d9034921da..278cae10b2 100644 --- a/tests/Table/ColumnTest.php +++ b/tests/Table/ColumnTest.php @@ -58,7 +58,7 @@ public function testAssertColumnViewNotInitializedException(): void public function testEachRowIsRenderIndividually(): void { - $this->table->addColumn('name', new class() extends Table\Column { + $this->table->addColumn('name', new class extends Table\Column { #[\Override] public function getDataCellHtml(?Field $field = null, array $attr = []): string { diff --git a/tests/ViewTest.php b/tests/ViewTest.php index 547804e6b9..173bb87c2d 100644 --- a/tests/ViewTest.php +++ b/tests/ViewTest.php @@ -78,7 +78,7 @@ public function testAddDelayedInit(): void public function testAddDelayedAbstractViewInit(): void { - $v = new class() extends AbstractView {}; + $v = new class extends AbstractView {}; $vInner = new View(); $v->add($vInner);