made types consistent with those defined in Hack

This commit is contained in:
Fabien Potencier 2014-04-12 19:44:00 +02:00
parent f50b2c59d5
commit 0555b7f2ab
49 changed files with 81 additions and 81 deletions

View File

@ -112,6 +112,6 @@ class GlobalVariables
*/
public function getDebug()
{
return (Boolean) $this->container->getParameter('kernel.debug');
return (bool) $this->container->getParameter('kernel.debug');
}
}

View File

@ -41,8 +41,8 @@ class WebDebugToolbarListener implements EventSubscriberInterface
public function __construct(\Twig_Environment $twig, $interceptRedirects = false, $mode = self::ENABLED, $position = 'bottom')
{
$this->twig = $twig;
$this->interceptRedirects = (Boolean) $interceptRedirects;
$this->mode = (integer) $mode;
$this->interceptRedirects = (bool) $interceptRedirects;
$this->mode = (int) $mode;
$this->position = $position;
}

View File

@ -76,7 +76,7 @@ abstract class Client
*/
public function followRedirects($followRedirect = true)
{
$this->followRedirects = (Boolean) $followRedirect;
$this->followRedirects = (bool) $followRedirect;
}
/**
@ -107,7 +107,7 @@ abstract class Client
// @codeCoverageIgnoreEnd
}
$this->insulated = (Boolean) $insulated;
$this->insulated = (bool) $insulated;
}
/**

View File

@ -69,11 +69,11 @@ class Cookie
$this->rawValue = urlencode($value);
}
$this->name = $name;
$this->expires = null === $expires ? null : (integer) $expires;
$this->expires = null === $expires ? null : (int) $expires;
$this->path = empty($path) ? '/' : $path;
$this->domain = $domain;
$this->secure = (Boolean) $secure;
$this->httponly = (Boolean) $httponly;
$this->secure = (bool) $secure;
$this->httponly = (bool) $httponly;
}
/**

View File

@ -200,7 +200,7 @@ class ClassCollectionLoader
*/
public static function enableTokenizer($bool)
{
self::$useTokenizer = (Boolean) $bool;
self::$useTokenizer = (bool) $bool;
}
/**

View File

@ -37,7 +37,7 @@ class ConfigCache
public function __construct($file, $debug)
{
$this->file = $file;
$this->debug = (Boolean) $debug;
$this->debug = (bool) $debug;
}
/**

View File

@ -53,7 +53,7 @@ class ArrayNode extends BaseNode implements PrototypeNodeInterface
public function setNormalizeKeys($normalizeKeys)
{
$this->normalizeKeys = (Boolean) $normalizeKeys;
$this->normalizeKeys = (bool) $normalizeKeys;
}
/**
@ -113,7 +113,7 @@ class ArrayNode extends BaseNode implements PrototypeNodeInterface
*/
public function setAddIfNotSet($boolean)
{
$this->addIfNotSet = (Boolean) $boolean;
$this->addIfNotSet = (bool) $boolean;
}
/**
@ -123,7 +123,7 @@ class ArrayNode extends BaseNode implements PrototypeNodeInterface
*/
public function setAllowFalse($allow)
{
$this->allowFalse = (Boolean) $allow;
$this->allowFalse = (bool) $allow;
}
/**
@ -133,7 +133,7 @@ class ArrayNode extends BaseNode implements PrototypeNodeInterface
*/
public function setAllowNewKeys($allow)
{
$this->allowNewKeys = (Boolean) $allow;
$this->allowNewKeys = (bool) $allow;
}
/**
@ -143,7 +143,7 @@ class ArrayNode extends BaseNode implements PrototypeNodeInterface
*/
public function setPerformDeepMerging($boolean)
{
$this->performDeepMerging = (Boolean) $boolean;
$this->performDeepMerging = (bool) $boolean;
}
/**
@ -153,7 +153,7 @@ class ArrayNode extends BaseNode implements PrototypeNodeInterface
*/
public function setIgnoreExtraKeys($boolean)
{
$this->ignoreExtraKeys = (Boolean) $boolean;
$this->ignoreExtraKeys = (bool) $boolean;
}
/**

View File

@ -142,7 +142,7 @@ abstract class BaseNode implements NodeInterface
*/
public function setRequired($boolean)
{
$this->required = (Boolean) $boolean;
$this->required = (bool) $boolean;
}
/**
@ -152,7 +152,7 @@ abstract class BaseNode implements NodeInterface
*/
public function setAllowOverwrite($allow)
{
$this->allowOverwrite = (Boolean) $allow;
$this->allowOverwrite = (bool) $allow;
}
/**

View File

@ -309,7 +309,7 @@ class ArrayNodeDefinition extends NodeDefinition implements ParentNodeDefinition
*/
public function normalizeKeys($bool)
{
$this->normalizeKeys = (Boolean) $bool;
$this->normalizeKeys = (bool) $bool;
return $this;
}

