You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
The Timecode class does not correctly handle Timecode instances in several places, even though the documentation explicitly states that it should.
According to the package documentation, the add() method should accept an existing Timecode object:
From the docs:
add($time, $operation = 1)
Adds a timecode or a frame count to the current Timecode object.
$time: int|string|Timecode indicating the value to be added. $operation: int used to get the sign of time. return:Timecode Reference to the Timecode object.
However, the actual method signature only accepts int|string|DateTime, and trying to pass a Timecode object results in unintended behavior.
Expected Behavior
Calling add($timecodeObject) or constructing a Timecode object from another Timecode should work as described in the documentation.
Actual Behavior
Passing a Timecode object results in incorrect behavior.
Steps to Reproduce
$tc1 = new Timecode('00:01:00:00');
$tc2 = new Timecode('00:01:00:00');
// Expected: 00:02:00:00
$tc1->add($tc2)->toString();
Workaround
$tc1->add($tc2->toString())->toString();
Proposed Fix
Modify the add(), subtract(), and constructor to correctly handle Timecode instances.
Description
The
Timecode
class does not correctly handleTimecode
instances in several places, even though the documentation explicitly states that it should.According to the package documentation, the
add()
method should accept an existingTimecode
object:However, the actual method signature only accepts
int|string|DateTime
, and trying to pass aTimecode
object results in unintended behavior.Expected Behavior
Calling
add($timecodeObject)
or constructing aTimecode
object from anotherTimecode
should work as described in the documentation.Actual Behavior
Passing a
Timecode
object results in incorrect behavior.Steps to Reproduce
Workaround
Proposed Fix
Modify the
add()
,subtract()
, and constructor to correctly handleTimecode
instances.Here’s an example of a fix:
Let me know if you need more details!
The text was updated successfully, but these errors were encountered: