Closed (duplicate)
Project:
Entity Browser
Version:
8.x-2.x-dev
Component:
Miscellaneous
Priority:
Minor
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
28 Feb 2019 at 18:10 UTC
Updated:
13 Apr 2026 at 15:16 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
jigish.addweb commentedHere's the patch that resolves the error that mentioned above.
Comment #3
oknateThe patch changes many things that shouldn't be changed. Closing for now.
Comment #4
oknateComment #5
oknateComment #6
oknateRe-opening. I see a bunch of "Line exceeds 80 characters" warnings.
I haven't looked closely at the lines in question. I think these were missed because of the way I was linting the code, it was only fixing the ones it could automatically fix, using phpcbf, rather than just outputting a report using phpcs.
Once we fix these, I'll check the code base regularly with phpcs before committing code.
Comment #7
joshi.rohit100Adding for DCD-2019 code sprint.
Comment #8
willtryagain commentedComment #9
willtryagain commentedComment #10
sushylComment #11
otrolopezmasRan codesniffer and fixed all issues I found. I solved some of the comment lines, that were longer than 80 character, reducing the first line to an anecdotal version and then inserting the full comment in the following lines, where it's allowed to have multiple lines.
Comment #13
otrolopezmasTests are failing because of parent classes argument hints. Is there a way to fix this? Or this issue needs to be in standby until core is fixed?
Comment #14
nikitagupta commentedComment #15
nikitagupta commentedUpdate the patch #11 also fixed the test case.
Comment #16
nmatja commentedUpdated the patch #15.
Comment #17
guilhermevp commentedComment #18
guilhermevp commentedSending patch. Testing with phpcs will not return a clean state because some changes would result in worst readability. This patch has no interdiff, but is a sudo-reroll of #16
Comment #19
anabpvI will review this
Comment #20
anabpvI ran Code Sniffer and Code Beautify and fixed:
- 80 characters lines
- Dependency injections
- Access restriction comment
- Unused variables
- t() calls avoidance
- trigger_error for the deprecated method
- Doc comments
- @see message
Awaiting for review.
Thank you!
Comment #21
tmaiochi commentedI'll review this.
Comment #22
anabpvApologies, I had a syntax error in the patch #20.
Hopefully this new one is correct.
Thank you
Comment #23
anabpvUpdate of patch #22 (another syntax error)
Comment #24
anabpvUpdate of patch #23 (another syntax error)
Comment #25
tmaiochi commentedSteps performed:
(1) Installed module
(2) Reproduced the issue.
(3) Applied patch.
(4) Code review on changes.
(5) Tested again with patch, issue resolved.
The patch #24 correctly applied all coding standards.
Comment #26
avpadernoI am not sure why only the Drupal ruleset is used, when there is also the DrupalPractice ruleset.
Comment #27
avpadernoComment #28
kaustab_roy commentedComment #29
avpadernoIssues should be assigned to somebody who creates a patch or a MR in the next hours, not after more than 12 hours. This means blocking an issue for which somebody else could have worked on.
Comment #30
sakthi_dev commentedCreated a patch after verifying with DrupalPractice ruleset with . Please review.
Comment #31
avpadernoThe last line is necessary and it should not be removed.
Short descriptions cannot be split like that.
Alter must use the third person singular.
What follows
@todois a sentence: It starts with a capitalized word and ends with a period (preferable), a question mark, or an exclamation mark.I am not sure that removing field is correct. The existing comment is about a field, while the changed comment is about a formatted text (which is not a field).
That description is missing a definite article.
That description does not say what the class does.
As per Drupal coding standards, control structure conditions can be written on a single line, if they are more readable. In this case, the existing code is more readable.
The first method cannot be removed, exactly for the same reason the other one has not been removed: It contains a
@todotag.That description says for what that property is used; it needs to say what that property contains.
The description for a constructor must start with
Constructs a newfollowed by the class name (including its namespace), and end withobject.plugin_id is not an English word.
It is not necessary to say for the plugin instance, since that is a plugin ID.
The description is missing a definite article.
Only the first word in the description must be capitalized.
There is no need to say service.
That is not the description of what
$rendercontains.@deprecatedmust be added to the method documentation comment, not inside the method.There is no need to say Drupal.
form_state is not an English word.
Since the property name has been changed,
$this->widget_idsis setting the wrong property.Comment #32
roshni27 commentedComment #33
imustakim commentedComment #34
imustakim commentedAs per suggestions by @apaderno, Changes have been made, and to address some of the concern mentioned in #31, only these errors are remaining.
Assuming these can be ignored. Rest of the errors are fixed.
Patch is updated, please review.
Comment #37
Shreyas gowda commentedComment #39
shruu_rao commentedHi,
I tried applying #37 patch. The patch throws
error: corrupt patch at line 16
Please check.
Comment #40
silvi.addweb commentedFixed the issues reported by phpcs.
Comment #41
cleavinjosh commentedHi,
I applied the patch #40 and verified that the issues reported by phpcs are fixed.
Thank you.
Comment #42
cleavinjosh commentedI apologize for this comment, my previous comment did not saved and when I try to comment again today, for some reason, the previous comment was also saved.
Comment #43
berdirThis is overwhelmingly large, has some bad changes and needs to be done as a merge request.
Many of these changes probably already have existing dedicated issues, or multiple, it likely makes more sense to focus on these, this will likely never get committed in this form.
this doesn't make sense, coder might be happy, but this isn't valid documentation.
this is not more readable and this coder rule is controversial and not enabled by core. We could copy the core phpcs rules, see #3295465: Fix the issues reported by phpcs
same, this doesn't make it more readable. getValue() has a default argument, not sure why this code isn't using that.
This can be considered an API change.
same here, this blindly makes phpstan happy, but the result is no longer English.
Comment #44
avpadernoWhile it can be emitted by any part of the system that will usually be done by selection display plugin. cannot be split in While it can be emitted by any part of the system. and That will usually be done by selection display plugin. because While it can be emitted by any part of the system. is not a sentence; it is a clause that requires another clause to be a sentence (and to be understandable).
You cannot randomly split sentences and put a period in random places just because PHP_CodeSniffer wants a shorter sentence.
Comment #45
berdir@apaderno: Maybe it's meant to be a Haiku? ;) ( don't actually have any clue about how Haikus work)
Comment #46
avpadernoI wish I could write a Haiku about using the correct punctuation. 😅 😉 🖊️
Comment #51
benstallings commentedClaude Code says:
Do not merge. This branch introduces multiple critical bugs while attempting to fix code style. The issues fall into four categories:
CRITICAL: JavaScript true/false → TRUE/FALSE
JavaScript is case-sensitive. TRUE and FALSE are undefined in JS (they're PHP constants). Three files affected:
- js/entity_browser.command_queue.js — return true; → return TRUE; — isAjaxing() now returns undefined, breaking the command queue
- js/entity_browser.view.js — ajax.ajaxing = true; → ajax.ajaxing = TRUE; — sets to undefined, breaking Views AJAX state tracking
- js/entity_browser.iframe.js — Same pattern
phpcs is PHP CodeSniffer — it doesn't touch JavaScript. These changes have no basis.
CRITICAL: Property renamed without updating all references
- ValueUpdatedCommand.php — $details_id renamed to $detailsId in declaration and constructor, but render() still references $this->details_id. Returns null in the AJAX command.
- WidgetSelectorBase.php — $widget_ids renamed to $widgetIds, but Tabs.php (lines 26, 53) and DropDown.php (line 31) still reference $this->widget_ids. Breaks tab and dropdown widget selectors entirely.
CRITICAL/MODERATE: return keywords removed
Several methods had their return statements removed instead of just fixing the surrounding style:
- SelectionDisplayBase::label() — return $this->label; → $this->label; — returns null
- WidgetValidationBase::label() — same issue
- DisplayBase::displayEntityBrowser() — return []; removed — returns null instead of empty array
- EntityBrowserEditForm::save() — return $status; removed
- Tabs::submit() — return ''; fallback removed
MODERATE: Null-safety removed
SelectForm.php — $row->_entity?->label() ?? '' changed to $row->_entity->label() — removes null-safe operator, will fatal if _entity is null.
MINOR: Public method renames (BC break)
- EventBase::getBrowserID() → getBrowserId()
- EventBase::getBrowserInstanceUUID() → getBrowserInstanceUuid()
These are public API methods. Any external code calling the old names will break.
What's actually safe
The PHPDoc rewording, line-length reformatting, @see additions, and comment improvements are all fine. That's roughly half the diff.
Verdict: This branch needs significant rework. The safe doc/formatting changes should be extracted into their own commit, and all functional changes need to be reverted or properly completed (updating all references when renaming).
Comment #54
benstallings commentedThe BC aliases are causing more phpcs problems than they solve — and since the linter reverted EventBase.php back to the original method names (getBrowserID, getBrowserInstanceUUID), those naming violations were already pre-existing on the base branch. The coding standards branch shouldn't be fixing public API method names since that's a BC break, not a style fix.
The cleanest approach: leave EventBase.php out of this branch entirely by reverting it to match 8.x-2.x. The getBrowserID/getBrowserInstanceUUID naming issue is a pre-existing phpcs warning that should be addressed in its own issue with a proper deprecation cycle, not in a coding standards cleanup branch.
Comment #55
benstallings commentedComment #58
avpadernoComment #59
anybody@avpaderno still open issues. I'd vote to instead fix this one: #3541968: Fix code style (phpcs. phpstan, styleint, cspell, eslint, ...)
Should we close this as duplicate then?
Comment #60
benstallings commentedOK @anybody, provided you are able to fix the breaking change that is on that branch! :)
Comment #62
anybodyThanks @benstallings! Let's proceed over there.