View File

@ -59,7 +59,7 @@ class VariableNode extends BaseNode implements PrototypeNodeInterface
*/
public function setAllowEmptyValue($boolean)
{
$this->allowEmptyValue = (Boolean) $boolean;
$this->allowEmptyValue = (bool) $boolean;
}
/**

View File

@ -276,7 +276,7 @@ class Application
*/
public function setCatchExceptions($boolean)
{
$this->catchExceptions = (Boolean) $boolean;
$this->catchExceptions = (bool) $boolean;
}
/**
@ -288,7 +288,7 @@ class Application
*/
public function setAutoExit($boolean)
{
$this->autoExit = (Boolean) $boolean;
$this->autoExit = (bool) $boolean;
}
/**

View File

@ -46,7 +46,7 @@ class OutputFormatter implements OutputFormatterInterface
*/
public function __construct($decorated = false, array $styles = array())
{
$this->decorated = (Boolean) $decorated;
$this->decorated = (bool) $decorated;
$this->setStyle('error', new OutputFormatterStyle('white', 'red'));
$this->setStyle('info', new OutputFormatterStyle('green'));
@ -69,7 +69,7 @@ class OutputFormatter implements OutputFormatterInterface
*/
public function setDecorated($decorated)
{
$this->decorated = (Boolean) $decorated;
$this->decorated = (bool) $decorated;
}
/**

View File

@ -94,7 +94,7 @@ abstract class Input implements InputInterface
*/
public function setInteractive($interactive)
{
$this->interactive = (Boolean) $interactive;
$this->interactive = (bool) $interactive;
}
/**

View File

@ -220,7 +220,7 @@ EOF;
public function setProcessIsolation($processIsolation)
{
$this->processIsolation = (Boolean) $processIsolation;
$this->processIsolation = (bool) $processIsolation;
if ($this->processIsolation && !class_exists('Symfony\\Component\\Process\\Process')) {
throw new \RuntimeException('Unable to isolate processes as the Symfony Process Component is not installed.');

View File

@ -54,7 +54,7 @@ class Alias
*/
public function setPublic($boolean)
{
$this->public = (Boolean) $boolean;
$this->public = (bool) $boolean;
}
/**

View File

@ -40,7 +40,7 @@ class AnalyzeServiceReferencesPass implements RepeatablePassInterface
*/
public function __construct($onlyConstructorArguments = false)
{
$this->onlyConstructorArguments = (Boolean) $onlyConstructorArguments;
$this->onlyConstructorArguments = (bool) $onlyConstructorArguments;
}
/**

View File

@ -127,7 +127,7 @@ class ResolveDefinitionTemplatesPass implements CompilerPassInterface
throw new RuntimeException(sprintf('Invalid argument key "%s" found.', $k));
}
$index = (integer) substr($k, strlen('index_'));
$index = (int) substr($k, strlen('index_'));
$def->replaceArgument($index, $v);
}

View File

@ -88,7 +88,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
*/
public function setResourceTracking($track)
{
$this->trackResources = (Boolean) $track;
$this->trackResources = (bool) $track;
}
/**

View File

@ -556,7 +556,7 @@ class Definition
*/
public function setPublic($boolean)
{
$this->public = (Boolean) $boolean;
$this->public = (bool) $boolean;
return $this;
}
@ -584,7 +584,7 @@ class Definition
*/
public function setSynchronized($boolean)
{
$this->synchronized = (Boolean) $boolean;
$this->synchronized = (bool) $boolean;
return $this;
}
@ -610,7 +610,7 @@ class Definition
*/
public function setLazy($lazy)
{
$this->lazy = (Boolean) $lazy;
$this->lazy = (bool) $lazy;
return $this;
}
@ -637,7 +637,7 @@ class Definition
*/
public function setSynthetic($boolean)
{
$this->synthetic = (Boolean) $boolean;
$this->synthetic = (bool) $boolean;
return $this;
}
@ -667,7 +667,7 @@ class Definition
*/
public function setAbstract($boolean)
{
$this->abstract = (Boolean) $boolean;
$this->abstract = (bool) $boolean;
return $this;
}

View File

@ -121,6 +121,6 @@ abstract class Extension implements ExtensionInterface, ConfigurationExtensionIn
throw new InvalidArgumentException("The config array has no 'enabled' key.");
}
return (Boolean) $container->getParameterBag()->resolveValue($config['enabled']);
return (bool) $container->getParameterBag()->resolveValue($config['enabled']);
}
}

