Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
forms system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
6 Dec 2014 at 09:42 UTC
Updated:
4 Apr 2015 at 13:04 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
almaudoh commentedMarking quickfix to get some attention.
Comment #3
tr commentedThis bit me several times.
A common use for this function would be
$form_state->cleanValues()->getValues()to return an array of form state values with the Form API tokens etc. removed. As documented, that should work. But it does not because the implementation is faulty.I checked the source and all the other method implementation in the FormState class return the proper documented types.
All methods declared by FormStateInterface are designed to be chainable, if appropriate. Setters, for example, always return $this, whereas getters obviously can't. cleanValues() simply modifies $form_state, so returning this is both appropriate and desired.
It's clear to me that FormStateInterface::cleanValues() was *intended* to return $this, and that the documentation that says it returns $this is not a mistake. Rather, the FormState implementation class is the place where the fault lies.
Comment #4
alexpottLet's test this.
Comment #5
almaudoh commentedTests added.
Comment #6
tim.plunkettLooks good, thanks!
Comment #8
alexpottThis issue is a normal bug fix, and doesn't include any disruptive changes, so it is allowed per https://www.drupal.org/core/beta-changes. Committed 89e6ec9 and pushed to 8.0.x. Thanks!