IntegerData.php

Same filename in other branches
  1. 9 core/lib/Drupal/Core/TypedData/Plugin/DataType/IntegerData.php
  2. 8.9.x core/lib/Drupal/Core/TypedData/Plugin/DataType/IntegerData.php
  3. 10 core/lib/Drupal/Core/TypedData/Plugin/DataType/IntegerData.php

Namespace

Drupal\Core\TypedData\Plugin\DataType

File

core/lib/Drupal/Core/TypedData/Plugin/DataType/IntegerData.php

View source
<?php

namespace Drupal\Core\TypedData\Plugin\DataType;

use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\Core\TypedData\Attribute\DataType;
use Drupal\Core\TypedData\PrimitiveBase;
use Drupal\Core\TypedData\Type\IntegerInterface;

/**
 * The integer data type.
 *
 * The plain value of an integer is a regular PHP integer. For setting the value
 * any PHP variable that casts to an integer may be passed.
 */
class IntegerData extends PrimitiveBase implements IntegerInterface {
    
    /**
     * {@inheritdoc}
     */
    public function getCastedValue() {
        return (int) $this->value;
    }

}

Classes

Title Deprecated Summary
IntegerData The integer data type.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.