View File

@ -102,7 +102,7 @@ class XmlFileLoader extends FileLoader
foreach ($imports as $import) {
$this->setCurrentDir(dirname($file));
$this->import((string) $import['resource'], null, (Boolean) $import->getAttributeAsPhp('ignore-errors'), $file);
$this->import((string) $import['resource'], null, (bool) $import->getAttributeAsPhp('ignore-errors'), $file);
}
}

View File

@ -94,7 +94,7 @@ class YamlFileLoader extends FileLoader
foreach ($content['imports'] as $import) {
$this->setCurrentDir(dirname($file));
$this->import($import['resource'], null, isset($import['ignore_errors']) ? (Boolean) $import['ignore_errors'] : false, $file);
$this->import($import['resource'], null, isset($import['ignore_errors']) ? (bool) $import['ignore_errors'] : false, $file);
}
}
@ -131,7 +131,7 @@ class YamlFileLoader extends FileLoader
return;
} elseif (isset($service['alias'])) {
$public = !array_key_exists('public', $service) || (Boolean) $service['public'];
$public = !array_key_exists('public', $service) || (bool) $service['public'];
$this->container->setAlias($id, new Alias($service['alias'], $public));
return;

View File

@ -105,7 +105,7 @@ class ContainerAwareEventDispatcher extends EventDispatcher
public function hasListeners($eventName = null)
{
if (null === $eventName) {
return (Boolean) count($this->listenerIds) || (Boolean) count($this->listeners);
return (bool) count($this->listenerIds) || (bool) count($this->listeners);
}
if (isset($this->listenerIds[$eventName])) {

View File

@ -82,7 +82,7 @@ class EventDispatcher implements EventDispatcherInterface
*/
public function hasListeners($eventName = null)
{
return (Boolean) count($this->getListeners($eventName));
return (bool) count($this->getListeners($eventName));
}
/**

View File

@ -216,7 +216,7 @@ abstract class AbstractAdapter implements AdapterInterface
*/
public function ignoreUnreadableDirs($ignore = true)
{
$this->ignoreUnreadableDirs = (Boolean) $ignore;
$this->ignoreUnreadableDirs = (bool) $ignore;
return $this;
}

View File

@ -638,7 +638,7 @@ class Finder implements \IteratorAggregate, \Countable
*/
public function ignoreUnreadableDirs($ignore = true)
{
$this->ignoreUnreadableDirs = (Boolean) $ignore;
$this->ignoreUnreadableDirs = (bool) $ignore;
return $this;
}

View File

@ -45,7 +45,7 @@ class DateTimeToArrayTransformer extends BaseDateTimeTransformer
}
$this->fields = $fields;
$this->pad = (Boolean) $pad;
$this->pad = (bool) $pad;
}
/**

View File

@ -603,7 +603,7 @@ class FormConfigBuilder implements FormConfigBuilderInterface
throw new BadMethodCallException('FormConfigBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.');
}
$this->disabled = (Boolean) $disabled;
$this->disabled = (bool) $disabled;
return $this;
}
@ -631,7 +631,7 @@ class FormConfigBuilder implements FormConfigBuilderInterface
throw new BadMethodCallException('FormConfigBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.');
}
$this->errorBubbling = null === $errorBubbling ? null : (Boolean) $errorBubbling;
$this->errorBubbling = null === $errorBubbling ? null : (bool) $errorBubbling;
return $this;
}
@ -645,7 +645,7 @@ class FormConfigBuilder implements FormConfigBuilderInterface
throw new BadMethodCallException('FormConfigBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.');
}
$this->required = (Boolean) $required;
$this->required = (bool) $required;
return $this;
}
@ -855,7 +855,7 @@ class FormConfigBuilder implements FormConfigBuilderInterface
*/
public function setAutoInitialize($initialize)
{
$this->autoInitialize = (Boolean) $initialize;
$this->autoInitialize = (bool) $initialize;
return $this;
}

View File

@ -40,7 +40,7 @@ class MoneyTypeTest extends TypeTestCase
$form = $this->factory->create('money', null, array('currency' => 'JPY'));
$view = $form->createView();
$this->assertTrue((Boolean) strstr($view->vars['money_pattern'], '¥'));
$this->assertTrue((bool) strstr($view->vars['money_pattern'], '¥'));
}
// https://github.com/symfony/symfony/issues/5458

