DistributedProofreaders / dproofreaders

Distributed Proofreaders is a web application intended to ease the process of converting public domain books into e-texts.
https://www.pgdp.net
GNU General Public License v2.0
46 stars 28 forks source link

phpstan: Fix "Call to an undefined method" error (and re-enable) #1209

Closed bpfoley closed 1 month ago

bpfoley commented 1 month ago

To do this:

  1. Make class Selector abstract as it already implicitly is and add the abstract method declaration it needs.

  2. Fix OptionSelector::get_html_control() to return a string to make it consistent with the other get_html_control()s, The echos in this method accidentally worked before now because of the use of echo "foo", get_html_control(), "bar" in Selector and PHP happening to evaluate the arguments to echo (and their side effects) in left-to-right order.

There's a sandbox to test this at https://www.pgdp.org/~bfoley/c.branch/invalid-fn/

The code in question affects all the widgets on the project search page, in particular the popup menus under 'Configure Result'; the checkboxes, and the lists such as Language, Special Day, State.