Skip to content

Commit

Permalink
Revert "uses nette/utils 3.1"
Browse files Browse the repository at this point in the history
This reverts commit 1173496.
This reverts commit 7ad5701.
  • Loading branch information
dg committed Nov 5, 2020
1 parent 9ee6a0f commit fa49cdc
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"nette/php-generator": "^3.3.3",
"nette/robot-loader": "^3.2",
"nette/schema": "^1.0",
"nette/utils": "^3.1"
"nette/utils": "^3.0"
},
"require-dev": {
"nette/tester": "^2.2",
Expand Down
24 changes: 12 additions & 12 deletions src/Bridges/DITracy/ContainerPanel.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ public function __construct(Container $container)
*/
public function getTab(): string
{
return Nette\Utils\Helpers::capture(function () {
$elapsedTime = $this->elapsedTime;
require __DIR__ . '/templates/ContainerPanel.tab.phtml';
});
ob_start(function () {});
$elapsedTime = $this->elapsedTime;
require __DIR__ . '/templates/ContainerPanel.tab.phtml';
return ob_get_clean();
}


Expand All @@ -57,8 +57,12 @@ public function getTab(): string
*/
public function getPanel(): string
{
$rc = new \ReflectionClass($this->container);
$container = $this->container;
$rc = new \ReflectionClass($container);
$file = $rc->getFileName();
$tags = [];
$instances = $this->getContainerProperty('instances');
$wiring = $this->getContainerProperty('wiring');
$types = [];
foreach ($rc->getMethods() as $method) {
if (preg_match('#^createService(.+)#', $method->name, $m) && $method->getReturnType()) {
Expand All @@ -73,13 +77,9 @@ public function getPanel(): string
}
}

return Nette\Utils\Helpers::capture(function () use ($tags, $types, $rc) {
$container = $this->container;
$file = $rc->getFileName();
$instances = $this->getContainerProperty('instances');
$wiring = $this->getContainerProperty('wiring');
require __DIR__ . '/templates/ContainerPanel.panel.phtml';
});
ob_start(function () {});
require __DIR__ . '/templates/ContainerPanel.panel.phtml';
return ob_get_clean();
}


Expand Down
2 changes: 1 addition & 1 deletion src/DI/Compiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ public function processExtensions(): void
throw new Nette\DeprecatedException("Extensions '$extra' were added while container was being compiled.");

} elseif ($extra = key(array_diff_key($this->configs, $this->extensions))) {
$hint = Nette\Utils\Helpers::getSuggestion(array_keys($this->extensions), $extra);
$hint = Nette\Utils\ObjectHelpers::getSuggestion(array_keys($this->extensions), $extra);
throw new InvalidConfigurationException(
"Found section '$extra' in configuration, but corresponding extension is missing"
. ($hint ? ", did you mean '$hint'?" : '.')
Expand Down
2 changes: 1 addition & 1 deletion src/DI/CompilerExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public function validateConfig(array $expected, array $config = null, string $na
}
if ($extra = array_diff_key((array) $config, $expected)) {
$name = $name ? str_replace('.', ' › ', $name) : $this->name;
$hint = Nette\Utils\Helpers::getSuggestion(array_keys($expected), key($extra));
$hint = Nette\Utils\ObjectHelpers::getSuggestion(array_keys($expected), key($extra));
$extra = $hint
? key($extra)
: implode("', '{$name} › ", array_keys($extra));
Expand Down
4 changes: 2 additions & 2 deletions src/DI/ContainerLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ private function loadFile(string $class, callable $generator): void

$handle = @fopen("$file.lock", 'c+'); // @ is escalated to exception
if (!$handle) {
throw new Nette\IOException("Unable to create file '$file.lock'. " . Nette\Utils\Helpers::getLastError());
throw new Nette\IOException("Unable to create file '$file.lock'. " . error_get_last()['message']);
} elseif (!@flock($handle, LOCK_EX)) { // @ is escalated to exception
throw new Nette\IOException("Unable to acquire exclusive lock on '$file.lock'. " . Nette\Utils\Helpers::getLastError());
throw new Nette\IOException("Unable to acquire exclusive lock on '$file.lock'. " . error_get_last()['message']);
}

if (!is_file($file) || $this->isExpired($file, $updatedMeta)) {
Expand Down
2 changes: 1 addition & 1 deletion src/DI/Definitions/FactoryDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ private function completeParameters(Nette\DI\Resolver $resolver): void
$this->resultDefinition->getFactory()->arguments[$arg->getPosition()] = Nette\DI\ContainerBuilder::literal('$' . $arg->name);

} elseif (!$this->resultDefinition->getSetup()) {
$hint = Nette\Utils\Helpers::getSuggestion(array_keys($ctorParams), $param->name);
$hint = Nette\Utils\ObjectHelpers::getSuggestion(array_keys($ctorParams), $param->name);
throw new ServiceCreationException("Unused parameter \${$param->name} when implementing method $interface::create()" . ($hint ? ", did you mean \${$hint}?" : '.'));
}
$nullable = $hint && $param->allowsNull() && (!$param->isDefaultValueAvailable() || $param->getDefaultValue() !== null);
Expand Down

0 comments on commit fa49cdc

Please sign in to comment.