View File

@ -70,8 +70,8 @@ class Cookie
$this->domain = $domain;
$this->expire = $expire;
$this->path = empty($path) ? '/' : $path;
$this->secure = (Boolean) $secure;
$this->httpOnly = (Boolean) $httpOnly;
$this->secure = (bool) $secure;
$this->httpOnly = (bool) $httpOnly;
}
/**

View File

@ -95,7 +95,7 @@ class UploadedFile extends File
$this->mimeType = $mimeType ?: 'application/octet-stream';
$this->size = $size;
$this->error = $error ?: UPLOAD_ERR_OK;
$this->test = (Boolean) $test;
$this->test = (bool) $test;
parent::__construct($path, UPLOAD_ERR_OK === $this->error);
}

View File

@ -49,8 +49,8 @@ class ProfilerListener implements EventSubscriberInterface
{
$this->profiler = $profiler;
$this->matcher = $matcher;
$this->onlyException = (Boolean) $onlyException;
$this->onlyMasterRequests = (Boolean) $onlyMasterRequests;
$this->onlyException = (bool) $onlyException;
$this->onlyMasterRequests = (bool) $onlyMasterRequests;
$this->children = new \SplObjectStorage();
$this->profiles = array();
}

View File

@ -107,7 +107,7 @@ class Esi
return false;
}
return (Boolean) preg_match('#content="[^"]*ESI/1.0[^"]*"#', $control);
return (bool) preg_match('#content="[^"]*ESI/1.0[^"]*"#', $control);
}
/**

View File

@ -77,7 +77,7 @@ abstract class Kernel implements KernelInterface, TerminableInterface
public function __construct($environment, $debug)
{
$this->environment = $environment;
$this->debug = (Boolean) $debug;
$this->debug = (bool) $debug;
$this->booted = false;
$this->rootDir = $this->getRootDir();
$this->name = $this->getName();

View File

@ -59,7 +59,7 @@ abstract class PdoProfilerStorage implements ProfilerStorageInterface
$criteria = $criteria ? 'WHERE '.implode(' AND ', $criteria) : '';
$db = $this->initDb();
$tokens = $this->fetch($db, 'SELECT token, ip, method, url, time, parent FROM sf_profiler_data '.$criteria.' ORDER BY time DESC LIMIT '.((integer) $limit), $args);
$tokens = $this->fetch($db, 'SELECT token, ip, method, url, time, parent FROM sf_profiler_data '.$criteria.' ORDER BY time DESC LIMIT '.((int) $limit), $args);
$this->close($db);
return $tokens;

View File

@ -49,6 +49,6 @@ class KernelForTest extends Kernel
public function setIsBooted($value)
{
$this->booted = (Boolean) $value;
$this->booted = (bool) $value;
}
}

View File

@ -870,7 +870,7 @@ class NumberFormatter
*/
private function normalizeGroupingUsedValue($value)
{
return (int) (Boolean) (int) $value;
return (int) (bool) (int) $value;
}
/**

View File

@ -776,7 +776,7 @@ class Process
*/
public function setTty($tty)
{
$this->tty = (Boolean) $tty;
$this->tty = (bool) $tty;
return $this;
}
@ -928,7 +928,7 @@ class Process
*/
public function setEnhanceWindowsCompatibility($enhance)
{
$this->enhanceWindowsCompatibility = (Boolean) $enhance;
$this->enhanceWindowsCompatibility = (bool) $enhance;
return $this;
}
@ -956,7 +956,7 @@ class Process
*/
public function setEnhanceSigchildCompatibility($enhance)
{
$this->enhanceSigchildCompatibility = (Boolean) $enhance;
$this->enhanceSigchildCompatibility = (bool) $enhance;
return $this;
}

