7272 * 'h': float,
7373 * }
7474 *
75+ * @phpstan-type TCellBound array{
76+ * 'T': float,
77+ * 'R': float,
78+ * 'B': float,
79+ * 'L': float,
80+ * }
81+ *
7582 * @phpstan-type TCellDef array{
76- * 'margin': array{
77- * 'T': float,
78- * 'R': float,
79- * 'B': float,
80- * 'L': float,
81- * },
82- * 'padding': array{
83- * 'T': float,
84- * 'R': float,
85- * 'B': float,
86- * 'L': float,
87- * },
88- * 'borderpos': float,
83+ * 'margin': TCellBound,
84+ * 'padding': TCellBound,
85+ * 'borderpos': float,
8986 * }
9087 *
9188 * @phpstan-type TRefUnitValues array{
@@ -183,7 +180,7 @@ abstract class Base
183180 /**
184181 * TCPDF version.
185182 */
186- protected string $ version = '8.2.2 ' ;
183+ protected string $ version = '8.2.3 ' ;
187184
188185 /**
189186 * Time is seconds since EPOCH when the document was created.
@@ -292,8 +289,8 @@ abstract class Base
292289 'small ' => -2.0 ,
293290 'medium ' => 0.0 ,
294291 'large ' => 2.0 ,
295- 'x-large ' => 4.0 ,
296292 'larger ' => 3.0 ,
293+ 'x-large ' => 4.0 ,
297294 'xx-large ' => 6.0 ,
298295 ];
299296
@@ -611,24 +608,26 @@ abstract class Base
611608 */
612609 public const BORDERPOS_INTERNAL = 0.5 ; // 1/2
613610
611+ /**
612+ * Default values for cell boundaries.
613+ *
614+ * @const TCellBound
615+ */
616+ public const ZEROCELLBOUND = [
617+ 'T ' => 0 ,
618+ 'R ' => 0 ,
619+ 'B ' => 0 ,
620+ 'L ' => 0 ,
621+ ];
622+
614623 /**
615624 * Default values for cell.
616625 *
617626 * @const TCellDef
618627 */
619628 public const ZEROCELL = [
620- 'margin ' => [
621- 'T ' => 0 ,
622- 'R ' => 0 ,
623- 'B ' => 0 ,
624- 'L ' => 0 ,
625- ],
626- 'padding ' => [
627- 'T ' => 0 ,
628- 'R ' => 0 ,
629- 'B ' => 0 ,
630- 'L ' => 0 ,
631- ],
629+ 'margin ' => self ::ZEROCELLBOUND ,
630+ 'padding ' => self ::ZEROCELLBOUND ,
632631 'borderpos ' => self ::BORDERPOS_DEFAULT ,
633632 ];
634633
@@ -713,16 +712,16 @@ protected function getUnitValuePoints(
713712 string $ defunit = 'px ' ,
714713 ): float {
715714 $ unit = 'px ' ;
716- if (in_array ($ defunit , self ::VALIDUNITS )) {
715+ if (\ in_array ($ defunit , self ::VALIDUNITS )) {
717716 $ unit = $ defunit ;
718717 }
719718
720719 $ value = 0.0 ;
721- if (is_numeric ($ val )) {
722- $ value = floatval ($ val );
723- } elseif (preg_match ('/([0-9\.\-\+]+)([a-z%]{0,4})/ ' , $ val , $ match )) {
724- $ value = floatval ($ match [1 ]);
725- if (in_array ($ match [2 ], self ::VALIDUNITS )) {
720+ if (\ is_numeric ($ val )) {
721+ $ value = \ floatval ($ val );
722+ } elseif (\ preg_match ('/([0-9\.\-\+]+)([a-z%]{0,4})/ ' , $ val , $ match )) {
723+ $ value = \ floatval ($ match [1 ]);
724+ if (\ in_array ($ match [2 ], self ::VALIDUNITS )) {
726725 $ unit = $ match [2 ];
727726 }
728727 } else {
@@ -755,9 +754,9 @@ protected function getUnitValuePoints(
755754 // Relative to 1% of the height of the viewport.
756755 'vh ' => (($ value * $ ref ['viewport ' ]['height ' ]) / 100 ),
757756 // Relative to 1% of viewport's* larger dimension.
758- 'vmax ' => (($ value * max ($ ref ['viewport ' ]['height ' ], $ ref ['viewport ' ]['width ' ])) / 100 ),
757+ 'vmax ' => (($ value * \ max ($ ref ['viewport ' ]['height ' ], $ ref ['viewport ' ]['width ' ])) / 100 ),
759758 // Relative to 1% of viewport's smaller dimension.
760- 'vmin ' => (($ value * min ($ ref ['viewport ' ]['height ' ], $ ref ['viewport ' ]['width ' ])) / 100 ),
759+ 'vmin ' => (($ value * \ min ($ ref ['viewport ' ]['height ' ], $ ref ['viewport ' ]['width ' ])) / 100 ),
761760 // Relative to 1% of the width of the viewport.
762761 'vw ' => (($ value * $ ref ['viewport ' ]['width ' ]) / 100 ),
763762 };
@@ -778,7 +777,7 @@ protected function getFontValuePoints(
778777 array $ ref = self ::REFUNITVAL ,
779778 string $ defunit = 'pt ' ,
780779 ): float {
781- if (is_string ($ val ) && isset (self ::FONTRELSIZE [$ val ])) {
780+ if (\ is_string ($ val ) && isset (self ::FONTRELSIZE [$ val ])) {
782781 return ($ ref ['parent ' ] + self ::FONTRELSIZE [$ val ]);
783782 }
784783
0 commit comments