Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Find whether the type of a variable is string
<?php is_string(mixed $value): bool
<?php     public static function createMap($path, $excluded = null, IOInterface $io = null, $namespace = null, $autoloadType = null, &$scannedFiles = array())

    {

        $basePath = $path;

        if (is_string($path)) {

            if (is_file($path)) {

                $path = array(new \SplFileInfo($path));

            } elseif (is_dir($path) || strpos($path, '*') !== false) {
<?php         }



        $settingKey = $input->getArgument('setting-key');

        if (!is_string($settingKey)) {

            return 0;

        }
<?php             if ($showSource) {

                $source = ' (' . $this->config->getSourceOfValue($k . $key) . ')';

            }

            if (is_string($rawVal) && $rawVal != $value) {

                $io->write('[<comment>' . $k . $key . '</comment>] <info>' . $rawVal . ' (' . $value . ')</info>' . $source, true, IOInterface::QUIET);

            } else {

                $io->write('[<comment>' . $k . $key . '</comment>] <info>' . $value . '</info>' . $source, true, IOInterface::QUIET);
<?php                 foreach ($matches as $position => $foundPackage) {

                    $abandoned = '';

                    if (isset($foundPackage['abandoned'])) {

                        if (is_string($foundPackage['abandoned'])) {

                            $replacement = sprintf('Use %s instead', $foundPackage['abandoned']);

                        } else {

                            $replacement = 'No replacement was suggested';
<?php                         }



                        if ($latestPackage instanceof CompletePackageInterface && $latestPackage->isAbandoned()) {

                            $replacement = is_string($latestPackage->getReplacementPackage())

                                ? 'Use ' . $latestPackage->getReplacementPackage() . ' instead'

                                : 'No replacement was suggested';

                            $packageWarning = sprintf(
<?php     protected function getPackage(InstalledRepository $installedRepo, RepositoryInterface $repos, $name, $version = null)

    {

        $name = strtolower($name);

        $constraint = is_string($version) ? $this->versionParser->parseConstraints($version) : $version;



        $policy = new DefaultPolicy();

        $repositorySet = new RepositorySet('dev');
<?php             $question->setAutocompleterValues($autocompleterValues);

            $addedPackage = $helper->ask($input, $output, $question);



            if (!is_string($addedPackage) || empty($addedPackage)) {

                break;

            }
<?php         $output = '';

        foreach (token_get_all($source) as $token) {

            if (is_string($token)) {

                $output .= $token;

            } elseif (in_array($token[0], array(T_COMMENT, T_DOC_COMMENT))) {

                $output .= str_repeat("\n", substr_count($token[1], "\n"));
<?php                     $this->setSourceOfConfigValue($val, $key, $source);

                } elseif ('preferred-install' === $key && isset($this->config[$key])) {

                    if (is_array($val) || is_array($this->config[$key])) {

                        if (is_string($val)) {

                            $val = array('*' => $val);

                        }

                        if (is_string($this->config[$key])) {
<?php                         if (is_string($val)) {

                            $val = array('*' => $val);

                        }

                        if (is_string($this->config[$key])) {

                            $this->config[$key] = array('*' => $this->config[$key]);

                            $this->sourceOfConfigValue[$key . '*'] = $source;

                        }
<?php     private function process($value, $flags)

    {

        if (!is_string($value)) {

            return $value;

        }
<?php                 $return = 0;

                $this->ensureBinDirIsInPath();



                if (!is_string($callable)) {

                    if (!is_callable($callable)) {

                        $className = is_object($callable[0]) ? get_class($callable[0]) : $callable[0];
<?php                         throw new \RuntimeException('Subscriber '.$className.'::'.$callable[1].' for event '.$event->getName().' is not callable, make sure the function is defined and public');

                    }

                    if (is_array($callable) && (is_string($callable[0]) || is_object($callable[0])) && is_string($callable[1])) {

                        $this->io->writeError(sprintf('> %s: %s', $event->getName(), (is_object($callable[0]) ? get_class($callable[0]) : $callable[0]).'->'.$callable[1]), true, IOInterface::VERBOSE);

                    }

                    $return = false === call_user_func($callable, $event) ? 1 : 0;
<?php     public function addSubscriber(EventSubscriberInterface $subscriber)

    {

        foreach ($subscriber->getSubscribedEvents() as $eventName => $params) {

            if (is_string($params)) {

                $this->addListener($eventName, array($subscriber, $params));

            } elseif (is_string($params[0])) {

                $this->addListener($eventName, array($subscriber, $params[0]), isset($params[1]) ? $params[1] : 0);
<?php         foreach ($subscriber->getSubscribedEvents() as $eventName => $params) {

            if (is_string($params)) {

                $this->addListener($eventName, array($subscriber, $params));

            } elseif (is_string($params[0])) {

                $this->addListener($eventName, array($subscriber, $params[0]), isset($params[1]) ? $params[1] : 0);

            } else {

                foreach ($params as $listener) {