@@ -102,12 +102,12 @@ function b_array_traverse_exists(&$mixed, string $path)
102
102
*
103
103
* @param iterable $mixed Source
104
104
* @param string $path Path
105
- * @param mixed $default Default value
105
+ * @param mixed|null $default Default value
106
106
*
107
107
* @return mixed|null
108
108
* @throws InvalidArgumentException if first argument is not a traversable data
109
109
*/
110
- function b_array_traverse_get (&$ mixed , string $ path , $ default = null )
110
+ function b_array_traverse_get (iterable &$ mixed , string $ path , $ default = null )
111
111
{
112
112
return ArrayHelper::traverseGet ($ mixed , $ path , $ default );
113
113
}
@@ -122,7 +122,7 @@ function b_array_traverse_get(&$mixed, string $path, $default = null)
122
122
* @return bool
123
123
* @throws InvalidArgumentException if first argument is not a traversable data
124
124
*/
125
- function b_array_traverse_set (&$ mixed , string $ path , $ value ): bool
125
+ function b_array_traverse_set (iterable &$ mixed , string $ path , $ value ): bool
126
126
{
127
127
return ArrayHelper::traverseSet ($ mixed , $ path , $ value );
128
128
}
@@ -148,7 +148,7 @@ function b_array_simple(array $array, ?string $prefix = null): array
148
148
/**
149
149
* Get a human see file size.
150
150
*
151
- * @param int| float $size
151
+ * @param float|int $size
152
152
* @param int $precision
153
153
*
154
154
* @return string
@@ -242,7 +242,7 @@ function b_ftruncate($resource, int $size, ?int $offset = null): bool
242
242
* @return mixed
243
243
* @throws ReflectionException
244
244
*/
245
- function b_get_property_value ($ object , string $ property , &$ exists = null )
245
+ function b_get_property_value (object $ object , string $ property , ? bool &$ exists = null )
246
246
{
247
247
return ObjectHelper::getPropertyValue ($ object , $ property , $ exists );
248
248
}
@@ -257,7 +257,7 @@ function b_get_property_value($object, string $property, &$exists = null)
257
257
* @return bool
258
258
* @throws ReflectionException
259
259
*/
260
- function b_set_property_value ($ object , string $ property , $ value ): bool
260
+ function b_set_property_value (object $ object , string $ property , $ value ): bool
261
261
{
262
262
return ObjectHelper::setPropertyValue ($ object , $ property , $ value );
263
263
}
@@ -267,14 +267,14 @@ function b_set_property_value($object, string $property, $value): bool
267
267
/// STRING HELPER ///
268
268
/////////////////////
269
269
270
- define ( ' B_STR_RANDOM_ALPHA ' , 1 ) ;
271
- define ( ' B_STR_RANDOM_NUMERIC ' , 2 ) ;
272
- define ( ' B_STR_RANDOM_SPECIAL_CHARACTERS ' , 4 ) ;
273
- define ( ' B_STR_RANDOM_LOWER_CASE ' , 8 ) ;
274
- define ( ' B_STR_RANDOM_NEED_ALL ' , 16 ) ;
275
- define ( ' B_TRUNCATE_LEFT ' , 1 ) ;
276
- define ( ' B_TRUNCATE_MIDDLE ' , 2 ) ;
277
- define ( ' B_TRUNCATE_RIGHT ' , 3 ) ;
270
+ const B_STR_RANDOM_ALPHA = 1 ;
271
+ const B_STR_RANDOM_NUMERIC = 2 ;
272
+ const B_STR_RANDOM_SPECIAL_CHARACTERS = 4 ;
273
+ const B_STR_RANDOM_LOWER_CASE = 8 ;
274
+ const B_STR_RANDOM_NEED_ALL = 16 ;
275
+ const B_TRUNCATE_LEFT = 1 ;
276
+ const B_TRUNCATE_MIDDLE = 2 ;
277
+ const B_TRUNCATE_RIGHT = 3 ;
278
278
279
279
280
280
/**
@@ -428,9 +428,9 @@ function b_spinal_case(string $str): string
428
428
/// IMAGE HELPER ///
429
429
/////////////////////
430
430
431
- define ( ' B_IMG_SIZE_RATIO ' , 1 ) ;
432
- define ( ' B_IMG_SIZE_LARGER_EDGE ' , 2 ) ;
433
- define ( ' B_IMG_RESIZE_COVER ' , 4 ) ;
431
+ const B_IMG_SIZE_RATIO = 1 ;
432
+ const B_IMG_SIZE_LARGER_EDGE = 2 ;
433
+ const B_IMG_RESIZE_COVER = 4 ;
434
434
435
435
/**
436
436
* Calculate a gradient destination color.
@@ -460,8 +460,8 @@ function b_gradient_color(string $color, string $colorToAdd, float $percentToAdd
460
460
function b_img_size (
461
461
int $ originalWidth ,
462
462
int $ originalHeight ,
463
- int $ newWidth = null ,
464
- int $ newHeight = null ,
463
+ ? int $ newWidth = null ,
464
+ ? int $ newHeight = null ,
465
465
int $ mode = B_IMG_SIZE_RATIO
466
466
): array {
467
467
return ImageHelper::size ($ originalWidth , $ originalHeight , $ newWidth , $ newHeight , $ mode );
@@ -477,8 +477,12 @@ function b_img_size(
477
477
*
478
478
* @return resource|GdImage
479
479
*/
480
- function b_img_resize ($ img , int $ newWidth = null , int $ newHeight = null , int $ mode = B_IMG_SIZE_RATIO )
481
- {
480
+ function b_img_resize (
481
+ $ img ,
482
+ ?int $ newWidth = null ,
483
+ ?int $ newHeight = null ,
484
+ int $ mode = B_IMG_SIZE_RATIO
485
+ ) {
482
486
return ImageHelper::resize ($ img , $ newWidth , $ newHeight , $ mode );
483
487
}
484
488
@@ -491,7 +495,10 @@ function b_img_resize($img, int $newWidth = null, int $newHeight = null, int $mo
491
495
*
492
496
* @return resource|GdImage
493
497
*/
494
- function b_img_support ($ img , int $ newWidth = null , int $ newHeight = null )
495
- {
498
+ function b_img_support (
499
+ $ img ,
500
+ ?int $ newWidth = null ,
501
+ ?int $ newHeight = null
502
+ ) {
496
503
return ImageHelper::resizeSupport ($ img , $ newWidth , $ newHeight );
497
504
}
0 commit comments