Closed (duplicate)
Project:
Views (for Drupal 7)
Version:
8.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
24 Jun 2011 at 18:30 UTC
Updated:
23 Sep 2012 at 07:03 UTC
Jump to comment: Most recent file
Comments
Comment #1
casey commentedShould have tested the changes.
typehints are also useful as a test for improper hook implementations. I found out that hook_views_query_substitutions() was missing an argument and that views_plugin_query_default#query() was passing the wrong argument; itself instead of $view. views_plugin_query_default#execute() invokes the same hook but passes $view and the implementation user_views_query_substitutions() has $view as an argument.
Another, somewhat untidy but not disastrous, thing is that views_handler#init() sets a reference on $view->query, while that property doesn't contain an object yet. So I kept the reference indicator there, but added a comment.
Now I used 'view' and 'view_display' as typehint but it might be nicer to have an interface. You never know if someone wants to use its own view class.
Comment #2
dawehnerIn general this is cool, but doesn't this lead to notices?
Comment #3
casey commentedI am not entirely sure where you expect notices from?
Comment #4
dawehnerIf someone else extends
the signature changes. We had this thousand times when porting to drupal7.
Comment #5
casey commentedOww of course. Well then I am not sure if it is a good idea. You decide :)
Comment #6
dawehnerNo idea whether it cause notices or not, but just want to be sure about it :)
Comment #7
casey commentedYes it will. Thats a good thing, but not very much in our case as all contrib modules indeed need to be updated as well.
Comment #8
bojanz commentedI think it's too late in the release cycle to break all contrib handler implementations :/
But the patch has plenty of nice fixes that don't (shouldn't) break anything. Let's at least get that in.
Comment #9
bojanz commentedRerolled.
Comment #10
bojanz commentedReverted one wrong change caught by dereine (don't typehint $views)
Comment #11
dawehnerdisplay_id isn't a object, so it shouldn't be changed.
I personally like the & sign here, because it shows that this will be altered, as php doesn't have a const keyword, but i'm open for doing the change.
Comment #12
bojanz commentedRead the line again, I'm not touching $display_id :)
As for &$handler, the phpdoc above it says:
so it should be obvious enough.
Comment #13
dawehnerWord-diff doesn't lie :)
Good point
Comment #14
bojanz commentedYou're right, I suck :)
Comment #15
bojanz commentedReroll.
Comment #16
dawehnerHuge thanks here! Commited to 7.x-3.x
Comment #17
bojanz commentedSo I'm stupid tonight, which makes me wonder why I'm attempting patches this big.
Comment #18
bojanz commentedRemoved an old comment as well.
Comment #19
bojanz commentedSo we had to revert the whole thing....
Here's a patch from scratch. Probably needs work. Sigh.
Comment #20
dawehnerThis is a change from another patch, which shouldn't be done here.
Comment #21
dawehnerThis is still wrong here...
dito
Don't do any risk thing here.
Comment #22
bojanz commentedThis cleanup makes sense in 8.x-3.x.
I realize much of the code will be touched, cleaned-up and reworked, but this is a simple enough (if not frustrating) change to do upfront.
Comment #23
tim.plunkettComment #24
dawehner#1792454: Add type hinting to function signatures for $view