Skip to content

Commit

Permalink
Fix update "new class() {..." CS (#2217)
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek authored Aug 11, 2024
1 parent df01e03 commit ee0e11d
Show file tree
Hide file tree
Showing 22 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion demos/_unit-test/console_run.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion demos/basic/columns.php
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion demos/collection/crud.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
2 changes: 1 addition & 1 deletion demos/collection/crud3.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion demos/collection/multitable.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];

/**
Expand Down
2 changes: 1 addition & 1 deletion demos/collection/tablecolumns.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
2 changes: 1 addition & 1 deletion demos/data-action/factory-view.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
2 changes: 1 addition & 1 deletion demos/data-action/factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
2 changes: 1 addition & 1 deletion demos/form/form2.php
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion demos/init-app.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion demos/interactive/console.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down
4 changes: 2 additions & 2 deletions demos/interactive/popup.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];
Expand Down Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion demos/interactive/wizard.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});

Expand Down
2 changes: 1 addition & 1 deletion demos/others/recursive.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
2 changes: 1 addition & 1 deletion demos/others/sticky.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
2 changes: 1 addition & 1 deletion tests/AppTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions tests/ExecutorFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
6 changes: 3 additions & 3 deletions tests/FormTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/JsIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion tests/JsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Table/ColumnTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
2 changes: 1 addition & 1 deletion tests/ViewTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit ee0e11d

Please sign in to comment.