View Issue Details

IDProjectCategoryView StatusLast Update
0020184mantisbtcode cleanuppublic2015-10-27 02:33
Reportercproensa Assigned Todregad  
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionwon't fix 
Product Version1.3.0-beta.3 
Summary0020184: MantisColumn class not compatible from 1.2 to 1.3
Description

In v1.2.x, there is defined this abstract method:
<pre>
abstract public function display( $p_bug, $p_columns_target );
</pre>

In v1.3, the bug parameter is type hinted:
<pre>
abstract public function display( BugData $p_bug, $p_columns_target );
</pre>

However, for PHP those are different method declarations. Leaving or adding the type hint will issue an error in each other implementation.
A code that implements that class (eg, as part of a plugin), cant be made compatible across versions.

TagsNo tags attached.

Activities

dregad

dregad

2015-10-12 04:32

developer   ~0051623

I am aware of the problem.

Unfortunately, I can't think of any way to achieve this while keeping the type hint, other than having such a plugin maintain 2 distinct branches for 1.2 and 1.3 support.

cproensa

cproensa

2015-10-14 11:03

developer   ~0051629

i made a workaround like this (psudo-code)

<pre>
if version is 1.2
class TMP extends MantisColumn {
abstract display_compat(..)
display(..non type hinted..) [calls display_compat]
}
else
class TMP extends MantisColumn {
abstract display_compat(..)
display(..type hinted..) [calls display_compat]
}

class FINAL extends TMP
display_compat(..) [implements actual code]
</pre>

because if/else is not allowed inside class definitions, but is allowed outside of class blocks.