- Issue created by @pingwin_cracow
- ๐ฎ๐ณIndia Shreya_98
Shreya_th โ made their first commit to this issueโs fork.
- Assigned to Shreya_98
- Merge request !11Deprecated function: Creation of dynamic property issues fixed โ (Closed) created by Unnamed author
- last update
about 1 year ago 8 pass - Issue was unassigned.
- ๐ฎ๐ณIndia Shreya_98
Hi @generalredneck,
I have created MR for Deprecated function: Creation of dynamic property . make all possible changes according to issue in ViewsNaturalSortService.php file. Kindly review the changes.Thank you.
- ๐บ๐ธUnited States generalredneck
@Shreya_th,
Thanks for making the changes. You got some code formatting issues, but otherwise, it's good to go. If you will make the changes, I would love to merge this. - ๐ฎ๐ณIndia Shreya_98
Hi @generalredneck,
It will be very helpful if you will elaborate that which type of code formatting issues. So it will be easy for me to make changes in code.Thank you
- ๐บ๐ธUnited States generalredneck
Shreya_th,
COnsider using phpcs with the DrupalPractice ruleset. Here is the full list of coding standards infractions introduced by this PR.FILE: /home/allan/workspace/d10/web/modules/contrib/views_natural_sort/src/ViewsNaturalSortService.php ----------------------------------------------------------------------------------------------------------------------- FOUND 24 ERRORS AFFECTING 21 LINES ----------------------------------------------------------------------------------------------------------------------- 31 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 0 31 | ERROR | [x] Whitespace found at end of line 33 | ERROR | [x] Whitespace found at end of line 34 | ERROR | [x] Expected 1 space(s) before asterisk; 2 found 34 | ERROR | [x] Expected 1 space after asterisk; 2 found 35 | ERROR | [x] Expected 1 space(s) before asterisk; 0 found 36 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 0 38 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 0 39 | ERROR | [x] Expected 1 space(s) before asterisk; 3 found 40 | ERROR | [x] Expected 1 space(s) before asterisk; 3 found 41 | ERROR | [x] Expected 1 space(s) before asterisk; 3 found 42 | ERROR | [x] Expected 1 space(s) before asterisk; 3 found 69 | ERROR | [x] Expected "\Drupal\Core\Queue\QueueFactory" but found "\Drupal\Core\Queue\QueueFactory;" for @var | | tag in member variable comment 76 | ERROR | [x] Expected "\Drupal\Core\Queue\QueueWorkerManagerInterface" but found | | "\Drupal\Core\Queue\QueueWorkerManagerInterface;" for @var tag in member variable comment 108 | ERROR | [ ] Parameter $loggerFactory is not described in comment 110 | ERROR | [x] Whitespace found at end of line 115 | ERROR | [ ] Missing parameter name 117 | ERROR | [ ] Doc comment for parameter $transformationManager does not match actual variable name $translator 132 | ERROR | [x] Parameter comment indentation must be 3 spaces, found 1 spaces 134 | ERROR | [x] Parameter comment indentation must be 3 spaces, found 1 spaces 135 | ERROR | [x] Whitespace found at end of line 136 | ERROR | [x] Additional blank lines found at end of doc comment 137 | ERROR | [ ] Expected type hint "ConfigFactoryInterface"; found "ConfigFactory" for $configFactory 137 | ERROR | [ ] Expected type hint "ViewsDataInterface"; found "ViewsData" for $viewsData ----------------------------------------------------------------------------------------------------------------------- PHPCBF CAN FIX THE 19 MARKED SNIFF VIOLATIONS AUTOMATICALLY -----------------------------------------------------------------------------------------------------------------------
- Assigned to Shreya_98
- ๐ฎ๐ณIndia Shreya_98
@generalredneck thank you for commenting issues. I Will definitely solve this code standard issues by today itself.
- last update
about 1 year ago 8 pass - Issue was unassigned.
- Status changed to Needs review
about 1 year ago 7:44pm 19 September 2023 - ๐ฎ๐ณIndia Shreya_98
Hi @generalredneck,
I have fixed all the code standard issues . Kindly Review the changes. - ๐บ๐ธUnited States generalredneck
@Shreya_th,
Would you mind explaining the changes made at https://git.drupalcode.org/project/views_natural_sort/-/merge_requests/1...
diff --git a/src/ViewsNaturalSortService.php b/src/ViewsNaturalSortService.php index 2603a25cd29f244f935a690e62aeee4a8dd94609..b7106713616b2a231dc149b43c601328f8679efa 100644 --- a/src/ViewsNaturalSortService.php +++ b/src/ViewsNaturalSortService.php @@ -313,13 +408,13 @@ class ViewsNaturalSortService { public function getViewsBaseTable($fieldDefinition) { $entityType = $this->entityTypeManager->getDefinition($fieldDefinition->getTargetEntityTypeId()); $base_table = $entityType->getBaseTable() ?: $entityType->id(); - $views_revision_base_table = NULL; + // $views_revision_base_table = NULL; $revisionable = $entityType->isRevisionable(); - $base_field = $entityType->getKey('id'); - - $revision_table = ''; + // $base_field = $entityType->getKey('id'); + // $revision_table = ''; if ($revisionable) { - $revision_table = $entityType->getRevisionTable() ?: $entityType->id() . '_revision'; + // $revision_table = $entityType->getRevisionTable() ?: + // $entityType->id() . '_revision'; } $translatable = $entityType->isTranslatable(); @@ -332,12 +427,12 @@ class ViewsNaturalSortService { // have a revision table name set in // \Drupal\Core\Entity\Sql\SqlContentEntityStorage::initTableLayout() so we // apply the same kind of logic. - $revision_data_table = ''; + // $revision_data_table = '';. if ($revisionable && $translatable) { - $revision_data_table = $entityType->getRevisionDataTable() ?: $entityType->id() . '_field_revision'; + // $revision_data_table = $entityType->getRevisionDataTable() ?: + // $entityType->id() . '_field_revision'; } - $revision_field = $entityType->getKey('revision'); - + // $revision_field = $entityType->getKey('revision'); $views_base_table = $base_table; if ($data_table) { $views_base_table = $data_table;
It appears that you are adding some commented out lines of code for some reason.
I didn't expect you to go through the whole module and fix all the changes that failed coding standards up until now but thank you.
- ๐ต๐ฑPoland pingwin_cracow
I have made the code corrections presented
https://git.drupalcode.org/project/views_natural_sort/-/merge_requests/11...
Unfortunately, there are still errors in the sequence.
I wonder if there are still errors in the code, or maybe it's in another module?I use it
D 10.1.4
php 8.2new errors detected:
Deprecated function: Creation of dynamic property Drupal\views_natural_sort\IndexRecord::$type is deprecated in Drupal\views_natural_sort\IndexRecord->generateType() (line 213 of modules/contrib/views_natural_sort/src/IndexRecord.php).
Drupal\views_natural_sort\IndexRecord->generateType() (Line: 100)
Drupal\views_natural_sort\IndexRecord->setEntityType('paragraph') (Line: 66)
Drupal\views_natural_sort\IndexRecord->__construct(Object, Array) (Line: 397)
Drupal\views_natural_sort\ViewsNaturalSortService->createIndexRecord(Array) (Line: 342)
Drupal\views_natural_sort\ViewsNaturalSortService->storeIndexRecordsFromEntity(Object) (Line: 92)
views_natural_sort_entity_insert(Object) (Line: 102)
views_natural_sort_entity_update(Object)
call_user_func_array(Object, Array) (Line: 409)
Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}(Object, 'views_natural_sort') (Line: 388)
Drupal\Core\Extension\ModuleHandler->invokeAllWith('entity_update', Object) (Line: 408)
Drupal\Core\Extension\ModuleHandler->invokeAll('entity_update', Array) (Line: 217)
Drupal\Core\Entity\EntityStorageBase->invokeHook('update', Object) (Line: 900)
Drupal\Core\Entity\ContentEntityStorageBase->invokeHook('update', Object) (Line: 564)
Drupal\Core\Entity\EntityStorageBase->doPostSave(Object, 1) (Line: 781)
Drupal\Core\Entity\ContentEntityStorageBase->doPostSave(Object, 1) (Line: 489)
Drupal\Core\Entity\EntityStorageBase->save(Object) (Line: 806)
Drupal\Core\Entity\Sql\SqlContentEntityStorage->save(Object) (Line: 339)
Drupal\Core\Entity\EntityBase->save() (Line: 303)
Drupal\entity_reference_revisions\Plugin\Field\FieldType\EntityReferenceRevisionsItem->preSave() (Line: 233)
Drupal\Core\Field\FieldItemList->delegateMethod('preSave') (Line: 191)
Drupal\Core\Field\FieldItemList->preSave() (Line: 938)
Drupal\Core\Entity\ContentEntityStorageBase->invokeFieldMethod('preSave', Object) (Line: 888)
Drupal\Core\Entity\ContentEntityStorageBase->invokeHook('presave', Object) (Line: 529)
Drupal\Core\Entity\EntityStorageBase->doPreSave(Object) (Line: 753)
Drupal\Core\Entity\ContentEntityStorageBase->doPreSave(Object) (Line: 483)
Drupal\Core\Entity\EntityStorageBase->save(Object) (Line: 806)
Drupal\Core\Entity\Sql\SqlContentEntityStorage->save(Object) (Line: 339)
Drupal\Core\Entity\EntityBase->save() (Line: 270)
Drupal\node\NodeForm->save(Array, Object)
call_user_func_array(Array, Array) (Line: 114)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 52)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 597)
Drupal\Core\Form\FormBuilder->processForm('node_news_edit_form', Array, Object) (Line: 325)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 592)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 182)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 50)
Drupal\ban\BanMiddleware->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 704)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)If you can help, I will be grateful.
Best Regards - ๐จ๐ฆCanada TrevorBradley
I'm similarly seeing
Deprecated function: Creation of dynamic property Drupal\views_natural_sort\IndexRecord::$type is deprecated in Drupal\views_natural_sort\IndexRecord->generateType() (line 213 of /app/web/modules/contrib/views_natural_sort/src/IndexRecord.php)
It's still deprecated, not an error, so give me a few days to come back around to this.
- last update
about 1 year ago 8 pass - last update
about 1 year ago 8 pass - ๐จ๐ฆCanada TrevorBradley
Argh, my git logs reference the wrong issue. I'm going to see if I can fix this, but feel free to trash my commits and reroll them.
- First commit to issue fork.
- Merge request !13Issue #3387975: Deprecated function: Creation of dynamic property โ (Merged) created by malcomio
- last update
7 months ago 8 pass - ๐ฌ๐งUnited Kingdom malcomio
As mentioned in #11, the current merge request includes various other changes that don't relate to this issue.
It makes sense to keep changes limited to the issue in question, and fix coding standards issues separately.
https://git.drupalcode.org/project/views_natural_sort/-/merge_requests/13 just addresses the deprecations in src/ViewsNaturalSortService.php
- Status changed to Needs work
6 months ago 7:01pm 6 May 2024 - ๐บ๐ธUnited States generalredneck
As indicated by the PHPStan run, this only fixes some of the errors. We had a similar fix marked in ๐ Deprecation errors Fixed but for different pieces. I'm going to update the merge request here with the other undefined property fixes.
-
generalredneck โ
committed a3a7b99f on 8.x-2.x authored by
malcomio โ
Issue #3387975 by Shreya_th, TrevorBradley, malcomio, generalredneck,...
-
generalredneck โ
committed a3a7b99f on 8.x-2.x authored by
malcomio โ
- Status changed to Fixed
6 months ago 7:19pm 6 May 2024 - ๐บ๐ธUnited States generalredneck
So I'm leaving the last PHPstan error for another ticket. It's addressed by ๐ Automated Drupal 11 compatibility fixes for views_natural_sort Needs review . Thanks so much for your work.
Automatically closed - issue fixed for 2 weeks with no activity.