Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. DataCollector.php

function DataCollector::getCasters

Return value

callable[] The casters to add to the cloner

3 calls to DataCollector::getCasters()
DataCollector::cloneVar in vendor/symfony/http-kernel/DataCollector/DataCollector.php
Converts the variable into a serializable Data instance.
ValidatorDataCollector::getCasters in vendor/symfony/validator/DataCollector/ValidatorDataCollector.php
ValidatorDataCollector::getCasters in vendor/symfony/validator/DataCollector/ValidatorDataCollector.php
1 method overrides DataCollector::getCasters()
ValidatorDataCollector::getCasters in vendor/symfony/validator/DataCollector/ValidatorDataCollector.php

File

vendor/symfony/http-kernel/DataCollector/DataCollector.php, line 58

Class

DataCollector
DataCollector.

Namespace

Symfony\Component\HttpKernel\DataCollector

Code

protected function getCasters() : array {
    return [
        '*' => function ($v, array $a, Stub $s, $isNested) {
            if (!$v instanceof Stub) {
                $b = $a;
                foreach ($a as $k => $v) {
                    if (!\is_object($v) || $v instanceof \DateTimeInterface || $v instanceof Stub) {
                        continue;
                    }
                    try {
                        $a[$k] = $s = new CutStub($v);
                        if ($b[$k] === $s) {
                            // we've hit a non-typed reference
                            $a[$k] = $v;
                        }
                    } catch (\TypeError $e) {
                        // we've hit a typed reference
                    }
                }
            }
            return $a;
        },
    ] + ReflectionCaster::UNSET_CLOSURE_FILE_INFO;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal