php8 vc review

This commit is contained in:
fbsanchez 2022-01-13 12:16:39 +01:00
parent edd24cd388
commit d8d5bb3a21
10 changed files with 18 additions and 15 deletions

View File

@ -56,7 +56,7 @@ abstract class Model
*
* @abstract
*/
abstract static protected function encode(array $data): array;
abstract protected static function encode(array $data): array;
/**

View File

@ -1827,7 +1827,10 @@ class Item extends CachedModel
} else {
// Update.
$dataModelEncode = static::encode($this->toArray());
$dataEncode = static::encode($data);
// Exception colorcloud...
$dataEncode = static::encode(
array_merge($this->toArray(), $data)
);
$save = array_merge($dataModelEncode, $dataEncode);

View File

@ -59,7 +59,7 @@ final class BarsGraph extends Item
*
* @overrides Item->encode.
*/
protected function encode(array $data): array
protected static function encode(array $data): array
{
$return = parent::encode($data);

View File

@ -63,7 +63,7 @@ final class Box extends Item
*
* @overrides Item->encode.
*/
protected function encode(array $data): array
protected static function encode(array $data): array
{
$return = parent::encode($data);

View File

@ -76,7 +76,7 @@ final class ColorCloud extends Item
*
* @overrides Item->encode.
*/
protected function encode(array $data): array
protected static function encode(array $data): array
{
$return = parent::encode($data);
@ -100,7 +100,7 @@ final class ColorCloud extends Item
]
);
} else {
$prevData = $this->toArray();
$prevData = $data;
$prevDataDefaultColor = static::extractDefaultColor(
['defaultColor' => $prevData['defaultColor']]
);

View File

@ -78,7 +78,7 @@ final class Group extends Item
*
* @overrides Item->encode.
*/
protected function encode(array $data): array
protected static function encode(array $data): array
{
$return = parent::encode($data);

View File

@ -706,7 +706,7 @@ final class NetworkLink extends Model
*
* @overrides Model::encode.
*/
protected function encode(array $data): array
protected static function encode(array $data): array
{
$result = [];
$result['type'] = NETWORK_LINK;

View File

@ -199,7 +199,7 @@ final class Odometer extends Item
*
* @overrides Item->encode.
*/
protected function encode(array $data): array
protected static function encode(array $data): array
{
$return = parent::encode($data);

View File

@ -37,7 +37,7 @@ final class Percentile extends Item
* 'CIRCULAR_PROGRESS_BAR' or 'CIRCULAR_INTERIOR_PROGRESS_BAR'.
* 'PERCENTILE_BAR' by default.
*/
protected function encodePercentileType(array $data): ?int
protected static function encodePercentileType(array $data): ?int
{
$type = null;
if (isset($data['percentileType']) === true) {
@ -74,7 +74,7 @@ final class Percentile extends Item
* 'CIRCULAR_PROGRESS_BAR' or 'CIRCULAR_INTERIOR_PROGRESS_BAR'.
* 'PERCENTILE_BAR' by default.
*/
protected function encodeValueType(array $data): ?string
protected static function encodeValueType(array $data): ?string
{
$valueType = null;
if (isset($data['valueType']) === true) {
@ -103,7 +103,7 @@ final class Percentile extends Item
* 'CIRCULAR_PROGRESS_BAR' or 'CIRCULAR_INTERIOR_PROGRESS_BAR'.
* 'PERCENTILE_BAR' by default.
*/
protected function encodeLabelColor(array $data): ?string
protected static function encodeLabelColor(array $data): ?string
{
$labelColor = null;
if (isset($data['labelColor']) === true) {
@ -123,7 +123,7 @@ final class Percentile extends Item
* 'CIRCULAR_PROGRESS_BAR' or 'CIRCULAR_INTERIOR_PROGRESS_BAR'.
* 'PERCENTILE_BAR' by default.
*/
protected function encodeColor(array $data): ?string
protected static function encodeColor(array $data): ?string
{
$color = null;
if (isset($data['color']) === true) {
@ -143,7 +143,7 @@ final class Percentile extends Item
*
* @overrides Item->encode.
*/
protected function encode(array $data): array
protected static function encode(array $data): array
{
$return = parent::encode($data);

View File

@ -104,7 +104,7 @@ final class SimpleValue extends Item
*
* @overrides Item->encode.
*/
protected function encode(array $data): array
protected static function encode(array $data): array
{
$return = parent::encode($data);
$process_value = static::encodeProcessValue($data);