User tests: Successful: Unsuccessful:
static
instead of self
in methodsThis is a coding style change and doesn't have any effects on functionality.
Only change would if one would extend the JImage
class: developer doesn't have to define JImage constants again in extended class.
The only place where JImage is used in J! core is template editing feature:
Unit suites should pass
Manual tests pass
same as expected result
No changes required
Status | New | ⇒ | Pending |
Category | ⇒ | Libraries |
What about scenario when I'd extend the JImage
class and let's say add extra information in the getImageFileProperties
method?
Any code that would call self::getImageFileProperties
method would actually call the JImage class, not the extended one at least as I understand it
The method calls are fine, it's the constants that I don't think this works on.
Looks like you are right.
Constants shouldn't be overwritten in subclass and so referring to them with static
keyword is misleading.
Labels |
Added:
?
|
I've kept static
keyword only when referencing methods, however there is one more case - reference to $formats
array
That one's good, it's not private. Looks fine to me.
Issue can be closed since the modified class is deprecated.
See /libraries/vendor/joomla/image/src:19
Thanks, @jonasgonka
Superseeded by joomla-framework/image#19
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2018-07-23 11:31:28 |
Closed_By | ⇒ | piotr-cz |
From the looks of things, there isn't actually anything gained by calling
static::CONSTANT
because it's still referring either to itself or a parent class. It's not like late static bindings where it can resolve to a subclass if that's within the class chain, and https://secure.php.net/manual/en/language.oop5.constants.php#104260 seems to support that.