@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | */ |
| 76 | 76 | public function __construct(ContainerBuilder $container) |
| 77 | 77 | { |
| 78 | - if (!$container->isCompiled()) { |
|
| 78 | + if ( ! $container->isCompiled()) { |
|
| 79 | 79 | @\trigger_error('Dumping an uncompiled ContainerBuilder is deprecated since Symfony 3.3 and will not be supported anymore in 4.0. Compile the container beforehand.', \E_USER_DEPRECATED); |
| 80 | 80 | } |
| 81 | 81 | parent::__construct($container); |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | $this->hotPathTag = $options['hot_path_tag']; |
| 112 | 112 | $this->inlineRequires = $options['inline_class_loader_parameter'] && $this->container->hasParameter($options['inline_class_loader_parameter']) && $this->container->getParameter($options['inline_class_loader_parameter']); |
| 113 | 113 | if (0 !== \strpos($baseClass = $options['base_class'], '\\') && 'Container' !== $baseClass) { |
| 114 | - $baseClass = \sprintf('%s\\%s', $options['namespace'] ? '\\' . $options['namespace'] : '', $baseClass); |
|
| 114 | + $baseClass = \sprintf('%s\\%s', $options['namespace'] ? '\\'.$options['namespace'] : '', $baseClass); |
|
| 115 | 115 | $baseClassWithNamespace = $baseClass; |
| 116 | 116 | } elseif ('Container' === $baseClass) { |
| 117 | 117 | $baseClassWithNamespace = Container::class; |
@@ -130,21 +130,21 @@ discard block |
||
| 130 | 130 | throw new ServiceCircularReferenceException($e->getServiceId(), $path); |
| 131 | 131 | } |
| 132 | 132 | } |
| 133 | - (new AnalyzeServiceReferencesPass(\false, !$this->getProxyDumper() instanceof NullDumper))->process($this->container); |
|
| 133 | + (new AnalyzeServiceReferencesPass(\false, ! $this->getProxyDumper() instanceof NullDumper))->process($this->container); |
|
| 134 | 134 | $checkedNodes = []; |
| 135 | 135 | $this->circularReferences = []; |
| 136 | 136 | foreach ($this->container->getCompiler()->getServiceReferenceGraph()->getNodes() as $id => $node) { |
| 137 | - if (!$node->getValue() instanceof Definition) { |
|
| 137 | + if ( ! $node->getValue() instanceof Definition) { |
|
| 138 | 138 | continue; |
| 139 | 139 | } |
| 140 | - if (!isset($checkedNodes[$id])) { |
|
| 140 | + if ( ! isset($checkedNodes[$id])) { |
|
| 141 | 141 | $this->analyzeCircularReferences($id, $node->getOutEdges(), $checkedNodes); |
| 142 | 142 | } |
| 143 | 143 | } |
| 144 | 144 | $this->container->getCompiler()->getServiceReferenceGraph()->clear(); |
| 145 | 145 | $checkedNodes = []; |
| 146 | 146 | $this->docStar = $options['debug'] ? '*' : ''; |
| 147 | - if (!empty($options['file']) && \is_dir($dir = \dirname($options['file']))) { |
|
| 147 | + if ( ! empty($options['file']) && \is_dir($dir = \dirname($options['file']))) { |
|
| 148 | 148 | // Build a regexp where the first root dirs are mandatory, |
| 149 | 149 | // but every other sub-dir is optional up to the full path in $dir |
| 150 | 150 | // Mandate at least 1 root dir and not more than 5 optional dirs. |
@@ -155,15 +155,15 @@ discard block |
||
| 155 | 155 | $lastOptionalDir = $i > 8 ? $i - 5 : 2 + (int) ('\\' === \DIRECTORY_SEPARATOR); |
| 156 | 156 | $this->targetDirMaxMatches = $i - $lastOptionalDir; |
| 157 | 157 | while (--$i >= $lastOptionalDir) { |
| 158 | - $regex = \sprintf('(%s%s)?', \preg_quote(\DIRECTORY_SEPARATOR . $dir[$i], '#'), $regex); |
|
| 158 | + $regex = \sprintf('(%s%s)?', \preg_quote(\DIRECTORY_SEPARATOR.$dir[$i], '#'), $regex); |
|
| 159 | 159 | } |
| 160 | 160 | do { |
| 161 | - $regex = \preg_quote(\DIRECTORY_SEPARATOR . $dir[$i], '#') . $regex; |
|
| 161 | + $regex = \preg_quote(\DIRECTORY_SEPARATOR.$dir[$i], '#').$regex; |
|
| 162 | 162 | } while (0 < --$i); |
| 163 | - $this->targetDirRegex = '#(^|file://|[:;, \\|\\r\\n])' . \preg_quote($dir[0], '#') . $regex . '#'; |
|
| 163 | + $this->targetDirRegex = '#(^|file://|[:;, \\|\\r\\n])'.\preg_quote($dir[0], '#').$regex.'#'; |
|
| 164 | 164 | } |
| 165 | 165 | } |
| 166 | - $code = $this->startClass($options['class'], $baseClass, $baseClassWithNamespace) . $this->addServices() . $this->addDefaultParametersMethod() . $this->endClass(); |
|
| 166 | + $code = $this->startClass($options['class'], $baseClass, $baseClassWithNamespace).$this->addServices().$this->addDefaultParametersMethod().$this->endClass(); |
|
| 167 | 167 | if ($this->asFiles) { |
| 168 | 168 | $fileStart = <<<EOF |
| 169 | 169 | <?php |
@@ -178,28 +178,28 @@ discard block |
||
| 178 | 178 | \sort($ids); |
| 179 | 179 | $c = "<?php\n\nreturn [\n"; |
| 180 | 180 | foreach ($ids as $id) { |
| 181 | - $c .= ' ' . $this->doExport($id) . " => true,\n"; |
|
| 181 | + $c .= ' '.$this->doExport($id)." => true,\n"; |
|
| 182 | 182 | } |
| 183 | - $files['removed-ids.php'] = $c . "];\n"; |
|
| 183 | + $files['removed-ids.php'] = $c."];\n"; |
|
| 184 | 184 | } |
| 185 | 185 | foreach ($this->generateServiceFiles() as $file => $c) { |
| 186 | - $files[$file] = $fileStart . $c; |
|
| 186 | + $files[$file] = $fileStart.$c; |
|
| 187 | 187 | } |
| 188 | 188 | foreach ($this->generateProxyClasses() as $file => $c) { |
| 189 | - $files[$file] = "<?php\n" . $c; |
|
| 189 | + $files[$file] = "<?php\n".$c; |
|
| 190 | 190 | } |
| 191 | - $files[$options['class'] . '.php'] = $code; |
|
| 191 | + $files[$options['class'].'.php'] = $code; |
|
| 192 | 192 | $hash = \ucfirst(\strtr(ContainerBuilder::hash($files), '._', 'xx')); |
| 193 | 193 | $code = []; |
| 194 | 194 | foreach ($files as $file => $c) { |
| 195 | 195 | $code["Container{$hash}/{$file}"] = $c; |
| 196 | 196 | } |
| 197 | 197 | \array_pop($code); |
| 198 | - $code["Container{$hash}/{$options['class']}.php"] = \substr_replace($files[$options['class'] . '.php'], "<?php\n\nnamespace Container{$hash};\n", 0, 6); |
|
| 198 | + $code["Container{$hash}/{$options['class']}.php"] = \substr_replace($files[$options['class'].'.php'], "<?php\n\nnamespace Container{$hash};\n", 0, 6); |
|
| 199 | 199 | $namespaceLine = $this->namespace ? "\nnamespace {$this->namespace};\n" : ''; |
| 200 | 200 | $time = $options['build_time']; |
| 201 | - $id = \hash('crc32', $hash . $time); |
|
| 202 | - $code[$options['class'] . '.php'] = <<<EOF |
|
| 201 | + $id = \hash('crc32', $hash.$time); |
|
| 202 | + $code[$options['class'].'.php'] = <<<EOF |
|
| 203 | 203 | <?php |
| 204 | 204 | {$namespaceLine} |
| 205 | 205 | // This file has been auto-generated by the Symfony Dependency Injection Component for internal use. |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | $this->circularReferences = []; |
| 234 | 234 | $unusedEnvs = []; |
| 235 | 235 | foreach ($this->container->getEnvCounters() as $env => $use) { |
| 236 | - if (!$use) { |
|
| 236 | + if ( ! $use) { |
|
| 237 | 237 | $unusedEnvs[] = $env; |
| 238 | 238 | } |
| 239 | 239 | } |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | */ |
| 250 | 250 | private function getProxyDumper() |
| 251 | 251 | { |
| 252 | - if (!$this->proxyDumper) { |
|
| 252 | + if ( ! $this->proxyDumper) { |
|
| 253 | 253 | $this->proxyDumper = new NullDumper(); |
| 254 | 254 | } |
| 255 | 255 | return $this->proxyDumper; |
@@ -261,11 +261,11 @@ discard block |
||
| 261 | 261 | foreach ($edges as $edge) { |
| 262 | 262 | $node = $edge->getDestNode(); |
| 263 | 263 | $id = $node->getId(); |
| 264 | - if (!$node->getValue() instanceof Definition || $sourceId === $id || $edge->isLazy() || $edge->isWeak()) { |
|
| 264 | + if ( ! $node->getValue() instanceof Definition || $sourceId === $id || $edge->isLazy() || $edge->isWeak()) { |
|
| 265 | 265 | // no-op |
| 266 | 266 | } elseif (isset($currentPath[$id])) { |
| 267 | 267 | $this->addCircularReferences($id, $currentPath, $edge->isReferencedByConstructor()); |
| 268 | - } elseif (!isset($checkedNodes[$id])) { |
|
| 268 | + } elseif ( ! isset($checkedNodes[$id])) { |
|
| 269 | 269 | $this->analyzeCircularReferences($id, $node->getOutEdges(), $checkedNodes, $currentPath, $edge->isReferencedByConstructor()); |
| 270 | 270 | } elseif (isset($this->circularReferences[$id])) { |
| 271 | 271 | $this->connectCircularReferences($id, $currentPath, $edge->isReferencedByConstructor()); |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | foreach ($this->circularReferences[$sourceId] as $id => $byConstructor) { |
| 280 | 280 | if (isset($currentPath[$id])) { |
| 281 | 281 | $this->addCircularReferences($id, $currentPath, $byConstructor); |
| 282 | - } elseif (!isset($subPath[$id]) && isset($this->circularReferences[$id])) { |
|
| 282 | + } elseif ( ! isset($subPath[$id]) && isset($this->circularReferences[$id])) { |
|
| 283 | 283 | $this->connectCircularReferences($id, $currentPath, $byConstructor, $subPath); |
| 284 | 284 | } |
| 285 | 285 | } |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | if (isset($lineage[$class])) { |
| 310 | 310 | return; |
| 311 | 311 | } |
| 312 | - if (!($r = $this->container->getReflectionClass($class, \false))) { |
|
| 312 | + if ( ! ($r = $this->container->getReflectionClass($class, \false))) { |
|
| 313 | 313 | return; |
| 314 | 314 | } |
| 315 | 315 | if ($this->container instanceof $class) { |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | if (') : eval()\'d code' === \substr($file, -17)) { |
| 320 | 320 | $file = \substr($file, 0, \strrpos($file, '(', -17)); |
| 321 | 321 | } |
| 322 | - if (!$file || $this->doExport($file) === ($exportedFile = $this->export($file))) { |
|
| 322 | + if ( ! $file || $this->doExport($file) === ($exportedFile = $this->export($file))) { |
|
| 323 | 323 | return; |
| 324 | 324 | } |
| 325 | 325 | if ($parent = $r->getParentClass()) { |
@@ -341,7 +341,7 @@ discard block |
||
| 341 | 341 | $proxyDumper = $this->getProxyDumper(); |
| 342 | 342 | \ksort($definitions); |
| 343 | 343 | foreach ($definitions as $definition) { |
| 344 | - if (!$proxyDumper->isProxyCandidate($definition)) { |
|
| 344 | + if ( ! $proxyDumper->isProxyCandidate($definition)) { |
|
| 345 | 345 | continue; |
| 346 | 346 | } |
| 347 | 347 | if (isset($alreadyGenerated[$class = $definition->getClass()])) { |
@@ -350,11 +350,11 @@ discard block |
||
| 350 | 350 | $alreadyGenerated[$class] = \true; |
| 351 | 351 | // register class' reflector for resource tracking |
| 352 | 352 | $this->container->getReflectionClass($class); |
| 353 | - if ("\n" === ($proxyCode = "\n" . $proxyDumper->getProxyCode($definition))) { |
|
| 353 | + if ("\n" === ($proxyCode = "\n".$proxyDumper->getProxyCode($definition))) { |
|
| 354 | 354 | continue; |
| 355 | 355 | } |
| 356 | 356 | if ($strip) { |
| 357 | - $proxyCode = "<?php\n" . $proxyCode; |
|
| 357 | + $proxyCode = "<?php\n".$proxyCode; |
|
| 358 | 358 | $proxyCode = \substr(Kernel::stripComments($proxyCode), 5); |
| 359 | 359 | } |
| 360 | 360 | (yield \sprintf('%s.php', \explode(' ', $proxyCode, 3)[1]) => $proxyCode); |
@@ -368,10 +368,10 @@ discard block |
||
| 368 | 368 | private function addServiceInclude($cId, Definition $definition) |
| 369 | 369 | { |
| 370 | 370 | $code = ''; |
| 371 | - if ($this->inlineRequires && !$this->isHotPath($definition)) { |
|
| 371 | + if ($this->inlineRequires && ! $this->isHotPath($definition)) { |
|
| 372 | 372 | $lineage = []; |
| 373 | 373 | foreach ($this->inlinedDefinitions as $def) { |
| 374 | - if (!$def->isDeprecated() && \is_string($class = \is_array($factory = $def->getFactory()) && \is_string($factory[0]) ? $factory[0] : $def->getClass())) { |
|
| 374 | + if ( ! $def->isDeprecated() && \is_string($class = \is_array($factory = $def->getFactory()) && \is_string($factory[0]) ? $factory[0] : $def->getClass())) { |
|
| 375 | 375 | $this->collectLineage($class, $lineage); |
| 376 | 376 | } |
| 377 | 377 | } |
@@ -408,14 +408,14 @@ discard block |
||
| 408 | 408 | private function addServiceInstance($id, Definition $definition, $isSimpleInstance) |
| 409 | 409 | { |
| 410 | 410 | $class = $this->dumpValue($definition->getClass()); |
| 411 | - if (0 === \strpos($class, "'") && \false === \strpos($class, '$') && !\preg_match('/^\'(?:\\\\{2})?[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*(?:\\\\{2}[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*)*\'$/', $class)) { |
|
| 411 | + if (0 === \strpos($class, "'") && \false === \strpos($class, '$') && ! \preg_match('/^\'(?:\\\\{2})?[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*(?:\\\\{2}[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*)*\'$/', $class)) { |
|
| 412 | 412 | throw new InvalidArgumentException(\sprintf('"%s" is not a valid class name for the "%s" service.', $class, $id)); |
| 413 | 413 | } |
| 414 | 414 | $isProxyCandidate = $this->getProxyDumper()->isProxyCandidate($definition); |
| 415 | 415 | $instantiation = ''; |
| 416 | - if (!$isProxyCandidate && $definition->isShared()) { |
|
| 416 | + if ( ! $isProxyCandidate && $definition->isShared()) { |
|
| 417 | 417 | $instantiation = \sprintf('$this->services[%s] = %s', $this->doExport($id), $isSimpleInstance ? '' : '$instance'); |
| 418 | - } elseif (!$isSimpleInstance) { |
|
| 418 | + } elseif ( ! $isSimpleInstance) { |
|
| 419 | 419 | $instantiation = '$instance'; |
| 420 | 420 | } |
| 421 | 421 | $return = ''; |
@@ -440,7 +440,7 @@ discard block |
||
| 440 | 440 | return \false; |
| 441 | 441 | } |
| 442 | 442 | foreach ($definition->getArguments() as $arg) { |
| 443 | - if (!$arg || $arg instanceof Parameter) { |
|
| 443 | + if ( ! $arg || $arg instanceof Parameter) { |
|
| 444 | 444 | continue; |
| 445 | 445 | } |
| 446 | 446 | if (\is_array($arg) && 3 >= \count($arg)) { |
@@ -448,19 +448,19 @@ discard block |
||
| 448 | 448 | if ($this->dumpValue($k) !== $this->dumpValue($k, \false)) { |
| 449 | 449 | return \false; |
| 450 | 450 | } |
| 451 | - if (!$v || $v instanceof Parameter) { |
|
| 451 | + if ( ! $v || $v instanceof Parameter) { |
|
| 452 | 452 | continue; |
| 453 | 453 | } |
| 454 | 454 | if ($v instanceof Reference && $this->container->has($id = (string) $v) && $this->container->findDefinition($id)->isSynthetic()) { |
| 455 | 455 | continue; |
| 456 | 456 | } |
| 457 | - if (!\is_scalar($v) || $this->dumpValue($v) !== $this->dumpValue($v, \false)) { |
|
| 457 | + if ( ! \is_scalar($v) || $this->dumpValue($v) !== $this->dumpValue($v, \false)) { |
|
| 458 | 458 | return \false; |
| 459 | 459 | } |
| 460 | 460 | } |
| 461 | 461 | } elseif ($arg instanceof Reference && $this->container->has($id = (string) $arg) && $this->container->findDefinition($id)->isSynthetic()) { |
| 462 | 462 | continue; |
| 463 | - } elseif (!\is_scalar($arg) || $this->dumpValue($arg) !== $this->dumpValue($arg, \false)) { |
|
| 463 | + } elseif ( ! \is_scalar($arg) || $this->dumpValue($arg) !== $this->dumpValue($arg, \false)) { |
|
| 464 | 464 | return \false; |
| 465 | 465 | } |
| 466 | 466 | } |
@@ -502,7 +502,7 @@ discard block |
||
| 502 | 502 | */ |
| 503 | 503 | private function addServiceConfigurator(Definition $definition, $variableName = 'instance') |
| 504 | 504 | { |
| 505 | - if (!($callable = $definition->getConfigurator())) { |
|
| 505 | + if ( ! ($callable = $definition->getConfigurator())) { |
|
| 506 | 506 | return ''; |
| 507 | 507 | } |
| 508 | 508 | if (\is_array($callable)) { |
@@ -537,7 +537,7 @@ discard block |
||
| 537 | 537 | $this->referenceVariables[$id] = new Variable('instance'); |
| 538 | 538 | $return = []; |
| 539 | 539 | if ($class = $definition->getClass()) { |
| 540 | - $class = $class instanceof Parameter ? '%' . $class . '%' : $this->container->resolveEnvPlaceholders($class); |
|
| 540 | + $class = $class instanceof Parameter ? '%'.$class.'%' : $this->container->resolveEnvPlaceholders($class); |
|
| 541 | 541 | $return[] = \sprintf(0 === \strpos($class, '%') ? '@return object A %1$s instance' : '@return \\%s', \ltrim($class, '\\')); |
| 542 | 542 | } elseif ($definition->getFactory()) { |
| 543 | 543 | $factory = $definition->getFactory(); |
@@ -545,7 +545,7 @@ discard block |
||
| 545 | 545 | $return[] = \sprintf('@return object An instance returned by %s()', $factory); |
| 546 | 546 | } elseif (\is_array($factory) && (\is_string($factory[0]) || $factory[0] instanceof Definition || $factory[0] instanceof Reference)) { |
| 547 | 547 | $class = $factory[0] instanceof Definition ? $factory[0]->getClass() : (string) $factory[0]; |
| 548 | - $class = $class instanceof Parameter ? '%' . $class . '%' : $this->container->resolveEnvPlaceholders($class); |
|
| 548 | + $class = $class instanceof Parameter ? '%'.$class.'%' : $this->container->resolveEnvPlaceholders($class); |
|
| 549 | 549 | $return[] = \sprintf('@return object An instance returned by %s::%s()', $class, $factory[1]); |
| 550 | 550 | } |
| 551 | 551 | } |
@@ -565,10 +565,10 @@ discard block |
||
| 565 | 565 | } else { |
| 566 | 566 | $lazyInitialization = ''; |
| 567 | 567 | } |
| 568 | - $asFile = $this->asFiles && $definition->isShared() && !$this->isHotPath($definition); |
|
| 568 | + $asFile = $this->asFiles && $definition->isShared() && ! $this->isHotPath($definition); |
|
| 569 | 569 | $methodName = $this->generateMethodName($id); |
| 570 | 570 | if ($asFile) { |
| 571 | - $file = $methodName . '.php'; |
|
| 571 | + $file = $methodName.'.php'; |
|
| 572 | 572 | $code = " // Returns the {$public} '{$id}'{$shared}{$autowired} service.\n\n"; |
| 573 | 573 | } else { |
| 574 | 574 | $code = <<<EOF |
@@ -578,7 +578,7 @@ discard block |
||
| 578 | 578 | * |
| 579 | 579 | * {$return} |
| 580 | 580 | EOF; |
| 581 | - $code = \str_replace('*/', ' ', $code) . <<<EOF |
|
| 581 | + $code = \str_replace('*/', ' ', $code).<<<EOF |
|
| 582 | 582 | |
| 583 | 583 | */ |
| 584 | 584 | protected function {$methodName}({$lazyInitialization}) |
@@ -598,7 +598,7 @@ discard block |
||
| 598 | 598 | } |
| 599 | 599 | $code .= $this->addInlineService($id, $definition); |
| 600 | 600 | if ($asFile) { |
| 601 | - $code = \implode("\n", \array_map(function ($line) { |
|
| 601 | + $code = \implode("\n", \array_map(function($line) { |
|
| 602 | 602 | return $line ? \substr($line, 8) : $line; |
| 603 | 603 | }, \explode("\n", $code))); |
| 604 | 604 | } else { |
@@ -634,20 +634,20 @@ discard block |
||
| 634 | 634 | if ('service_container' === $targetId || isset($this->referenceVariables[$targetId])) { |
| 635 | 635 | return ''; |
| 636 | 636 | } |
| 637 | - $hasSelfRef = isset($this->circularReferences[$id][$targetId]) && !isset($this->definitionVariables[$definition]); |
|
| 638 | - if ($hasSelfRef && !$forConstructor && !($forConstructor = !$this->circularReferences[$id][$targetId])) { |
|
| 637 | + $hasSelfRef = isset($this->circularReferences[$id][$targetId]) && ! isset($this->definitionVariables[$definition]); |
|
| 638 | + if ($hasSelfRef && ! $forConstructor && ! ($forConstructor = ! $this->circularReferences[$id][$targetId])) { |
|
| 639 | 639 | $code = $this->addInlineService($id, $definition, $definition); |
| 640 | 640 | } else { |
| 641 | 641 | $code = ''; |
| 642 | 642 | } |
| 643 | - if (isset($this->referenceVariables[$targetId]) || 2 > $callCount && (!$hasSelfRef || !$forConstructor)) { |
|
| 643 | + if (isset($this->referenceVariables[$targetId]) || 2 > $callCount && ( ! $hasSelfRef || ! $forConstructor)) { |
|
| 644 | 644 | return $code; |
| 645 | 645 | } |
| 646 | 646 | $name = $this->getNextVariableName(); |
| 647 | 647 | $this->referenceVariables[$targetId] = new Variable($name); |
| 648 | 648 | $reference = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE >= $behavior ? new Reference($targetId, $behavior) : null; |
| 649 | 649 | $code .= \sprintf(" \$%s = %s;\n", $name, $this->getServiceCall($targetId, $reference)); |
| 650 | - if (!$hasSelfRef || !$forConstructor) { |
|
| 650 | + if ( ! $hasSelfRef || ! $forConstructor) { |
|
| 651 | 651 | return $code; |
| 652 | 652 | } |
| 653 | 653 | $code .= \sprintf(<<<'EOTXT' |
@@ -665,7 +665,7 @@ discard block |
||
| 665 | 665 | $code = ''; |
| 666 | 666 | if ($isSimpleInstance = $isRootInstance = null === $inlineDef) { |
| 667 | 667 | foreach ($this->serviceCalls as $targetId => list($callCount, $behavior, $byConstructor)) { |
| 668 | - if ($byConstructor && isset($this->circularReferences[$id][$targetId]) && !$this->circularReferences[$id][$targetId]) { |
|
| 668 | + if ($byConstructor && isset($this->circularReferences[$id][$targetId]) && ! $this->circularReferences[$id][$targetId]) { |
|
| 669 | 669 | $code .= $this->addInlineReference($id, $definition, $targetId, $forConstructor); |
| 670 | 670 | } |
| 671 | 671 | } |
@@ -689,10 +689,10 @@ discard block |
||
| 689 | 689 | if ('instance' === $name) { |
| 690 | 690 | $code .= $this->addServiceInstance($id, $definition, $isSimpleInstance); |
| 691 | 691 | } else { |
| 692 | - $code .= $this->addNewInstance($inlineDef, '$' . $name, ' = ', $id); |
|
| 692 | + $code .= $this->addNewInstance($inlineDef, '$'.$name, ' = ', $id); |
|
| 693 | 693 | } |
| 694 | 694 | if ('' !== ($inline = $this->addInlineVariables($id, $definition, $arguments, \false))) { |
| 695 | - $code .= "\n" . $inline . "\n"; |
|
| 695 | + $code .= "\n".$inline."\n"; |
|
| 696 | 696 | } elseif ($arguments && 'instance' === $name) { |
| 697 | 697 | $code .= "\n"; |
| 698 | 698 | } |
@@ -700,7 +700,7 @@ discard block |
||
| 700 | 700 | $code .= $this->addServiceMethodCalls($inlineDef, $name); |
| 701 | 701 | $code .= $this->addServiceConfigurator($inlineDef, $name); |
| 702 | 702 | } |
| 703 | - if ($isRootInstance && !$isSimpleInstance) { |
|
| 703 | + if ($isRootInstance && ! $isSimpleInstance) { |
|
| 704 | 704 | $code .= "\n return \$instance;\n"; |
| 705 | 705 | } |
| 706 | 706 | return $code; |
@@ -716,7 +716,7 @@ discard block |
||
| 716 | 716 | $definitions = $this->container->getDefinitions(); |
| 717 | 717 | \ksort($definitions); |
| 718 | 718 | foreach ($definitions as $id => $definition) { |
| 719 | - if ($definition->isSynthetic() || $this->asFiles && $definition->isShared() && !$this->isHotPath($definition)) { |
|
| 719 | + if ($definition->isSynthetic() || $this->asFiles && $definition->isShared() && ! $this->isHotPath($definition)) { |
|
| 720 | 720 | continue; |
| 721 | 721 | } |
| 722 | 722 | if ($definition->isPublic()) { |
@@ -725,14 +725,14 @@ discard block |
||
| 725 | 725 | $privateServices .= $this->addService($id, $definition); |
| 726 | 726 | } |
| 727 | 727 | } |
| 728 | - return $publicServices . $privateServices; |
|
| 728 | + return $publicServices.$privateServices; |
|
| 729 | 729 | } |
| 730 | 730 | private function generateServiceFiles() |
| 731 | 731 | { |
| 732 | 732 | $definitions = $this->container->getDefinitions(); |
| 733 | 733 | \ksort($definitions); |
| 734 | 734 | foreach ($definitions as $id => $definition) { |
| 735 | - if (!$definition->isSynthetic() && $definition->isShared() && !$this->isHotPath($definition)) { |
|
| 735 | + if ( ! $definition->isSynthetic() && $definition->isShared() && ! $this->isHotPath($definition)) { |
|
| 736 | 736 | $code = $this->addService($id, $definition, $file); |
| 737 | 737 | (yield $file => $code); |
| 738 | 738 | } |
@@ -741,7 +741,7 @@ discard block |
||
| 741 | 741 | private function addNewInstance(Definition $definition, $return, $instantiation, $id) |
| 742 | 742 | { |
| 743 | 743 | $class = $this->dumpValue($definition->getClass()); |
| 744 | - $return = ' ' . $return . $instantiation; |
|
| 744 | + $return = ' '.$return.$instantiation; |
|
| 745 | 745 | $arguments = []; |
| 746 | 746 | foreach ($definition->getArguments() as $value) { |
| 747 | 747 | $arguments[] = $this->dumpValue($value); |
@@ -749,11 +749,11 @@ discard block |
||
| 749 | 749 | if (null !== $definition->getFactory()) { |
| 750 | 750 | $callable = $definition->getFactory(); |
| 751 | 751 | if (\is_array($callable)) { |
| 752 | - if (!\preg_match('/^[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*$/', $callable[1])) { |
|
| 752 | + if ( ! \preg_match('/^[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*$/', $callable[1])) { |
|
| 753 | 753 | throw new RuntimeException(\sprintf('Cannot dump definition because of invalid factory method (%s).', $callable[1] ?: 'n/a')); |
| 754 | 754 | } |
| 755 | 755 | if ($callable[0] instanceof Reference || $callable[0] instanceof Definition && $this->definitionVariables->contains($callable[0])) { |
| 756 | - return $return . \sprintf("%s->%s(%s);\n", $this->dumpValue($callable[0]), $callable[1], $arguments ? \implode(', ', $arguments) : ''); |
|
| 756 | + return $return.\sprintf("%s->%s(%s);\n", $this->dumpValue($callable[0]), $callable[1], $arguments ? \implode(', ', $arguments) : ''); |
|
| 757 | 757 | } |
| 758 | 758 | $class = $this->dumpValue($callable[0]); |
| 759 | 759 | // If the class is a string we can optimize call_user_func away |
@@ -761,19 +761,19 @@ discard block |
||
| 761 | 761 | if ("''" === $class) { |
| 762 | 762 | throw new RuntimeException(\sprintf('Cannot dump definition: The "%s" service is defined to be created by a factory but is missing the service reference, did you forget to define the factory service id or class?', $id)); |
| 763 | 763 | } |
| 764 | - return $return . \sprintf("%s::%s(%s);\n", $this->dumpLiteralClass($class), $callable[1], $arguments ? \implode(', ', $arguments) : ''); |
|
| 764 | + return $return.\sprintf("%s::%s(%s);\n", $this->dumpLiteralClass($class), $callable[1], $arguments ? \implode(', ', $arguments) : ''); |
|
| 765 | 765 | } |
| 766 | 766 | if (0 === \strpos($class, 'new ')) { |
| 767 | - return $return . \sprintf("(%s)->%s(%s);\n", $class, $callable[1], $arguments ? \implode(', ', $arguments) : ''); |
|
| 767 | + return $return.\sprintf("(%s)->%s(%s);\n", $class, $callable[1], $arguments ? \implode(', ', $arguments) : ''); |
|
| 768 | 768 | } |
| 769 | - return $return . \sprintf("\\call_user_func([%s, '%s']%s);\n", $class, $callable[1], $arguments ? ', ' . \implode(', ', $arguments) : ''); |
|
| 769 | + return $return.\sprintf("\\call_user_func([%s, '%s']%s);\n", $class, $callable[1], $arguments ? ', '.\implode(', ', $arguments) : ''); |
|
| 770 | 770 | } |
| 771 | - return $return . \sprintf("%s(%s);\n", $this->dumpLiteralClass($this->dumpValue($callable)), $arguments ? \implode(', ', $arguments) : ''); |
|
| 771 | + return $return.\sprintf("%s(%s);\n", $this->dumpLiteralClass($this->dumpValue($callable)), $arguments ? \implode(', ', $arguments) : ''); |
|
| 772 | 772 | } |
| 773 | 773 | if (\false !== \strpos($class, '$')) { |
| 774 | 774 | return \sprintf(" \$class = %s;\n\n%snew \$class(%s);\n", $class, $return, \implode(', ', $arguments)); |
| 775 | 775 | } |
| 776 | - return $return . \sprintf("new %s(%s);\n", $this->dumpLiteralClass($class), \implode(', ', $arguments)); |
|
| 776 | + return $return.\sprintf("new %s(%s);\n", $this->dumpLiteralClass($class), \implode(', ', $arguments)); |
|
| 777 | 777 | } |
| 778 | 778 | /** |
| 779 | 779 | * Adds the class headers. |
@@ -787,7 +787,7 @@ discard block |
||
| 787 | 787 | private function startClass($class, $baseClass, $baseClassWithNamespace) |
| 788 | 788 | { |
| 789 | 789 | $bagClass = $this->container->isCompiled() ? 'use Wordlift\Modules\Plugin_Installer_Dependencies\\Symfony\\Component\\DependencyInjection\\ParameterBag\\FrozenParameterBag;' : 'use Wordlift\Modules\Plugin_Installer_Dependencies\\Symfony\\Component\\DependencyInjection\\ParameterBag\\ParameterBag;'; |
| 790 | - $namespaceLine = !$this->asFiles && $this->namespace ? "\nnamespace {$this->namespace};\n" : ''; |
|
| 790 | + $namespaceLine = ! $this->asFiles && $this->namespace ? "\nnamespace {$this->namespace};\n" : ''; |
|
| 791 | 791 | $code = <<<EOF |
| 792 | 792 | <?php |
| 793 | 793 | {$namespaceLine} |
@@ -892,13 +892,13 @@ discard block |
||
| 892 | 892 | } |
| 893 | 893 | $proxyDumper = $this->getProxyDumper(); |
| 894 | 894 | foreach ($this->container->getDefinitions() as $definition) { |
| 895 | - if (!$proxyDumper->isProxyCandidate($definition)) { |
|
| 895 | + if ( ! $proxyDumper->isProxyCandidate($definition)) { |
|
| 896 | 896 | continue; |
| 897 | 897 | } |
| 898 | 898 | if ($this->asFiles) { |
| 899 | 899 | $proxyLoader = '$this->load("{$class}.php")'; |
| 900 | 900 | } elseif ($this->namespace) { |
| 901 | - $proxyLoader = 'class_alias("' . $this->namespace . '\\\\{$class}", $class, false)'; |
|
| 901 | + $proxyLoader = 'class_alias("'.$this->namespace.'\\\\{$class}", $class, false)'; |
|
| 902 | 902 | } else { |
| 903 | 903 | $proxyLoader = ''; |
| 904 | 904 | } |
@@ -929,10 +929,10 @@ discard block |
||
| 929 | 929 | \ksort($normalizedIds); |
| 930 | 930 | foreach ($normalizedIds as $id => $normalizedId) { |
| 931 | 931 | if ($this->container->has($normalizedId)) { |
| 932 | - $code .= ' ' . $this->doExport($id) . ' => ' . $this->doExport($normalizedId) . ",\n"; |
|
| 932 | + $code .= ' '.$this->doExport($id).' => '.$this->doExport($normalizedId).",\n"; |
|
| 933 | 933 | } |
| 934 | 934 | } |
| 935 | - return $code ? " \$this->normalizedIds = [\n" . $code . " ];\n" : ''; |
|
| 935 | + return $code ? " \$this->normalizedIds = [\n".$code." ];\n" : ''; |
|
| 936 | 936 | } |
| 937 | 937 | /** |
| 938 | 938 | * Adds the syntheticIds definition. |
@@ -946,7 +946,7 @@ discard block |
||
| 946 | 946 | \ksort($definitions); |
| 947 | 947 | foreach ($definitions as $id => $definition) { |
| 948 | 948 | if ($definition->isSynthetic() && 'service_container' !== $id) { |
| 949 | - $code .= ' ' . $this->doExport($id) . " => true,\n"; |
|
| 949 | + $code .= ' '.$this->doExport($id)." => true,\n"; |
|
| 950 | 950 | } |
| 951 | 951 | } |
| 952 | 952 | return $code ? " \$this->syntheticIds = [\n{$code} ];\n" : ''; |
@@ -958,7 +958,7 @@ discard block |
||
| 958 | 958 | */ |
| 959 | 959 | private function addRemovedIds() |
| 960 | 960 | { |
| 961 | - if (!($ids = $this->container->getRemovedIds())) { |
|
| 961 | + if ( ! ($ids = $this->container->getRemovedIds())) { |
|
| 962 | 962 | return ''; |
| 963 | 963 | } |
| 964 | 964 | if ($this->asFiles) { |
@@ -971,7 +971,7 @@ discard block |
||
| 971 | 971 | if (\preg_match('/^\\d+_[^~]++~[._a-zA-Z\\d]{7}$/', $id)) { |
| 972 | 972 | continue; |
| 973 | 973 | } |
| 974 | - $code .= ' ' . $this->doExport($id) . " => true,\n"; |
|
| 974 | + $code .= ' '.$this->doExport($id)." => true,\n"; |
|
| 975 | 975 | } |
| 976 | 976 | $code = "[\n{$code} ]"; |
| 977 | 977 | } |
@@ -995,8 +995,8 @@ discard block |
||
| 995 | 995 | $definitions = $this->container->getDefinitions(); |
| 996 | 996 | \ksort($definitions); |
| 997 | 997 | foreach ($definitions as $id => $definition) { |
| 998 | - if (!$definition->isSynthetic() && (!$this->asFiles || !$definition->isShared() || $this->isHotPath($definition))) { |
|
| 999 | - $code .= ' ' . $this->doExport($id) . ' => ' . $this->doExport($this->generateMethodName($id)) . ",\n"; |
|
| 998 | + if ( ! $definition->isSynthetic() && ( ! $this->asFiles || ! $definition->isShared() || $this->isHotPath($definition))) { |
|
| 999 | + $code .= ' '.$this->doExport($id).' => '.$this->doExport($this->generateMethodName($id)).",\n"; |
|
| 1000 | 1000 | } |
| 1001 | 1001 | } |
| 1002 | 1002 | return $code ? " \$this->methodMap = [\n{$code} ];\n" : ''; |
@@ -1012,7 +1012,7 @@ discard block |
||
| 1012 | 1012 | $definitions = $this->container->getDefinitions(); |
| 1013 | 1013 | \ksort($definitions); |
| 1014 | 1014 | foreach ($definitions as $id => $definition) { |
| 1015 | - if (!$definition->isSynthetic() && $definition->isShared() && !$this->isHotPath($definition)) { |
|
| 1015 | + if ( ! $definition->isSynthetic() && $definition->isShared() && ! $this->isHotPath($definition)) { |
|
| 1016 | 1016 | $code .= \sprintf(" %s => '%s.php',\n", $this->doExport($id), $this->generateMethodName($id)); |
| 1017 | 1017 | } |
| 1018 | 1018 | } |
@@ -1030,14 +1030,14 @@ discard block |
||
| 1030 | 1030 | \ksort($aliases); |
| 1031 | 1031 | foreach ($aliases as $id => $alias) { |
| 1032 | 1032 | if ($alias->isPrivate()) { |
| 1033 | - $code .= ' ' . $this->doExport($id) . " => true,\n"; |
|
| 1033 | + $code .= ' '.$this->doExport($id)." => true,\n"; |
|
| 1034 | 1034 | } |
| 1035 | 1035 | } |
| 1036 | 1036 | $definitions = $this->container->getDefinitions(); |
| 1037 | 1037 | \ksort($definitions); |
| 1038 | 1038 | foreach ($definitions as $id => $definition) { |
| 1039 | - if (!$definition->isPublic()) { |
|
| 1040 | - $code .= ' ' . $this->doExport($id) . " => true,\n"; |
|
| 1039 | + if ( ! $definition->isPublic()) { |
|
| 1040 | + $code .= ' '.$this->doExport($id)." => true,\n"; |
|
| 1041 | 1041 | } |
| 1042 | 1042 | } |
| 1043 | 1043 | if (empty($code)) { |
@@ -1055,7 +1055,7 @@ discard block |
||
| 1055 | 1055 | */ |
| 1056 | 1056 | private function addAliases() |
| 1057 | 1057 | { |
| 1058 | - if (!($aliases = $this->container->getAliases())) { |
|
| 1058 | + if ( ! ($aliases = $this->container->getAliases())) { |
|
| 1059 | 1059 | return $this->container->isCompiled() ? "\n \$this->aliases = [];\n" : ''; |
| 1060 | 1060 | } |
| 1061 | 1061 | $code = " \$this->aliases = [\n"; |
@@ -1065,13 +1065,13 @@ discard block |
||
| 1065 | 1065 | while (isset($aliases[$id])) { |
| 1066 | 1066 | $id = $this->container->normalizeId($aliases[$id]); |
| 1067 | 1067 | } |
| 1068 | - $code .= ' ' . $this->doExport($alias) . ' => ' . $this->doExport($id) . ",\n"; |
|
| 1068 | + $code .= ' '.$this->doExport($alias).' => '.$this->doExport($id).",\n"; |
|
| 1069 | 1069 | } |
| 1070 | - return $code . " ];\n"; |
|
| 1070 | + return $code." ];\n"; |
|
| 1071 | 1071 | } |
| 1072 | 1072 | private function addInlineRequires() |
| 1073 | 1073 | { |
| 1074 | - if (!$this->hotPathTag || !$this->inlineRequires) { |
|
| 1074 | + if ( ! $this->hotPathTag || ! $this->inlineRequires) { |
|
| 1075 | 1075 | return ''; |
| 1076 | 1076 | } |
| 1077 | 1077 | $lineage = []; |
@@ -1086,7 +1086,7 @@ discard block |
||
| 1086 | 1086 | } |
| 1087 | 1087 | $code = ''; |
| 1088 | 1088 | foreach ($lineage as $file) { |
| 1089 | - if (!isset($this->inlinedRequires[$file])) { |
|
| 1089 | + if ( ! isset($this->inlinedRequires[$file])) { |
|
| 1090 | 1090 | $this->inlinedRequires[$file] = \true; |
| 1091 | 1091 | $code .= \sprintf("\n include_once %s;", $file); |
| 1092 | 1092 | } |
@@ -1100,7 +1100,7 @@ discard block |
||
| 1100 | 1100 | */ |
| 1101 | 1101 | private function addDefaultParametersMethod() |
| 1102 | 1102 | { |
| 1103 | - if (!$this->container->getParameterBag()->all()) { |
|
| 1103 | + if ( ! $this->container->getParameterBag()->all()) { |
|
| 1104 | 1104 | return ''; |
| 1105 | 1105 | } |
| 1106 | 1106 | $php = []; |
@@ -1179,7 +1179,7 @@ discard block |
||
| 1179 | 1179 | } |
| 1180 | 1180 | |
| 1181 | 1181 | EOF; |
| 1182 | - if (!$this->asFiles) { |
|
| 1182 | + if ( ! $this->asFiles) { |
|
| 1183 | 1183 | $code = \preg_replace('/^.*buildParameters.*\\n.*\\n.*\\n/m', '', $code); |
| 1184 | 1184 | } |
| 1185 | 1185 | if ($dynamicPhp) { |
@@ -1196,7 +1196,7 @@ discard block |
||
| 1196 | 1196 | $getDynamicParameter = \sprintf($getDynamicParameter, \implode("\n", $dynamicPhp)); |
| 1197 | 1197 | } else { |
| 1198 | 1198 | $loadedDynamicParameters = '[]'; |
| 1199 | - $getDynamicParameter = \str_repeat(' ', 8) . 'throw new InvalidArgumentException(sprintf(\'The dynamic parameter "%s" must be defined.\', $name));'; |
|
| 1199 | + $getDynamicParameter = \str_repeat(' ', 8).'throw new InvalidArgumentException(sprintf(\'The dynamic parameter "%s" must be defined.\', $name));'; |
|
| 1200 | 1200 | } |
| 1201 | 1201 | $code .= <<<EOF |
| 1202 | 1202 | |
@@ -1219,7 +1219,7 @@ discard block |
||
| 1219 | 1219 | |
| 1220 | 1220 | |
| 1221 | 1221 | EOF; |
| 1222 | - $code .= ' private $normalizedParameterNames = ' . ($normalizedParams ? \sprintf("[\n%s\n ];", \implode("\n", $normalizedParams)) : '[];') . "\n"; |
|
| 1222 | + $code .= ' private $normalizedParameterNames = '.($normalizedParams ? \sprintf("[\n%s\n ];", \implode("\n", $normalizedParams)) : '[];')."\n"; |
|
| 1223 | 1223 | $code .= <<<'EOF' |
| 1224 | 1224 | |
| 1225 | 1225 | private function normalizeParameterName($name) |
@@ -1270,17 +1270,17 @@ discard block |
||
| 1270 | 1270 | $php = []; |
| 1271 | 1271 | foreach ($parameters as $key => $value) { |
| 1272 | 1272 | if (\is_array($value)) { |
| 1273 | - $value = $this->exportParameters($value, $path . '/' . $key, $indent + 4); |
|
| 1273 | + $value = $this->exportParameters($value, $path.'/'.$key, $indent + 4); |
|
| 1274 | 1274 | } elseif ($value instanceof ArgumentInterface) { |
| 1275 | - throw new InvalidArgumentException(\sprintf('You cannot dump a container with parameters that contain special arguments. "%s" found in "%s".', \get_class($value), $path . '/' . $key)); |
|
| 1275 | + throw new InvalidArgumentException(\sprintf('You cannot dump a container with parameters that contain special arguments. "%s" found in "%s".', \get_class($value), $path.'/'.$key)); |
|
| 1276 | 1276 | } elseif ($value instanceof Variable) { |
| 1277 | - throw new InvalidArgumentException(\sprintf('You cannot dump a container with parameters that contain variable references. Variable "%s" found in "%s".', $value, $path . '/' . $key)); |
|
| 1277 | + throw new InvalidArgumentException(\sprintf('You cannot dump a container with parameters that contain variable references. Variable "%s" found in "%s".', $value, $path.'/'.$key)); |
|
| 1278 | 1278 | } elseif ($value instanceof Definition) { |
| 1279 | - throw new InvalidArgumentException(\sprintf('You cannot dump a container with parameters that contain service definitions. Definition for "%s" found in "%s".', $value->getClass(), $path . '/' . $key)); |
|
| 1279 | + throw new InvalidArgumentException(\sprintf('You cannot dump a container with parameters that contain service definitions. Definition for "%s" found in "%s".', $value->getClass(), $path.'/'.$key)); |
|
| 1280 | 1280 | } elseif ($value instanceof Reference) { |
| 1281 | - throw new InvalidArgumentException(\sprintf('You cannot dump a container with parameters that contain references to other services (reference to service "%s" found in "%s").', $value, $path . '/' . $key)); |
|
| 1281 | + throw new InvalidArgumentException(\sprintf('You cannot dump a container with parameters that contain references to other services (reference to service "%s" found in "%s").', $value, $path.'/'.$key)); |
|
| 1282 | 1282 | } elseif ($value instanceof Expression) { |
| 1283 | - throw new InvalidArgumentException(\sprintf('You cannot dump a container with parameters that contain expressions. Expression "%s" found in "%s".', $value, $path . '/' . $key)); |
|
| 1283 | + throw new InvalidArgumentException(\sprintf('You cannot dump a container with parameters that contain expressions. Expression "%s" found in "%s".', $value, $path.'/'.$key)); |
|
| 1284 | 1284 | } else { |
| 1285 | 1285 | $value = $this->export($value); |
| 1286 | 1286 | } |
@@ -1310,12 +1310,12 @@ discard block |
||
| 1310 | 1310 | */ |
| 1311 | 1311 | private function wrapServiceConditionals($value, $code) |
| 1312 | 1312 | { |
| 1313 | - if (!($condition = $this->getServiceConditionals($value))) { |
|
| 1313 | + if ( ! ($condition = $this->getServiceConditionals($value))) { |
|
| 1314 | 1314 | return $code; |
| 1315 | 1315 | } |
| 1316 | 1316 | // re-indent the wrapped code |
| 1317 | - $code = \implode("\n", \array_map(function ($line) { |
|
| 1318 | - return $line ? ' ' . $line : $line; |
|
| 1317 | + $code = \implode("\n", \array_map(function($line) { |
|
| 1318 | + return $line ? ' '.$line : $line; |
|
| 1319 | 1319 | }, \explode("\n", $code))); |
| 1320 | 1320 | return \sprintf(" if (%s) {\n%s }\n", $condition, $code); |
| 1321 | 1321 | } |
@@ -1330,18 +1330,18 @@ discard block |
||
| 1330 | 1330 | { |
| 1331 | 1331 | $conditions = []; |
| 1332 | 1332 | foreach (ContainerBuilder::getInitializedConditionals($value) as $service) { |
| 1333 | - if (!$this->container->hasDefinition($service)) { |
|
| 1333 | + if ( ! $this->container->hasDefinition($service)) { |
|
| 1334 | 1334 | return 'false'; |
| 1335 | 1335 | } |
| 1336 | 1336 | $conditions[] = \sprintf('isset($this->services[%s])', $this->doExport($service)); |
| 1337 | 1337 | } |
| 1338 | 1338 | foreach (ContainerBuilder::getServiceConditionals($value) as $service) { |
| 1339 | - if ($this->container->hasDefinition($service) && !$this->container->getDefinition($service)->isPublic()) { |
|
| 1339 | + if ($this->container->hasDefinition($service) && ! $this->container->getDefinition($service)->isPublic()) { |
|
| 1340 | 1340 | continue; |
| 1341 | 1341 | } |
| 1342 | 1342 | $conditions[] = \sprintf('$this->has(%s)', $this->doExport($service)); |
| 1343 | 1343 | } |
| 1344 | - if (!$conditions) { |
|
| 1344 | + if ( ! $conditions) { |
|
| 1345 | 1345 | return ''; |
| 1346 | 1346 | } |
| 1347 | 1347 | return \implode(' && ', $conditions); |
@@ -1359,13 +1359,13 @@ discard block |
||
| 1359 | 1359 | while ($this->container->hasAlias($id)) { |
| 1360 | 1360 | $id = (string) $this->container->getAlias($id); |
| 1361 | 1361 | } |
| 1362 | - if (!isset($calls[$id])) { |
|
| 1362 | + if ( ! isset($calls[$id])) { |
|
| 1363 | 1363 | $calls[$id] = [0, $argument->getInvalidBehavior(), $byConstructor]; |
| 1364 | 1364 | } else { |
| 1365 | 1365 | $calls[$id][1] = \min($calls[$id][1], $argument->getInvalidBehavior()); |
| 1366 | 1366 | } |
| 1367 | 1367 | ++$calls[$id][0]; |
| 1368 | - } elseif (!$argument instanceof Definition) { |
|
| 1368 | + } elseif ( ! $argument instanceof Definition) { |
|
| 1369 | 1369 | // no-op |
| 1370 | 1370 | } elseif (isset($definitions[$argument])) { |
| 1371 | 1371 | $definitions[$argument] = 1 + $definitions[$argument]; |
@@ -1418,7 +1418,7 @@ discard block |
||
| 1418 | 1418 | $operands = [0]; |
| 1419 | 1419 | $code = []; |
| 1420 | 1420 | $code[] = 'new RewindableGenerator(function () {'; |
| 1421 | - if (!($values = $value->getValues())) { |
|
| 1421 | + if ( ! ($values = $value->getValues())) { |
|
| 1422 | 1422 | $code[] = ' return new \\EmptyIterator();'; |
| 1423 | 1423 | } else { |
| 1424 | 1424 | $countCode = []; |
@@ -1428,7 +1428,7 @@ discard block |
||
| 1428 | 1428 | $v = $this->wrapServiceConditionals($v, \sprintf(" yield %s => %s;\n", $this->dumpValue($k, $interpolate), $this->dumpValue($v, $interpolate))); |
| 1429 | 1429 | foreach (\explode("\n", $v) as $v) { |
| 1430 | 1430 | if ($v) { |
| 1431 | - $code[] = ' ' . $v; |
|
| 1431 | + $code[] = ' '.$v; |
|
| 1432 | 1432 | } |
| 1433 | 1433 | } |
| 1434 | 1434 | } |
@@ -1464,7 +1464,7 @@ discard block |
||
| 1464 | 1464 | return \sprintf('%s(%s)', $this->dumpLiteralClass($this->dumpValue($factory)), \implode(', ', $arguments)); |
| 1465 | 1465 | } |
| 1466 | 1466 | if (\is_array($factory)) { |
| 1467 | - if (!\preg_match('/^[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*$/', $factory[1])) { |
|
| 1467 | + if ( ! \preg_match('/^[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*$/', $factory[1])) { |
|
| 1468 | 1468 | throw new RuntimeException(\sprintf('Cannot dump definition because of invalid factory method (%s).', $factory[1] ?: 'n/a')); |
| 1469 | 1469 | } |
| 1470 | 1470 | $class = $this->dumpValue($factory[0]); |
@@ -1475,7 +1475,7 @@ discard block |
||
| 1475 | 1475 | if (0 === \strpos($class, 'new ')) { |
| 1476 | 1476 | return \sprintf('(%s)->%s(%s)', $class, $factory[1], \implode(', ', $arguments)); |
| 1477 | 1477 | } |
| 1478 | - return \sprintf("\\call_user_func([%s, '%s']%s)", $class, $factory[1], \count($arguments) > 0 ? ', ' . \implode(', ', $arguments) : ''); |
|
| 1478 | + return \sprintf("\\call_user_func([%s, '%s']%s)", $class, $factory[1], \count($arguments) > 0 ? ', '.\implode(', ', $arguments) : ''); |
|
| 1479 | 1479 | } |
| 1480 | 1480 | if ($factory[0] instanceof Reference) { |
| 1481 | 1481 | return \sprintf('%s->%s(%s)', $class, $factory[1], \implode(', ', $arguments)); |
@@ -1489,7 +1489,7 @@ discard block |
||
| 1489 | 1489 | } |
| 1490 | 1490 | return \sprintf('new %s(%s)', $this->dumpLiteralClass($this->dumpValue($class)), \implode(', ', $arguments)); |
| 1491 | 1491 | } elseif ($value instanceof Variable) { |
| 1492 | - return '$' . $value; |
|
| 1492 | + return '$'.$value; |
|
| 1493 | 1493 | } elseif ($value instanceof Reference) { |
| 1494 | 1494 | $id = $this->container->normalizeId($value); |
| 1495 | 1495 | while ($this->container->hasAlias($id)) { |
@@ -1509,8 +1509,8 @@ discard block |
||
| 1509 | 1509 | // the preg_replace_callback converts them to strings |
| 1510 | 1510 | return $this->dumpParameter($match[1]); |
| 1511 | 1511 | } else { |
| 1512 | - $replaceParameters = function ($match) { |
|
| 1513 | - return "'." . $this->dumpParameter($match[2]) . ".'"; |
|
| 1512 | + $replaceParameters = function($match) { |
|
| 1513 | + return "'.".$this->dumpParameter($match[2]).".'"; |
|
| 1514 | 1514 | }; |
| 1515 | 1515 | $code = \str_replace('%%', '%', \preg_replace_callback('/(?<!%)(%)([^%]+)\\1/', $replaceParameters, $this->export($value))); |
| 1516 | 1516 | return $code; |
@@ -1534,11 +1534,11 @@ discard block |
||
| 1534 | 1534 | if (\false !== \strpos($class, '$')) { |
| 1535 | 1535 | return \sprintf('${($_ = %s) && false ?: "_"}', $class); |
| 1536 | 1536 | } |
| 1537 | - if (0 !== \strpos($class, "'") || !\preg_match('/^\'(?:\\\\{2})?[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*(?:\\\\{2}[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*)*\'$/', $class)) { |
|
| 1537 | + if (0 !== \strpos($class, "'") || ! \preg_match('/^\'(?:\\\\{2})?[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*(?:\\\\{2}[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*)*\'$/', $class)) { |
|
| 1538 | 1538 | throw new RuntimeException(\sprintf('Cannot dump definition because of invalid class name (%s).', $class ?: 'n/a')); |
| 1539 | 1539 | } |
| 1540 | 1540 | $class = \substr(\str_replace('\\\\', '\\', $class), 1, -1); |
| 1541 | - return 0 === \strpos($class, '\\') ? $class : '\\' . $class; |
|
| 1541 | + return 0 === \strpos($class, '\\') ? $class : '\\'.$class; |
|
| 1542 | 1542 | } |
| 1543 | 1543 | /** |
| 1544 | 1544 | * Dumps a parameter. |
@@ -1553,10 +1553,10 @@ discard block |
||
| 1553 | 1553 | if ($this->container->isCompiled() && $this->container->hasParameter($name)) { |
| 1554 | 1554 | $value = $this->container->getParameter($name); |
| 1555 | 1555 | $dumpedValue = $this->dumpValue($value, \false); |
| 1556 | - if (!$value || !\is_array($value)) { |
|
| 1556 | + if ( ! $value || ! \is_array($value)) { |
|
| 1557 | 1557 | return $dumpedValue; |
| 1558 | 1558 | } |
| 1559 | - if (!\preg_match("/\\\$this->(?:getEnv\\('(?:\\w++:)*+\\w++'\\)|targetDirs\\[\\d++\\])/", $dumpedValue)) { |
|
| 1559 | + if ( ! \preg_match("/\\\$this->(?:getEnv\\('(?:\\w++:)*+\\w++'\\)|targetDirs\\[\\d++\\])/", $dumpedValue)) { |
|
| 1560 | 1560 | return \sprintf('$this->parameters[%s]', $this->doExport($name)); |
| 1561 | 1561 | } |
| 1562 | 1562 | } |
@@ -1581,10 +1581,10 @@ discard block |
||
| 1581 | 1581 | } |
| 1582 | 1582 | if ($this->container->hasDefinition($id) && ($definition = $this->container->getDefinition($id))) { |
| 1583 | 1583 | if ($definition->isSynthetic()) { |
| 1584 | - $code = \sprintf('$this->get(%s%s)', $this->doExport($id), null !== $reference ? ', ' . $reference->getInvalidBehavior() : ''); |
|
| 1584 | + $code = \sprintf('$this->get(%s%s)', $this->doExport($id), null !== $reference ? ', '.$reference->getInvalidBehavior() : ''); |
|
| 1585 | 1585 | } elseif (null !== $reference && ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE === $reference->getInvalidBehavior()) { |
| 1586 | 1586 | $code = 'null'; |
| 1587 | - if (!$definition->isShared()) { |
|
| 1587 | + if ( ! $definition->isShared()) { |
|
| 1588 | 1588 | return $code; |
| 1589 | 1589 | } |
| 1590 | 1590 | } elseif ($this->isTrivialInstance($definition)) { |
@@ -1593,7 +1593,7 @@ discard block |
||
| 1593 | 1593 | $code = \sprintf('$this->services[%s] = %s', $this->doExport($id), $code); |
| 1594 | 1594 | } |
| 1595 | 1595 | $code = "({$code})"; |
| 1596 | - } elseif ($this->asFiles && $definition->isShared() && !$this->isHotPath($definition)) { |
|
| 1596 | + } elseif ($this->asFiles && $definition->isShared() && ! $this->isHotPath($definition)) { |
|
| 1597 | 1597 | $code = \sprintf("\$this->load('%s.php')", $this->generateMethodName($id)); |
| 1598 | 1598 | } else { |
| 1599 | 1599 | $code = \sprintf('$this->%s()', $this->generateMethodName($id)); |
@@ -1640,11 +1640,11 @@ discard block |
||
| 1640 | 1640 | $i = \strrpos($id, '\\'); |
| 1641 | 1641 | $name = Container::camelize(\false !== $i && isset($id[1 + $i]) ? \substr($id, 1 + $i) : $id); |
| 1642 | 1642 | $name = \preg_replace('/[^a-zA-Z0-9_\\x7f-\\xff]/', '', $name); |
| 1643 | - $methodName = 'get' . $name . 'Service'; |
|
| 1643 | + $methodName = 'get'.$name.'Service'; |
|
| 1644 | 1644 | $suffix = 1; |
| 1645 | 1645 | while (isset($this->usedMethodNames[\strtolower($methodName)])) { |
| 1646 | 1646 | ++$suffix; |
| 1647 | - $methodName = 'get' . $name . $suffix . 'Service'; |
|
| 1647 | + $methodName = 'get'.$name.$suffix.'Service'; |
|
| 1648 | 1648 | } |
| 1649 | 1649 | $this->serviceIdToMethodNameMap[$id] = $methodName; |
| 1650 | 1650 | $this->usedMethodNames[\strtolower($methodName)] = \true; |
@@ -1684,11 +1684,11 @@ discard block |
||
| 1684 | 1684 | private function getExpressionLanguage() |
| 1685 | 1685 | { |
| 1686 | 1686 | if (null === $this->expressionLanguage) { |
| 1687 | - if (!\class_exists('Wordlift\\Modules\\Plugin_Installer_Dependencies\\Symfony\\Component\\ExpressionLanguage\\ExpressionLanguage')) { |
|
| 1687 | + if ( ! \class_exists('Wordlift\\Modules\\Plugin_Installer_Dependencies\\Symfony\\Component\\ExpressionLanguage\\ExpressionLanguage')) { |
|
| 1688 | 1688 | throw new RuntimeException('Unable to use expressions as the Symfony ExpressionLanguage component is not installed.'); |
| 1689 | 1689 | } |
| 1690 | 1690 | $providers = $this->container->getExpressionLanguageProviders(); |
| 1691 | - $this->expressionLanguage = new ExpressionLanguage(null, $providers, function ($arg) { |
|
| 1691 | + $this->expressionLanguage = new ExpressionLanguage(null, $providers, function($arg) { |
|
| 1692 | 1692 | $id = '""' === \substr_replace($arg, '', 1, -1) ? \stripcslashes(\substr($arg, 1, -1)) : null; |
| 1693 | 1693 | if (null !== $id && ($this->container->hasAlias($id) || $this->container->hasDefinition($id))) { |
| 1694 | 1694 | return $this->getServiceCall($id); |
@@ -1705,15 +1705,15 @@ discard block |
||
| 1705 | 1705 | } |
| 1706 | 1706 | private function isHotPath(Definition $definition) |
| 1707 | 1707 | { |
| 1708 | - return $this->hotPathTag && $definition->hasTag($this->hotPathTag) && !$definition->isDeprecated(); |
|
| 1708 | + return $this->hotPathTag && $definition->hasTag($this->hotPathTag) && ! $definition->isDeprecated(); |
|
| 1709 | 1709 | } |
| 1710 | 1710 | private function export($value) |
| 1711 | 1711 | { |
| 1712 | 1712 | if (null !== $this->targetDirRegex && \is_string($value) && \preg_match($this->targetDirRegex, $value, $matches, \PREG_OFFSET_CAPTURE)) { |
| 1713 | 1713 | $suffix = $matches[0][1] + \strlen($matches[0][0]); |
| 1714 | 1714 | $matches[0][1] += \strlen($matches[1][0]); |
| 1715 | - $prefix = $matches[0][1] ? $this->doExport(\substr($value, 0, $matches[0][1]), \true) . '.' : ''; |
|
| 1716 | - $suffix = isset($value[$suffix]) ? '.' . $this->doExport(\substr($value, $suffix), \true) : ''; |
|
| 1715 | + $prefix = $matches[0][1] ? $this->doExport(\substr($value, 0, $matches[0][1]), \true).'.' : ''; |
|
| 1716 | + $suffix = isset($value[$suffix]) ? '.'.$this->doExport(\substr($value, $suffix), \true) : ''; |
|
| 1717 | 1717 | $dirname = $this->asFiles ? '$this->containerDir' : '__DIR__'; |
| 1718 | 1718 | $offset = 2 + $this->targetDirMaxMatches - \count($matches); |
| 1719 | 1719 | if ($this->asFiles || 0 < $offset) { |
@@ -1730,7 +1730,7 @@ discard block |
||
| 1730 | 1730 | { |
| 1731 | 1731 | if (\is_string($value) && \false !== \strpos($value, "\n")) { |
| 1732 | 1732 | $cleanParts = \explode("\n", $value); |
| 1733 | - $cleanParts = \array_map(function ($part) { |
|
| 1733 | + $cleanParts = \array_map(function($part) { |
|
| 1734 | 1734 | return \var_export($part, \true); |
| 1735 | 1735 | }, $cleanParts); |
| 1736 | 1736 | $export = \implode('."\\n".', $cleanParts); |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | private function addParameters(\DOMElement $parent) |
| 55 | 55 | { |
| 56 | 56 | $data = $this->container->getParameterBag()->all(); |
| 57 | - if (!$data) { |
|
| 57 | + if ( ! $data) { |
|
| 58 | 58 | return; |
| 59 | 59 | } |
| 60 | 60 | if ($this->container->isCompiled()) { |
@@ -93,10 +93,10 @@ discard block |
||
| 93 | 93 | } |
| 94 | 94 | $service->setAttribute('class', $class); |
| 95 | 95 | } |
| 96 | - if (!$definition->isShared()) { |
|
| 96 | + if ( ! $definition->isShared()) { |
|
| 97 | 97 | $service->setAttribute('shared', 'false'); |
| 98 | 98 | } |
| 99 | - if (!$definition->isPrivate()) { |
|
| 99 | + if ( ! $definition->isPrivate()) { |
|
| 100 | 100 | $service->setAttribute('public', $definition->isPublic() ? 'true' : 'false'); |
| 101 | 101 | } |
| 102 | 102 | if ($definition->isSynthetic()) { |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | $service = $this->document->createElement('service'); |
| 197 | 197 | $service->setAttribute('id', $alias); |
| 198 | 198 | $service->setAttribute('alias', $id); |
| 199 | - if (!$id->isPrivate()) { |
|
| 199 | + if ( ! $id->isPrivate()) { |
|
| 200 | 200 | $service->setAttribute('public', $id->isPublic() ? 'true' : 'false'); |
| 201 | 201 | } |
| 202 | 202 | $parent->appendChild($service); |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | private function addServices(\DOMElement $parent) |
| 205 | 205 | { |
| 206 | 206 | $definitions = $this->container->getDefinitions(); |
| 207 | - if (!$definitions) { |
|
| 207 | + if ( ! $definitions) { |
|
| 208 | 208 | return; |
| 209 | 209 | } |
| 210 | 210 | $services = $this->document->createElement('services'); |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | case \false === $value: |
| 316 | 316 | return 'false'; |
| 317 | 317 | case $value instanceof Parameter: |
| 318 | - return '%' . $value . '%'; |
|
| 318 | + return '%'.$value.'%'; |
|
| 319 | 319 | case \is_object($value) || \is_resource($value): |
| 320 | 320 | throw new RuntimeException('Unable to dump a service container if a parameter is an object or a resource.'); |
| 321 | 321 | default: |
@@ -40,13 +40,13 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | public function dump(array $options = []) |
| 42 | 42 | { |
| 43 | - if (!\class_exists('Wordlift\\Modules\\Plugin_Installer_Dependencies\\Symfony\\Component\\Yaml\\Dumper')) { |
|
| 43 | + if ( ! \class_exists('Wordlift\\Modules\\Plugin_Installer_Dependencies\\Symfony\\Component\\Yaml\\Dumper')) { |
|
| 44 | 44 | throw new RuntimeException('Unable to dump the container as the Symfony Yaml Component is not installed.'); |
| 45 | 45 | } |
| 46 | 46 | if (null === $this->dumper) { |
| 47 | 47 | $this->dumper = new YmlDumper(); |
| 48 | 48 | } |
| 49 | - return $this->container->resolveEnvPlaceholders($this->addParameters() . "\n" . $this->addServices()); |
|
| 49 | + return $this->container->resolveEnvPlaceholders($this->addParameters()."\n".$this->addServices()); |
|
| 50 | 50 | } |
| 51 | 51 | /** |
| 52 | 52 | * Adds a service. |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | } |
| 65 | 65 | $code .= \sprintf(" class: %s\n", $this->dumper->dump($class)); |
| 66 | 66 | } |
| 67 | - if (!$definition->isPrivate()) { |
|
| 67 | + if ( ! $definition->isPrivate()) { |
|
| 68 | 68 | $code .= \sprintf(" public: %s\n", $definition->isPublic() ? 'true' : 'false'); |
| 69 | 69 | } |
| 70 | 70 | $tagsCode = ''; |
@@ -74,12 +74,12 @@ discard block |
||
| 74 | 74 | foreach ($attributes as $key => $value) { |
| 75 | 75 | $att[] = \sprintf('%s: %s', $this->dumper->dump($key), $this->dumper->dump($value)); |
| 76 | 76 | } |
| 77 | - $att = $att ? ', ' . \implode(', ', $att) : ''; |
|
| 77 | + $att = $att ? ', '.\implode(', ', $att) : ''; |
|
| 78 | 78 | $tagsCode .= \sprintf(" - { name: %s%s }\n", $this->dumper->dump($name), $att); |
| 79 | 79 | } |
| 80 | 80 | } |
| 81 | 81 | if ($tagsCode) { |
| 82 | - $code .= " tags:\n" . $tagsCode; |
|
| 82 | + $code .= " tags:\n".$tagsCode; |
|
| 83 | 83 | } |
| 84 | 84 | if ($definition->getFile()) { |
| 85 | 85 | $code .= \sprintf(" file: %s\n", $this->dumper->dump($definition->getFile())); |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | if ($definition->getMethodCalls()) { |
| 119 | 119 | $code .= \sprintf(" calls:\n%s\n", $this->dumper->dump($this->dumpValue($definition->getMethodCalls()), 1, 12)); |
| 120 | 120 | } |
| 121 | - if (!$definition->isShared()) { |
|
| 121 | + if ( ! $definition->isShared()) { |
|
| 122 | 122 | $code .= " shared: false\n"; |
| 123 | 123 | } |
| 124 | 124 | if (null !== ($decorated = $definition->getDecoratedService())) { |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | */ |
| 161 | 161 | private function addServices() |
| 162 | 162 | { |
| 163 | - if (!$this->container->getDefinitions()) { |
|
| 163 | + if ( ! $this->container->getDefinitions()) { |
|
| 164 | 164 | return ''; |
| 165 | 165 | } |
| 166 | 166 | $code = "services:\n"; |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | */ |
| 184 | 184 | private function addParameters() |
| 185 | 185 | { |
| 186 | - if (!$this->container->getParameterBag()->all()) { |
|
| 186 | + if ( ! $this->container->getParameterBag()->all()) { |
|
| 187 | 187 | return ''; |
| 188 | 188 | } |
| 189 | 189 | $parameters = $this->prepareParameters($this->container->getParameterBag()->all(), $this->container->isCompiled()); |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | } elseif ($value instanceof Expression) { |
| 244 | 244 | return $this->getExpressionCall((string) $value); |
| 245 | 245 | } elseif ($value instanceof Definition) { |
| 246 | - return new TaggedValue('service', (new Parser())->parse("_:\n" . $this->addService('_', $value), Yaml::PARSE_CUSTOM_TAGS)['_']['_']); |
|
| 246 | + return new TaggedValue('service', (new Parser())->parse("_:\n".$this->addService('_', $value), Yaml::PARSE_CUSTOM_TAGS)['_']['_']); |
|
| 247 | 247 | } elseif (\is_object($value) || \is_resource($value)) { |
| 248 | 248 | throw new RuntimeException('Unable to dump a service container if a parameter is an object or a resource.'); |
| 249 | 249 | } |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | if (\is_array($value)) { |
| 301 | 301 | $value = $this->prepareParameters($value, $escape); |
| 302 | 302 | } elseif ($value instanceof Reference || \is_string($value) && 0 === \strpos($value, '@')) { |
| 303 | - $value = '@' . $value; |
|
| 303 | + $value = '@'.$value; |
|
| 304 | 304 | } |
| 305 | 305 | $filtered[$key] = $value; |
| 306 | 306 | } |
@@ -10,7 +10,7 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | namespace Wordlift\Modules\Plugin_Installer_Dependencies\Symfony\Component\DependencyInjection; |
| 12 | 12 | |
| 13 | -@\trigger_error('The ' . __NAMESPACE__ . '\\DefinitionDecorator class is deprecated since Symfony 3.3 and will be removed in 4.0. Use the Symfony\\Component\\DependencyInjection\\ChildDefinition class instead.', \E_USER_DEPRECATED); |
|
| 13 | +@\trigger_error('The '.__NAMESPACE__.'\\DefinitionDecorator class is deprecated since Symfony 3.3 and will be removed in 4.0. Use the Symfony\\Component\\DependencyInjection\\ChildDefinition class instead.', \E_USER_DEPRECATED); |
|
| 14 | 14 | \class_exists(ChildDefinition::class); |
| 15 | 15 | if (\false) { |
| 16 | 16 | /** |
@@ -64,8 +64,8 @@ discard block |
||
| 64 | 64 | */ |
| 65 | 65 | public function getArgument($index) |
| 66 | 66 | { |
| 67 | - if (\array_key_exists('index_' . $index, $this->arguments)) { |
|
| 68 | - return $this->arguments['index_' . $index]; |
|
| 67 | + if (\array_key_exists('index_'.$index, $this->arguments)) { |
|
| 68 | + return $this->arguments['index_'.$index]; |
|
| 69 | 69 | } |
| 70 | 70 | return parent::getArgument($index); |
| 71 | 71 | } |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | public function replaceArgument($index, $value) |
| 88 | 88 | { |
| 89 | 89 | if (\is_int($index)) { |
| 90 | - $this->arguments['index_' . $index] = $value; |
|
| 90 | + $this->arguments['index_'.$index] = $value; |
|
| 91 | 91 | } elseif (0 === \strpos($index, '$')) { |
| 92 | 92 | $this->arguments[$index] = $value; |
| 93 | 93 | } else { |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | */ |
| 207 | 207 | public function addResource(ResourceInterface $resource) |
| 208 | 208 | { |
| 209 | - if (!$this->trackResources) { |
|
| 209 | + if ( ! $this->trackResources) { |
|
| 210 | 210 | return $this; |
| 211 | 211 | } |
| 212 | 212 | if ($resource instanceof GlobResource && $this->inVendors($resource->getPrefix())) { |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | */ |
| 225 | 225 | public function setResources(array $resources) |
| 226 | 226 | { |
| 227 | - if (!$this->trackResources) { |
|
| 227 | + if ( ! $this->trackResources) { |
|
| 228 | 228 | return $this; |
| 229 | 229 | } |
| 230 | 230 | $this->resources = $resources; |
@@ -243,12 +243,12 @@ discard block |
||
| 243 | 243 | if (\is_object($object)) { |
| 244 | 244 | $object = \get_class($object); |
| 245 | 245 | } |
| 246 | - if (!isset($this->classReflectors[$object])) { |
|
| 246 | + if ( ! isset($this->classReflectors[$object])) { |
|
| 247 | 247 | $this->classReflectors[$object] = new \ReflectionClass($object); |
| 248 | 248 | } |
| 249 | 249 | $class = $this->classReflectors[$object]; |
| 250 | 250 | foreach ($class->getInterfaceNames() as $name) { |
| 251 | - if (null === ($interface =& $this->classReflectors[$name])) { |
|
| 251 | + if (null === ($interface = & $this->classReflectors[$name])) { |
|
| 252 | 252 | $interface = new \ReflectionClass($name); |
| 253 | 253 | } |
| 254 | 254 | $file = $interface->getFileName(); |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | */ |
| 278 | 278 | public function addClassResource(\ReflectionClass $class) |
| 279 | 279 | { |
| 280 | - @\trigger_error('The ' . __METHOD__ . '() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the addObjectResource() or the getReflectionClass() method instead.', \E_USER_DEPRECATED); |
|
| 280 | + @\trigger_error('The '.__METHOD__.'() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the addObjectResource() or the getReflectionClass() method instead.', \E_USER_DEPRECATED); |
|
| 281 | 281 | return $this->addObjectResource($class->name); |
| 282 | 282 | } |
| 283 | 283 | /** |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | */ |
| 295 | 295 | public function getReflectionClass($class, $throw = \true) |
| 296 | 296 | { |
| 297 | - if (!($class = $this->getParameterBag()->resolveValue($class))) { |
|
| 297 | + if ( ! ($class = $this->getParameterBag()->resolveValue($class))) { |
|
| 298 | 298 | return null; |
| 299 | 299 | } |
| 300 | 300 | if (isset(self::$internalTypes[$class])) { |
@@ -316,11 +316,11 @@ discard block |
||
| 316 | 316 | } |
| 317 | 317 | } |
| 318 | 318 | if ($this->trackResources) { |
| 319 | - if (!$classReflector) { |
|
| 319 | + if ( ! $classReflector) { |
|
| 320 | 320 | $this->addResource($resource ?: new ClassExistenceResource($class, \false)); |
| 321 | - } elseif (!$classReflector->isInternal()) { |
|
| 321 | + } elseif ( ! $classReflector->isInternal()) { |
|
| 322 | 322 | $path = $classReflector->getFileName(); |
| 323 | - if (!$this->inVendors($path)) { |
|
| 323 | + if ( ! $this->inVendors($path)) { |
|
| 324 | 324 | $this->addResource(new ReflectionClassResource($classReflector, $this->vendors)); |
| 325 | 325 | } |
| 326 | 326 | } |
@@ -342,10 +342,10 @@ discard block |
||
| 342 | 342 | public function fileExists($path, $trackContents = \true) |
| 343 | 343 | { |
| 344 | 344 | $exists = \file_exists($path); |
| 345 | - if (!$this->trackResources || $this->inVendors($path)) { |
|
| 345 | + if ( ! $this->trackResources || $this->inVendors($path)) { |
|
| 346 | 346 | return $exists; |
| 347 | 347 | } |
| 348 | - if (!$exists) { |
|
| 348 | + if ( ! $exists) { |
|
| 349 | 349 | $this->addResource(new FileExistenceResource($path)); |
| 350 | 350 | return $exists; |
| 351 | 351 | } |
@@ -441,7 +441,7 @@ discard block |
||
| 441 | 441 | public function set($id, $service) |
| 442 | 442 | { |
| 443 | 443 | $id = $this->normalizeId($id); |
| 444 | - if ($this->isCompiled() && (isset($this->definitions[$id]) && !$this->definitions[$id]->isSynthetic())) { |
|
| 444 | + if ($this->isCompiled() && (isset($this->definitions[$id]) && ! $this->definitions[$id]->isSynthetic())) { |
|
| 445 | 445 | // setting a synthetic service on a compiled container is alright |
| 446 | 446 | throw new BadMethodCallException(\sprintf('Setting service "%s" for an unknown or non-synthetic service definition on a compiled container is not allowed.', $id)); |
| 447 | 447 | } |
@@ -516,7 +516,7 @@ discard block |
||
| 516 | 516 | throw $e; |
| 517 | 517 | } |
| 518 | 518 | } |
| 519 | - if (!isset($this->definitions[$id]) && isset($this->aliasDefinitions[$id])) { |
|
| 519 | + if ( ! isset($this->definitions[$id]) && isset($this->aliasDefinitions[$id])) { |
|
| 520 | 520 | return $this->doGet((string) $this->aliasDefinitions[$id], $invalidBehavior, $inlineServices, $isConstructorArgument); |
| 521 | 521 | } |
| 522 | 522 | try { |
@@ -572,7 +572,7 @@ discard block |
||
| 572 | 572 | } |
| 573 | 573 | } |
| 574 | 574 | foreach ($this->extensions as $name => $extension) { |
| 575 | - if (!isset($this->extensionConfigs[$name])) { |
|
| 575 | + if ( ! isset($this->extensionConfigs[$name])) { |
|
| 576 | 576 | $this->extensionConfigs[$name] = []; |
| 577 | 577 | } |
| 578 | 578 | $this->extensionConfigs[$name] = \array_merge($this->extensionConfigs[$name], $container->getExtensionConfig($name)); |
@@ -584,10 +584,10 @@ discard block |
||
| 584 | 584 | $envPlaceholders = []; |
| 585 | 585 | } |
| 586 | 586 | foreach ($container->envCounters as $env => $count) { |
| 587 | - if (!$count && !isset($envPlaceholders[$env])) { |
|
| 587 | + if ( ! $count && ! isset($envPlaceholders[$env])) { |
|
| 588 | 588 | continue; |
| 589 | 589 | } |
| 590 | - if (!isset($this->envCounters[$env])) { |
|
| 590 | + if ( ! isset($this->envCounters[$env])) { |
|
| 591 | 591 | $this->envCounters[$env] = $count; |
| 592 | 592 | } else { |
| 593 | 593 | $this->envCounters[$env] += $count; |
@@ -609,7 +609,7 @@ discard block |
||
| 609 | 609 | */ |
| 610 | 610 | public function getExtensionConfig($name) |
| 611 | 611 | { |
| 612 | - if (!isset($this->extensionConfigs[$name])) { |
|
| 612 | + if ( ! isset($this->extensionConfigs[$name])) { |
|
| 613 | 613 | $this->extensionConfigs[$name] = []; |
| 614 | 614 | } |
| 615 | 615 | return $this->extensionConfigs[$name]; |
@@ -622,7 +622,7 @@ discard block |
||
| 622 | 622 | */ |
| 623 | 623 | public function prependExtensionConfig($name, array $config) |
| 624 | 624 | { |
| 625 | - if (!isset($this->extensionConfigs[$name])) { |
|
| 625 | + if ( ! isset($this->extensionConfigs[$name])) { |
|
| 626 | 626 | $this->extensionConfigs[$name] = []; |
| 627 | 627 | } |
| 628 | 628 | \array_unshift($this->extensionConfigs[$name], $config); |
@@ -684,7 +684,7 @@ discard block |
||
| 684 | 684 | } |
| 685 | 685 | parent::compile(); |
| 686 | 686 | foreach ($this->definitions + $this->aliasDefinitions as $id => $definition) { |
| 687 | - if (!$definition->isPublic() || $definition->isPrivate()) { |
|
| 687 | + if ( ! $definition->isPublic() || $definition->isPrivate()) { |
|
| 688 | 688 | $this->removedIds[$id] = \true; |
| 689 | 689 | } |
| 690 | 690 | } |
@@ -741,7 +741,7 @@ discard block |
||
| 741 | 741 | } |
| 742 | 742 | if (\is_string($id)) { |
| 743 | 743 | $id = new Alias($this->normalizeId($id)); |
| 744 | - } elseif (!$id instanceof Alias) { |
|
| 744 | + } elseif ( ! $id instanceof Alias) { |
|
| 745 | 745 | throw new InvalidArgumentException('$id must be a string, or an Alias object.'); |
| 746 | 746 | } |
| 747 | 747 | if ($alias === (string) $id) { |
@@ -794,7 +794,7 @@ discard block |
||
| 794 | 794 | public function getAlias($id) |
| 795 | 795 | { |
| 796 | 796 | $id = $this->normalizeId($id); |
| 797 | - if (!isset($this->aliasDefinitions[$id])) { |
|
| 797 | + if ( ! isset($this->aliasDefinitions[$id])) { |
|
| 798 | 798 | throw new InvalidArgumentException(\sprintf('The service alias "%s" does not exist.', $id)); |
| 799 | 799 | } |
| 800 | 800 | return $this->aliasDefinitions[$id]; |
@@ -904,7 +904,7 @@ discard block |
||
| 904 | 904 | public function getDefinition($id) |
| 905 | 905 | { |
| 906 | 906 | $id = $this->normalizeId($id); |
| 907 | - if (!isset($this->definitions[$id])) { |
|
| 907 | + if ( ! isset($this->definitions[$id])) { |
|
| 908 | 908 | throw new ServiceNotFoundException($id); |
| 909 | 909 | } |
| 910 | 910 | return $this->definitions[$id]; |
@@ -963,8 +963,8 @@ discard block |
||
| 963 | 963 | if ($definition->isDeprecated()) { |
| 964 | 964 | @\trigger_error($definition->getDeprecationMessage($id), \E_USER_DEPRECATED); |
| 965 | 965 | } |
| 966 | - if ($tryProxy && $definition->isLazy() && !($tryProxy = !($proxy = $this->proxyInstantiator) || $proxy instanceof RealServiceInstantiator)) { |
|
| 967 | - $proxy = $proxy->instantiateProxy($this, $definition, $id, function () use($definition, &$inlineServices, $id) { |
|
| 966 | + if ($tryProxy && $definition->isLazy() && ! ($tryProxy = ! ($proxy = $this->proxyInstantiator) || $proxy instanceof RealServiceInstantiator)) { |
|
| 967 | + $proxy = $proxy->instantiateProxy($this, $definition, $id, function() use($definition, &$inlineServices, $id) { |
|
| 968 | 968 | return $this->createService($definition, $inlineServices, \true, $id, \false); |
| 969 | 969 | }); |
| 970 | 970 | $this->shareService($definition, $proxy, $id, $inlineServices); |
@@ -978,16 +978,16 @@ discard block |
||
| 978 | 978 | if (null !== ($factory = $definition->getFactory())) { |
| 979 | 979 | if (\is_array($factory)) { |
| 980 | 980 | $factory = [$this->doResolveServices($parameterBag->resolveValue($factory[0]), $inlineServices, $isConstructorArgument), $factory[1]]; |
| 981 | - } elseif (!\is_string($factory)) { |
|
| 981 | + } elseif ( ! \is_string($factory)) { |
|
| 982 | 982 | throw new RuntimeException(\sprintf('Cannot create service "%s" because of invalid factory.', $id)); |
| 983 | 983 | } |
| 984 | 984 | } |
| 985 | - if (null !== $id && $definition->isShared() && isset($this->services[$id]) && ($tryProxy || !$definition->isLazy())) { |
|
| 985 | + if (null !== $id && $definition->isShared() && isset($this->services[$id]) && ($tryProxy || ! $definition->isLazy())) { |
|
| 986 | 986 | return $this->services[$id]; |
| 987 | 987 | } |
| 988 | 988 | if (null !== $factory) { |
| 989 | 989 | $service = \call_user_func_array($factory, $arguments); |
| 990 | - if (!$definition->isDeprecated() && \is_array($factory) && \is_string($factory[0])) { |
|
| 990 | + if ( ! $definition->isDeprecated() && \is_array($factory) && \is_string($factory[0])) { |
|
| 991 | 991 | $r = new \ReflectionClass($factory[0]); |
| 992 | 992 | if (0 < \strpos($r->getDocComment(), "\n * @deprecated ")) { |
| 993 | 993 | @\trigger_error(\sprintf('The "%s" service relies on the deprecated "%s" factory class. It should either be deprecated or its factory upgraded.', $id, $r->name), \E_USER_DEPRECATED); |
@@ -999,11 +999,11 @@ discard block |
||
| 999 | 999 | // don't trigger deprecations for internal uses |
| 1000 | 1000 | // @deprecated since version 3.3, to be removed in 4.0 along with the deprecated class |
| 1001 | 1001 | $deprecationAllowlist = ['event_dispatcher' => ContainerAwareEventDispatcher::class]; |
| 1002 | - if (!$definition->isDeprecated() && 0 < \strpos($r->getDocComment(), "\n * @deprecated ") && (!isset($deprecationAllowlist[$id]) || $deprecationAllowlist[$id] !== $class)) { |
|
| 1002 | + if ( ! $definition->isDeprecated() && 0 < \strpos($r->getDocComment(), "\n * @deprecated ") && ( ! isset($deprecationAllowlist[$id]) || $deprecationAllowlist[$id] !== $class)) { |
|
| 1003 | 1003 | @\trigger_error(\sprintf('The "%s" service relies on the deprecated "%s" class. It should either be deprecated or its implementation upgraded.', $id, $r->name), \E_USER_DEPRECATED); |
| 1004 | 1004 | } |
| 1005 | 1005 | } |
| 1006 | - if ($tryProxy || !$definition->isLazy()) { |
|
| 1006 | + if ($tryProxy || ! $definition->isLazy()) { |
|
| 1007 | 1007 | // share only if proxying failed, or if not a proxy |
| 1008 | 1008 | $this->shareService($definition, $service, $id, $inlineServices); |
| 1009 | 1009 | } |
@@ -1023,7 +1023,7 @@ discard block |
||
| 1023 | 1023 | $callable[0] = $this->createService($callable[0], $inlineServices); |
| 1024 | 1024 | } |
| 1025 | 1025 | } |
| 1026 | - if (!\is_callable($callable)) { |
|
| 1026 | + if ( ! \is_callable($callable)) { |
|
| 1027 | 1027 | throw new InvalidArgumentException(\sprintf('The configure callable for class "%s" is not a callable.', \get_class($service))); |
| 1028 | 1028 | } |
| 1029 | 1029 | \call_user_func($callable, $service); |
@@ -1050,34 +1050,34 @@ discard block |
||
| 1050 | 1050 | } |
| 1051 | 1051 | } elseif ($value instanceof ServiceClosureArgument) { |
| 1052 | 1052 | $reference = $value->getValues()[0]; |
| 1053 | - $value = function () use($reference) { |
|
| 1053 | + $value = function() use($reference) { |
|
| 1054 | 1054 | return $this->resolveServices($reference); |
| 1055 | 1055 | }; |
| 1056 | 1056 | } elseif ($value instanceof IteratorArgument) { |
| 1057 | - $value = new RewindableGenerator(function () use($value) { |
|
| 1057 | + $value = new RewindableGenerator(function() use($value) { |
|
| 1058 | 1058 | foreach ($value->getValues() as $k => $v) { |
| 1059 | 1059 | foreach (self::getServiceConditionals($v) as $s) { |
| 1060 | - if (!$this->has($s)) { |
|
| 1060 | + if ( ! $this->has($s)) { |
|
| 1061 | 1061 | continue 2; |
| 1062 | 1062 | } |
| 1063 | 1063 | } |
| 1064 | 1064 | foreach (self::getInitializedConditionals($v) as $s) { |
| 1065 | - if (!$this->doGet($s, ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE)) { |
|
| 1065 | + if ( ! $this->doGet($s, ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE)) { |
|
| 1066 | 1066 | continue 2; |
| 1067 | 1067 | } |
| 1068 | 1068 | } |
| 1069 | 1069 | (yield $k => $this->resolveServices($v)); |
| 1070 | 1070 | } |
| 1071 | - }, function () use($value) { |
|
| 1071 | + }, function() use($value) { |
|
| 1072 | 1072 | $count = 0; |
| 1073 | 1073 | foreach ($value->getValues() as $v) { |
| 1074 | 1074 | foreach (self::getServiceConditionals($v) as $s) { |
| 1075 | - if (!$this->has($s)) { |
|
| 1075 | + if ( ! $this->has($s)) { |
|
| 1076 | 1076 | continue 2; |
| 1077 | 1077 | } |
| 1078 | 1078 | } |
| 1079 | 1079 | foreach (self::getInitializedConditionals($v) as $s) { |
| 1080 | - if (!$this->doGet($s, ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE)) { |
|
| 1080 | + if ( ! $this->doGet($s, ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE)) { |
|
| 1081 | 1081 | continue 2; |
| 1082 | 1082 | } |
| 1083 | 1083 | } |
@@ -1171,7 +1171,7 @@ discard block |
||
| 1171 | 1171 | */ |
| 1172 | 1172 | public function registerForAutoconfiguration($interface) |
| 1173 | 1173 | { |
| 1174 | - if (!isset($this->autoconfiguredInstanceof[$interface])) { |
|
| 1174 | + if ( ! isset($this->autoconfiguredInstanceof[$interface])) { |
|
| 1175 | 1175 | $this->autoconfiguredInstanceof[$interface] = new ChildDefinition(''); |
| 1176 | 1176 | } |
| 1177 | 1177 | return $this->autoconfiguredInstanceof[$interface]; |
@@ -1212,7 +1212,7 @@ discard block |
||
| 1212 | 1212 | } |
| 1213 | 1213 | return $result; |
| 1214 | 1214 | } |
| 1215 | - if (!\is_string($value) || 38 > \strlen($value)) { |
|
| 1215 | + if ( ! \is_string($value) || 38 > \strlen($value)) { |
|
| 1216 | 1216 | return $value; |
| 1217 | 1217 | } |
| 1218 | 1218 | $envPlaceholders = $bag instanceof EnvPlaceholderParameterBag ? $bag->getEnvPlaceholders() : $this->envPlaceholders; |
@@ -1229,7 +1229,7 @@ discard block |
||
| 1229 | 1229 | $value = $resolved; |
| 1230 | 1230 | $completed = \true; |
| 1231 | 1231 | } else { |
| 1232 | - if (!\is_string($resolved) && !\is_numeric($resolved)) { |
|
| 1232 | + if ( ! \is_string($resolved) && ! \is_numeric($resolved)) { |
|
| 1233 | 1233 | throw new RuntimeException(\sprintf('A string value must be composed of strings and/or numbers, but found parameter "env(%s)" of type "%s" inside string value "%s".', $env, \gettype($resolved), $this->resolveEnvPlaceholders($value))); |
| 1234 | 1234 | } |
| 1235 | 1235 | $value = \str_ireplace($placeholder, $resolved, $value); |
@@ -1254,7 +1254,7 @@ discard block |
||
| 1254 | 1254 | $bag = $this->getParameterBag(); |
| 1255 | 1255 | $envPlaceholders = $bag instanceof EnvPlaceholderParameterBag ? $bag->getEnvPlaceholders() : $this->envPlaceholders; |
| 1256 | 1256 | foreach ($envPlaceholders as $env => $placeholders) { |
| 1257 | - if (!isset($this->envCounters[$env])) { |
|
| 1257 | + if ( ! isset($this->envCounters[$env])) { |
|
| 1258 | 1258 | $this->envCounters[$env] = 0; |
| 1259 | 1259 | } |
| 1260 | 1260 | } |
@@ -1285,7 +1285,7 @@ discard block |
||
| 1285 | 1285 | */ |
| 1286 | 1286 | public function normalizeId($id) |
| 1287 | 1287 | { |
| 1288 | - if (!\is_string($id)) { |
|
| 1288 | + if ( ! \is_string($id)) { |
|
| 1289 | 1289 | $id = (string) $id; |
| 1290 | 1290 | } |
| 1291 | 1291 | return isset($this->definitions[$id]) || isset($this->aliasDefinitions[$id]) || isset($this->removedIds[$id]) ? $id : parent::normalizeId($id); |
@@ -1378,7 +1378,7 @@ discard block |
||
| 1378 | 1378 | { |
| 1379 | 1379 | $value = parent::getEnv($name); |
| 1380 | 1380 | $bag = $this->getParameterBag(); |
| 1381 | - if (!\is_string($value) || !$bag instanceof EnvPlaceholderParameterBag) { |
|
| 1381 | + if ( ! \is_string($value) || ! $bag instanceof EnvPlaceholderParameterBag) { |
|
| 1382 | 1382 | return $value; |
| 1383 | 1383 | } |
| 1384 | 1384 | foreach ($bag->getEnvPlaceholders() as $env => $placeholders) { |
@@ -1397,12 +1397,12 @@ discard block |
||
| 1397 | 1397 | private function callMethod($service, $call, array &$inlineServices) |
| 1398 | 1398 | { |
| 1399 | 1399 | foreach (self::getServiceConditionals($call[1]) as $s) { |
| 1400 | - if (!$this->has($s)) { |
|
| 1400 | + if ( ! $this->has($s)) { |
|
| 1401 | 1401 | return; |
| 1402 | 1402 | } |
| 1403 | 1403 | } |
| 1404 | 1404 | foreach (self::getInitializedConditionals($call[1]) as $s) { |
| 1405 | - if (!$this->doGet($s, ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE, $inlineServices)) { |
|
| 1405 | + if ( ! $this->doGet($s, ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE, $inlineServices)) { |
|
| 1406 | 1406 | return; |
| 1407 | 1407 | } |
| 1408 | 1408 | } |
@@ -1425,7 +1425,7 @@ discard block |
||
| 1425 | 1425 | private function getExpressionLanguage() |
| 1426 | 1426 | { |
| 1427 | 1427 | if (null === $this->expressionLanguage) { |
| 1428 | - if (!\class_exists('Wordlift\\Modules\\Plugin_Installer_Dependencies\\Symfony\\Component\\ExpressionLanguage\\ExpressionLanguage')) { |
|
| 1428 | + if ( ! \class_exists('Wordlift\\Modules\\Plugin_Installer_Dependencies\\Symfony\\Component\\ExpressionLanguage\\ExpressionLanguage')) { |
|
| 1429 | 1429 | throw new RuntimeException('Unable to use expressions as the Symfony ExpressionLanguage component is not installed.'); |
| 1430 | 1430 | } |
| 1431 | 1431 | $this->expressionLanguage = new ExpressionLanguage(null, $this->expressionLanguageProviders); |
@@ -1441,7 +1441,7 @@ discard block |
||
| 1441 | 1441 | } |
| 1442 | 1442 | $path = \realpath($path) ?: $path; |
| 1443 | 1443 | foreach ($this->vendors as $vendor) { |
| 1444 | - if (0 === \strpos($path, $vendor) && \false !== \strpbrk(\substr($path, \strlen($vendor), 1), '/' . \DIRECTORY_SEPARATOR)) { |
|
| 1444 | + if (0 === \strpos($path, $vendor) && \false !== \strpbrk(\substr($path, \strlen($vendor), 1), '/'.\DIRECTORY_SEPARATOR)) { |
|
| 1445 | 1445 | return \true; |
| 1446 | 1446 | } |
| 1447 | 1447 | } |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | if (\is_int($index) && ($index < 0 || $index > \count($this->arguments) - 1)) { |
| 230 | 230 | throw new OutOfBoundsException(\sprintf('The index "%d" is not in the range [0, %d].', $index, \count($this->arguments) - 1)); |
| 231 | 231 | } |
| 232 | - if (!\array_key_exists($index, $this->arguments)) { |
|
| 232 | + if ( ! \array_key_exists($index, $this->arguments)) { |
|
| 233 | 233 | throw new OutOfBoundsException(\sprintf('The argument "%s" doesn\'t exist.', $index)); |
| 234 | 234 | } |
| 235 | 235 | $this->arguments[$index] = $argument; |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | */ |
| 269 | 269 | public function getArgument($index) |
| 270 | 270 | { |
| 271 | - if (!\array_key_exists($index, $this->arguments)) { |
|
| 271 | + if ( ! \array_key_exists($index, $this->arguments)) { |
|
| 272 | 272 | throw new OutOfBoundsException(\sprintf('The argument "%s" doesn\'t exist.', $index)); |
| 273 | 273 | } |
| 274 | 274 | return $this->arguments[$index]; |
@@ -815,7 +815,7 @@ discard block |
||
| 815 | 815 | public function setBindings(array $bindings) |
| 816 | 816 | { |
| 817 | 817 | foreach ($bindings as $key => $binding) { |
| 818 | - if (!$binding instanceof BoundArgument) { |
|
| 818 | + if ( ! $binding instanceof BoundArgument) { |
|
| 819 | 819 | $bindings[$key] = new BoundArgument($binding); |
| 820 | 820 | } |
| 821 | 821 | } |
@@ -34,14 +34,14 @@ discard block |
||
| 34 | 34 | } else { |
| 35 | 35 | $type = \method_exists($r, 'getReturnType') ? $r->getReturnType() : null; |
| 36 | 36 | } |
| 37 | - if (!$type) { |
|
| 37 | + if ( ! $type) { |
|
| 38 | 38 | return null; |
| 39 | 39 | } |
| 40 | 40 | $types = []; |
| 41 | 41 | foreach ($type instanceof \ReflectionUnionType ? $type->getTypes() : [$type] as $type) { |
| 42 | 42 | $name = $type instanceof \ReflectionNamedType ? $type->getName() : (string) $type; |
| 43 | - if (!\is_string($type) && $type->isBuiltin()) { |
|
| 44 | - if (!$noBuiltin) { |
|
| 43 | + if ( ! \is_string($type) && $type->isBuiltin()) { |
|
| 44 | + if ( ! $noBuiltin) { |
|
| 45 | 45 | $types[] = $name; |
| 46 | 46 | } |
| 47 | 47 | continue; |
@@ -49,16 +49,16 @@ discard block |
||
| 49 | 49 | $lcName = \strtolower($name); |
| 50 | 50 | $prefix = $noBuiltin ? '' : '\\'; |
| 51 | 51 | if ('self' !== $lcName && 'parent' !== $lcName) { |
| 52 | - $types[] = '' !== $prefix ? $prefix . $name : $name; |
|
| 52 | + $types[] = '' !== $prefix ? $prefix.$name : $name; |
|
| 53 | 53 | continue; |
| 54 | 54 | } |
| 55 | - if (!$r instanceof \ReflectionMethod) { |
|
| 55 | + if ( ! $r instanceof \ReflectionMethod) { |
|
| 56 | 56 | continue; |
| 57 | 57 | } |
| 58 | 58 | if ('self' === $lcName) { |
| 59 | - $types[] = $prefix . $r->getDeclaringClass()->name; |
|
| 59 | + $types[] = $prefix.$r->getDeclaringClass()->name; |
|
| 60 | 60 | } else { |
| 61 | - $types[] = ($parent = $r->getDeclaringClass()->getParentClass()) ? $prefix . $parent->name : null; |
|
| 61 | + $types[] = ($parent = $r->getDeclaringClass()->getParentClass()) ? $prefix.$parent->name : null; |
|
| 62 | 62 | } |
| 63 | 63 | } |
| 64 | 64 | return $types ? \implode('|', $types) : null; |
@@ -38,12 +38,12 @@ discard block |
||
| 38 | 38 | public function copy($originFile, $targetFile, $overwriteNewerFiles = \false) |
| 39 | 39 | { |
| 40 | 40 | $originIsLocal = \stream_is_local($originFile) || 0 === \stripos($originFile, 'file://'); |
| 41 | - if ($originIsLocal && !\is_file($originFile)) { |
|
| 41 | + if ($originIsLocal && ! \is_file($originFile)) { |
|
| 42 | 42 | throw new FileNotFoundException(\sprintf('Failed to copy "%s" because file does not exist.', $originFile), 0, null, $originFile); |
| 43 | 43 | } |
| 44 | 44 | $this->mkdir(\dirname($targetFile)); |
| 45 | 45 | $doCopy = \true; |
| 46 | - if (!$overwriteNewerFiles && null === \parse_url($originFile, \PHP_URL_HOST) && \is_file($targetFile)) { |
|
| 46 | + if ( ! $overwriteNewerFiles && null === \parse_url($originFile, \PHP_URL_HOST) && \is_file($targetFile)) { |
|
| 47 | 47 | $doCopy = \filemtime($originFile) > \filemtime($targetFile); |
| 48 | 48 | } |
| 49 | 49 | if ($doCopy) { |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | \fclose($source); |
| 60 | 60 | \fclose($target); |
| 61 | 61 | unset($source, $target); |
| 62 | - if (!\is_file($targetFile)) { |
|
| 62 | + if ( ! \is_file($targetFile)) { |
|
| 63 | 63 | throw new IOException(\sprintf('Failed to copy "%s" to "%s".', $originFile, $targetFile), 0, null, $originFile); |
| 64 | 64 | } |
| 65 | 65 | if ($originIsLocal) { |
@@ -85,11 +85,11 @@ discard block |
||
| 85 | 85 | if (\is_dir($dir)) { |
| 86 | 86 | continue; |
| 87 | 87 | } |
| 88 | - if (!self::box('mkdir', $dir, $mode, \true)) { |
|
| 89 | - if (!\is_dir($dir)) { |
|
| 88 | + if ( ! self::box('mkdir', $dir, $mode, \true)) { |
|
| 89 | + if ( ! \is_dir($dir)) { |
|
| 90 | 90 | // The directory was not created by a concurrent process. Let's throw an exception with a developer friendly error message if we have one |
| 91 | 91 | if (self::$lastError) { |
| 92 | - throw new IOException(\sprintf('Failed to create "%s": ', $dir) . self::$lastError, 0, null, $dir); |
|
| 92 | + throw new IOException(\sprintf('Failed to create "%s": ', $dir).self::$lastError, 0, null, $dir); |
|
| 93 | 93 | } |
| 94 | 94 | throw new IOException(\sprintf('Failed to create "%s".', $dir), 0, null, $dir); |
| 95 | 95 | } |
@@ -105,12 +105,12 @@ discard block |
||
| 105 | 105 | */ |
| 106 | 106 | public function exists($files) |
| 107 | 107 | { |
| 108 | - $maxPathLength = \PHP_MAXPATHLEN - 2; |
|
| 108 | + $maxPathLength = \PHP_MAXPATHLEN -2; |
|
| 109 | 109 | foreach ($this->toIterable($files) as $file) { |
| 110 | 110 | if (\strlen($file) > $maxPathLength) { |
| 111 | 111 | throw new IOException(\sprintf('Could not check if file exist because path length exceeds %d characters.', $maxPathLength), 0, null, $file); |
| 112 | 112 | } |
| 113 | - if (!\file_exists($file)) { |
|
| 113 | + if ( ! \file_exists($file)) { |
|
| 114 | 114 | return \false; |
| 115 | 115 | } |
| 116 | 116 | } |
@@ -145,23 +145,23 @@ discard block |
||
| 145 | 145 | { |
| 146 | 146 | if ($files instanceof \Traversable) { |
| 147 | 147 | $files = \iterator_to_array($files, \false); |
| 148 | - } elseif (!\is_array($files)) { |
|
| 148 | + } elseif ( ! \is_array($files)) { |
|
| 149 | 149 | $files = [$files]; |
| 150 | 150 | } |
| 151 | 151 | $files = \array_reverse($files); |
| 152 | 152 | foreach ($files as $file) { |
| 153 | 153 | if (\is_link($file)) { |
| 154 | 154 | // See https://bugs.php.net/52176 |
| 155 | - if (!(self::box('unlink', $file) || '\\' !== \DIRECTORY_SEPARATOR || self::box('rmdir', $file)) && \file_exists($file)) { |
|
| 156 | - throw new IOException(\sprintf('Failed to remove symlink "%s": ', $file) . self::$lastError); |
|
| 155 | + if ( ! (self::box('unlink', $file) || '\\' !== \DIRECTORY_SEPARATOR || self::box('rmdir', $file)) && \file_exists($file)) { |
|
| 156 | + throw new IOException(\sprintf('Failed to remove symlink "%s": ', $file).self::$lastError); |
|
| 157 | 157 | } |
| 158 | 158 | } elseif (\is_dir($file)) { |
| 159 | 159 | $this->remove(new \FilesystemIterator($file, \FilesystemIterator::CURRENT_AS_PATHNAME | \FilesystemIterator::SKIP_DOTS)); |
| 160 | - if (!self::box('rmdir', $file) && \file_exists($file)) { |
|
| 161 | - throw new IOException(\sprintf('Failed to remove directory "%s": ', $file) . self::$lastError); |
|
| 160 | + if ( ! self::box('rmdir', $file) && \file_exists($file)) { |
|
| 161 | + throw new IOException(\sprintf('Failed to remove directory "%s": ', $file).self::$lastError); |
|
| 162 | 162 | } |
| 163 | - } elseif (!self::box('unlink', $file) && (\str_contains(self::$lastError, 'Permission denied') || \file_exists($file))) { |
|
| 164 | - throw new IOException(\sprintf('Failed to remove file "%s": ', $file) . self::$lastError); |
|
| 163 | + } elseif ( ! self::box('unlink', $file) && (\str_contains(self::$lastError, 'Permission denied') || \file_exists($file))) { |
|
| 164 | + throw new IOException(\sprintf('Failed to remove file "%s": ', $file).self::$lastError); |
|
| 165 | 165 | } |
| 166 | 166 | } |
| 167 | 167 | } |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | if ((\PHP_VERSION_ID < 80000 || \is_int($mode)) && \true !== @\chmod($file, $mode & ~$umask)) { |
| 182 | 182 | throw new IOException(\sprintf('Failed to chmod file "%s".', $file), 0, null, $file); |
| 183 | 183 | } |
| 184 | - if ($recursive && \is_dir($file) && !\is_link($file)) { |
|
| 184 | + if ($recursive && \is_dir($file) && ! \is_link($file)) { |
|
| 185 | 185 | $this->chmod(new \FilesystemIterator($file), $mode, $umask, \true); |
| 186 | 186 | } |
| 187 | 187 | } |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | public function chown($files, $user, $recursive = \false) |
| 199 | 199 | { |
| 200 | 200 | foreach ($this->toIterable($files) as $file) { |
| 201 | - if ($recursive && \is_dir($file) && !\is_link($file)) { |
|
| 201 | + if ($recursive && \is_dir($file) && ! \is_link($file)) { |
|
| 202 | 202 | $this->chown(new \FilesystemIterator($file), $user, \true); |
| 203 | 203 | } |
| 204 | 204 | if (\is_link($file) && \function_exists('lchown')) { |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | public function chgrp($files, $group, $recursive = \false) |
| 225 | 225 | { |
| 226 | 226 | foreach ($this->toIterable($files) as $file) { |
| 227 | - if ($recursive && \is_dir($file) && !\is_link($file)) { |
|
| 227 | + if ($recursive && \is_dir($file) && ! \is_link($file)) { |
|
| 228 | 228 | $this->chgrp(new \FilesystemIterator($file), $group, \true); |
| 229 | 229 | } |
| 230 | 230 | if (\is_link($file) && \function_exists('lchgrp')) { |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | public function rename($origin, $target, $overwrite = \false) |
| 252 | 252 | { |
| 253 | 253 | // we check that target does not exist |
| 254 | - if (!$overwrite && $this->isReadable($target)) { |
|
| 254 | + if ( ! $overwrite && $this->isReadable($target)) { |
|
| 255 | 255 | throw new IOException(\sprintf('Cannot rename because the target "%s" already exists.', $target), 0, null, $target); |
| 256 | 256 | } |
| 257 | 257 | if (\true !== @\rename($origin, $target)) { |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | */ |
| 272 | 272 | private function isReadable(string $filename) : bool |
| 273 | 273 | { |
| 274 | - $maxPathLength = \PHP_MAXPATHLEN - 2; |
|
| 274 | + $maxPathLength = \PHP_MAXPATHLEN -2; |
|
| 275 | 275 | if (\strlen($filename) > $maxPathLength) { |
| 276 | 276 | throw new IOException(\sprintf('Could not check if file is readable because path length exceeds %d characters.', $maxPathLength), 0, null, $filename); |
| 277 | 277 | } |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | } |
| 305 | 305 | $this->remove($targetDir); |
| 306 | 306 | } |
| 307 | - if (!self::box('symlink', $originDir, $targetDir)) { |
|
| 307 | + if ( ! self::box('symlink', $originDir, $targetDir)) { |
|
| 308 | 308 | $this->linkException($originDir, $targetDir, 'symbolic'); |
| 309 | 309 | } |
| 310 | 310 | } |
@@ -320,10 +320,10 @@ discard block |
||
| 320 | 320 | public function hardlink($originFile, $targetFiles) |
| 321 | 321 | { |
| 322 | 322 | self::assertFunctionExists('link'); |
| 323 | - if (!$this->exists($originFile)) { |
|
| 323 | + if ( ! $this->exists($originFile)) { |
|
| 324 | 324 | throw new FileNotFoundException(null, 0, null, $originFile); |
| 325 | 325 | } |
| 326 | - if (!\is_file($originFile)) { |
|
| 326 | + if ( ! \is_file($originFile)) { |
|
| 327 | 327 | throw new FileNotFoundException(\sprintf('Origin file "%s" is not a file.', $originFile)); |
| 328 | 328 | } |
| 329 | 329 | foreach ($this->toIterable($targetFiles) as $targetFile) { |
@@ -333,7 +333,7 @@ discard block |
||
| 333 | 333 | } |
| 334 | 334 | $this->remove($targetFile); |
| 335 | 335 | } |
| 336 | - if (!self::box('link', $originFile, $targetFile)) { |
|
| 336 | + if ( ! self::box('link', $originFile, $targetFile)) { |
|
| 337 | 337 | $this->linkException($originFile, $targetFile, 'hard'); |
| 338 | 338 | } |
| 339 | 339 | } |
@@ -368,11 +368,11 @@ discard block |
||
| 368 | 368 | */ |
| 369 | 369 | public function readlink($path, $canonicalize = \false) |
| 370 | 370 | { |
| 371 | - if (!$canonicalize && !\is_link($path)) { |
|
| 371 | + if ( ! $canonicalize && ! \is_link($path)) { |
|
| 372 | 372 | return null; |
| 373 | 373 | } |
| 374 | 374 | if ($canonicalize) { |
| 375 | - if (!$this->exists($path)) { |
|
| 375 | + if ( ! $this->exists($path)) { |
|
| 376 | 376 | return null; |
| 377 | 377 | } |
| 378 | 378 | if ('\\' === \DIRECTORY_SEPARATOR && \PHP_VERSION_ID < 70410) { |
@@ -395,10 +395,10 @@ discard block |
||
| 395 | 395 | */ |
| 396 | 396 | public function makePathRelative($endPath, $startPath) |
| 397 | 397 | { |
| 398 | - if (!$this->isAbsolutePath($startPath)) { |
|
| 398 | + if ( ! $this->isAbsolutePath($startPath)) { |
|
| 399 | 399 | throw new InvalidArgumentException(\sprintf('The start path "%s" is not absolute.', $startPath)); |
| 400 | 400 | } |
| 401 | - if (!$this->isAbsolutePath($endPath)) { |
|
| 401 | + if ( ! $this->isAbsolutePath($endPath)) { |
|
| 402 | 402 | throw new InvalidArgumentException(\sprintf('The end path "%s" is not absolute.', $endPath)); |
| 403 | 403 | } |
| 404 | 404 | // Normalize separators on Windows |
@@ -406,10 +406,10 @@ discard block |
||
| 406 | 406 | $endPath = \str_replace('\\', '/', $endPath); |
| 407 | 407 | $startPath = \str_replace('\\', '/', $startPath); |
| 408 | 408 | } |
| 409 | - $splitDriveLetter = function ($path) { |
|
| 409 | + $splitDriveLetter = function($path) { |
|
| 410 | 410 | return \strlen($path) > 2 && ':' === $path[1] && '/' === $path[2] && \ctype_alpha($path[0]) ? [\substr($path, 2), \strtoupper($path[0])] : [$path, null]; |
| 411 | 411 | }; |
| 412 | - $splitPath = function ($path) { |
|
| 412 | + $splitPath = function($path) { |
|
| 413 | 413 | $result = []; |
| 414 | 414 | foreach (\explode('/', \trim($path, '/')) as $segment) { |
| 415 | 415 | if ('..' === $segment) { |
@@ -426,7 +426,7 @@ discard block |
||
| 426 | 426 | $endPathArr = $splitPath($endPath); |
| 427 | 427 | if ($endDriveLetter && $startDriveLetter && $endDriveLetter != $startDriveLetter) { |
| 428 | 428 | // End path is on another drive, so no relative path exists |
| 429 | - return $endDriveLetter . ':/' . ($endPathArr ? \implode('/', $endPathArr) . '/' : ''); |
|
| 429 | + return $endDriveLetter.':/'.($endPathArr ? \implode('/', $endPathArr).'/' : ''); |
|
| 430 | 430 | } |
| 431 | 431 | // Find for which directory the common path stops |
| 432 | 432 | $index = 0; |
@@ -443,7 +443,7 @@ discard block |
||
| 443 | 443 | $traverser = \str_repeat('../', $depth); |
| 444 | 444 | $endPathRemainder = \implode('/', \array_slice($endPathArr, $index)); |
| 445 | 445 | // Construct $endPath from traversing to the common path, then to the remaining $endPath |
| 446 | - $relativePath = $traverser . ('' !== $endPathRemainder ? $endPathRemainder . '/' : ''); |
|
| 446 | + $relativePath = $traverser.('' !== $endPathRemainder ? $endPathRemainder.'/' : ''); |
|
| 447 | 447 | return '' === $relativePath ? './' : $relativePath; |
| 448 | 448 | } |
| 449 | 449 | /** |
@@ -470,7 +470,7 @@ discard block |
||
| 470 | 470 | $targetDir = \rtrim($targetDir, '/\\'); |
| 471 | 471 | $originDir = \rtrim($originDir, '/\\'); |
| 472 | 472 | $originDirLen = \strlen($originDir); |
| 473 | - if (!$this->exists($originDir)) { |
|
| 473 | + if ( ! $this->exists($originDir)) { |
|
| 474 | 474 | throw new IOException(\sprintf('The origin directory specified "%s" was not found.', $originDir), 0, null, $originDir); |
| 475 | 475 | } |
| 476 | 476 | // Iterate in destination folder to remove obsolete entries |
@@ -482,8 +482,8 @@ discard block |
||
| 482 | 482 | } |
| 483 | 483 | $targetDirLen = \strlen($targetDir); |
| 484 | 484 | foreach ($deleteIterator as $file) { |
| 485 | - $origin = $originDir . \substr($file->getPathname(), $targetDirLen); |
|
| 486 | - if (!$this->exists($origin)) { |
|
| 485 | + $origin = $originDir.\substr($file->getPathname(), $targetDirLen); |
|
| 486 | + if ( ! $this->exists($origin)) { |
|
| 487 | 487 | $this->remove($file); |
| 488 | 488 | } |
| 489 | 489 | } |
@@ -499,9 +499,9 @@ discard block |
||
| 499 | 499 | if ($file->getPathname() === $targetDir || $file->getRealPath() === $targetDir || isset($filesCreatedWhileMirroring[$file->getRealPath()])) { |
| 500 | 500 | continue; |
| 501 | 501 | } |
| 502 | - $target = $targetDir . \substr($file->getPathname(), $originDirLen); |
|
| 502 | + $target = $targetDir.\substr($file->getPathname(), $originDirLen); |
|
| 503 | 503 | $filesCreatedWhileMirroring[$target] = \true; |
| 504 | - if (!$copyOnWindows && \is_link($file)) { |
|
| 504 | + if ( ! $copyOnWindows && \is_link($file)) { |
|
| 505 | 505 | $this->symlink($file->getLinkTarget(), $target); |
| 506 | 506 | } elseif (\is_dir($file)) { |
| 507 | 507 | $this->mkdir($target); |
@@ -544,7 +544,7 @@ discard block |
||
| 544 | 544 | // If tempnam failed or no scheme return the filename otherwise prepend the scheme |
| 545 | 545 | if (\false !== $tmpFile) { |
| 546 | 546 | if (null !== $scheme && 'gs' !== $scheme) { |
| 547 | - return $scheme . '://' . $tmpFile; |
|
| 547 | + return $scheme.'://'.$tmpFile; |
|
| 548 | 548 | } |
| 549 | 549 | return $tmpFile; |
| 550 | 550 | } |
@@ -553,7 +553,7 @@ discard block |
||
| 553 | 553 | // Loop until we create a valid temp file or have reached 10 attempts |
| 554 | 554 | for ($i = 0; $i < 10; ++$i) { |
| 555 | 555 | // Create a unique filename |
| 556 | - $tmpFile = $dir . '/' . $prefix . \uniqid(\mt_rand(), \true); |
|
| 556 | + $tmpFile = $dir.'/'.$prefix.\uniqid(\mt_rand(), \true); |
|
| 557 | 557 | // Use fopen instead of file_exists as some streams do not support stat |
| 558 | 558 | // Use mode 'x+' to atomically check existence and create to avoid a TOCTOU vulnerability |
| 559 | 559 | $handle = @\fopen($tmpFile, 'x+'); |
@@ -581,7 +581,7 @@ discard block |
||
| 581 | 581 | @\trigger_error(\sprintf('Calling "%s()" with an array in the $content argument is deprecated since Symfony 4.3.', __METHOD__), \E_USER_DEPRECATED); |
| 582 | 582 | } |
| 583 | 583 | $dir = \dirname($filename); |
| 584 | - if (!\is_dir($dir)) { |
|
| 584 | + if ( ! \is_dir($dir)) { |
|
| 585 | 585 | $this->mkdir($dir); |
| 586 | 586 | } |
| 587 | 587 | // Will create a temp file with 0600 access rights |
@@ -613,7 +613,7 @@ discard block |
||
| 613 | 613 | @\trigger_error(\sprintf('Calling "%s()" with an array in the $content argument is deprecated since Symfony 4.3.', __METHOD__), \E_USER_DEPRECATED); |
| 614 | 614 | } |
| 615 | 615 | $dir = \dirname($filename); |
| 616 | - if (!\is_dir($dir)) { |
|
| 616 | + if ( ! \is_dir($dir)) { |
|
| 617 | 617 | $this->mkdir($dir); |
| 618 | 618 | } |
| 619 | 619 | if (\false === @\file_put_contents($filename, $content, \FILE_APPEND)) { |
@@ -634,7 +634,7 @@ discard block |
||
| 634 | 634 | } |
| 635 | 635 | private static function assertFunctionExists(string $func) : void |
| 636 | 636 | { |
| 637 | - if (!\function_exists($func)) { |
|
| 637 | + if ( ! \function_exists($func)) { |
|
| 638 | 638 | throw new IOException(\sprintf('Unable to perform filesystem operation because the "%s()" function has been disabled.', $func)); |
| 639 | 639 | } |
| 640 | 640 | } |
@@ -647,7 +647,7 @@ discard block |
||
| 647 | 647 | { |
| 648 | 648 | self::assertFunctionExists($func); |
| 649 | 649 | self::$lastError = null; |
| 650 | - \set_error_handler(__CLASS__ . '::handleError'); |
|
| 650 | + \set_error_handler(__CLASS__.'::handleError'); |
|
| 651 | 651 | try { |
| 652 | 652 | $result = $func(...$args); |
| 653 | 653 | \restore_error_handler(); |