View File

@ -35,8 +35,8 @@ class ProcessPipes
public function __construct($useFiles, $ttyMode)
{
$this->useFiles = (Boolean) $useFiles;
$this->ttyMode = (Boolean) $ttyMode;
$this->useFiles = (bool) $useFiles;
$this->ttyMode = (bool) $ttyMode;
// Fix for PHP bug #51800: reading from STDOUT pipe hangs forever on Windows if the output is too big.
// Workaround for this problem is to use temporary files instead of pipes on Windows platform.
@ -180,10 +180,10 @@ class ProcessPipes
public function hasOpenHandles()
{
if (!$this->useFiles) {
return (Boolean) $this->pipes;
return (bool) $this->pipes;
}
return (Boolean) $this->pipes && (Boolean) $this->fileHandles;
return (bool) $this->pipes && (bool) $this->fileHandles;
}
/**

View File

@ -114,7 +114,7 @@ class UrlGenerator implements UrlGeneratorInterface, ConfigurableRequirementsInt
*/
public function setStrictRequirements($enabled)
{
$this->strictRequirements = null === $enabled ? null : (Boolean) $enabled;
$this->strictRequirements = null === $enabled ? null : (bool) $enabled;
}
/**

View File

@ -554,7 +554,7 @@ QUERY;
$oidCache[$oidLookupKey] = new ObjectIdentity($objectIdentifier, $classType);
}
$acl = new Acl((integer) $aclId, $oidCache[$oidLookupKey], $permissionGrantingStrategy, $emptyArray, !!$entriesInheriting);
$acl = new Acl((int) $aclId, $oidCache[$oidLookupKey], $permissionGrantingStrategy, $emptyArray, !!$entriesInheriting);
// keep a local, and global reference to this ACL
$loadedAcls[$classType][$objectIdentifier] = $acl;
@ -596,9 +596,9 @@ QUERY;
}
if (null === $fieldName) {
$loadedAces[$aceId] = new Entry((integer) $aceId, $acl, $sids[$key], $grantingStrategy, (integer) $mask, !!$granting, !!$auditFailure, !!$auditSuccess);
$loadedAces[$aceId] = new Entry((int) $aceId, $acl, $sids[$key], $grantingStrategy, (int) $mask, !!$granting, !!$auditFailure, !!$auditSuccess);
} else {
$loadedAces[$aceId] = new FieldEntry((integer) $aceId, $acl, $fieldName, $sids[$key], $grantingStrategy, (integer) $mask, !!$granting, !!$auditFailure, !!$auditSuccess);
$loadedAces[$aceId] = new FieldEntry((int) $aceId, $acl, $fieldName, $sids[$key], $grantingStrategy, (int) $mask, !!$granting, !!$auditFailure, !!$auditSuccess);
}
}
$ace = $loadedAces[$aceId];

View File

@ -49,7 +49,7 @@ class AuthenticationProviderManager implements AuthenticationManagerInterface
}
$this->providers = $providers;
$this->eraseCredentials = (Boolean) $eraseCredentials;
$this->eraseCredentials = (bool) $eraseCredentials;
}
public function setEventDispatcher(EventDispatcherInterface $dispatcher)

View File

@ -131,7 +131,7 @@ abstract class AbstractToken implements TokenInterface
*/
public function setAuthenticated($authenticated)
{
$this->authenticated = (Boolean) $authenticated;
$this->authenticated = (bool) $authenticated;
}
/**
@ -251,7 +251,7 @@ abstract class AbstractToken implements TokenInterface
}
if ($this->user instanceof EquatableInterface) {
return ! (Boolean) $this->user->isEqualTo($user);
return ! (bool) $this->user->isEqualTo($user);
}
if ($this->user->getPassword() !== $user->getPassword()) {

View File

@ -45,8 +45,8 @@ class AccessDecisionManager implements AccessDecisionManagerInterface
$this->voters = $voters;
$this->strategy = 'decide'.ucfirst($strategy);
$this->allowIfAllAbstainDecisions = (Boolean) $allowIfAllAbstainDecisions;
$this->allowIfEqualGrantedDeniedDecisions = (Boolean) $allowIfEqualGrantedDeniedDecisions;
$this->allowIfAllAbstainDecisions = (bool) $allowIfAllAbstainDecisions;
$this->allowIfEqualGrantedDeniedDecisions = (bool) $allowIfEqualGrantedDeniedDecisions;
}
/**

View File

@ -41,7 +41,7 @@ class FormAuthenticationEntryPoint implements AuthenticationEntryPointInterface
$this->httpKernel = $kernel;
$this->httpUtils = $httpUtils;
$this->loginPath = $loginPath;
$this->useForward = (Boolean) $useForward;
$this->useForward = (bool) $useForward;
}
/**

View File

@ -30,8 +30,8 @@ class StopwatchPeriod
*/
public function __construct($start, $end)
{
$this->start = (integer) $start;
$this->end = (integer) $end;
$this->start = (int) $start;
$this->end = (int) $end;
$this->memory = memory_get_usage(true);
}

View File

@ -177,6 +177,6 @@ class MoFileLoader extends ArrayLoader implements LoaderInterface
$result = unpack($isBigEndian ? 'N1' : 'V1', fread($stream, 4));
$result = current($result);
return (integer) substr($result, -8);
return (int) substr($result, -8);
}
}

View File

@ -134,7 +134,7 @@ class PoFileLoader extends ArrayLoader implements LoaderInterface
$item['ids']['plural'] = substr($line, 14, -1);
} elseif (substr($line, 0, 7) === 'msgstr[') {
$size = strpos($line, ']');
$item['translated'][(integer) substr($line, 7, 1)] = substr($line, $size + 3, -1);
$item['translated'][(int) substr($line, 7, 1)] = substr($line, $size + 3, -1);
}
}

View File

@ -159,7 +159,7 @@ class Inline
// array
$keys = array_keys($value);
if ((1 == count($keys) && '0' == $keys[0])
|| (count($keys) > 1 && array_reduce($keys, function ($v, $w) { return (integer) $v + $w; }, 0) == count($keys) * (count($keys) - 1) / 2)
|| (count($keys) > 1 && array_reduce($keys, function ($v, $w) { return (int) $v + $w; }, 0) == count($keys) * (count($keys) - 1) / 2)
) {
$output = array();
foreach ($value as $val) {