Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergey Surkov committed Aug 28, 2021
1 parent d3b43c1 commit 26bc324
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 18 deletions.
12 changes: 6 additions & 6 deletions src/Apps/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function getAppTitle(): string
return $this['config']->getAppName();
}

public function getRoutingProvider(): string
public function getRoutingProvider(): ?string
{
return $this['config']->getRoutingProvider();
}
Expand All @@ -64,7 +64,7 @@ public function hasParentApp(): bool
return $this['config']->hasParentApp();
}

public function getParentAppId(): string
public function getParentAppId(): ?string
{
return $this['config']->getParentAppId();
}
Expand Down Expand Up @@ -117,7 +117,7 @@ protected function registerProviders()
* @param string|null $path
* @return string|null
*/
public function getBasePath(string $path = null)
public function getBasePath(string $path = null): ?string
{
$base = $this('config::base_path');
return $base ? ($path ? $base . \_DS\DS . ltrim($path) : $base) : null;
Expand All @@ -127,7 +127,7 @@ public function getBasePath(string $path = null)
* @return string|null
* @deprecated
*/
public function getAssetsPath()
public function getAssetsPath(): ?string
{
return $this->getBasePath('assets');
}
Expand All @@ -136,15 +136,15 @@ public function getAssetsPath()
* @return string|null
* @deprecated
*/
public function getResourcesPath()
public function getResourcesPath(): ?string
{
return $this->getBasePath('resources');
}

/**
* @return ApplicationInterface|null
*/
protected function getParentApp()
protected function getParentApp(): ?ApplicationInterface
{
return $this->hasParentApp() ? $this[AppsRepositoryInterface::class]->get($this->getParentAppId()) : null;
}
Expand Down
6 changes: 3 additions & 3 deletions src/Apps/ApplicationInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@
interface ApplicationInterface extends AppConfigInterface, DIContainerInterface, ServiceContainerInterface
{

public function getBasePath(string $path = null);
public function getBasePath(string $path = null): ?string;

/**
* @return string|null
* @deprecated
*/
public function getAssetsPath();
public function getAssetsPath(): ?string;

/**
* @return string|null
* @deprecated
*/
public function getResourcesPath();
public function getResourcesPath(): ?string;

/**
* @param array|\Closure[]|null $bootstraps
Expand Down
5 changes: 4 additions & 1 deletion src/Apps/Bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ public function bootstrap(CoreInterface $app): void
$app['listeners']->add(AppsRoutesRepository::class, function (AppsRoutesRepository $event, AppsRepositoryInterface $appsRepository) {
foreach ($appsRepository->enabled() as $v) {
$provider = $v['routing'] ?? null;
if ($provider && class_exists($provider)) {
if ($provider) {
if(!class_exists($provider)) {
throw new \Exception('Provider ['.$provider.'] class not found!');
}
$event->append(new $provider($v['id'], $v['controllers_namespace']));
}
}
Expand Down
10 changes: 5 additions & 5 deletions src/Container/ItemsContainerTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ trait ItemsContainerTrait /*implements \Dissonance\Container\BaseContainerInterf
*
* @return mixed|null
*/
public function get(string|int $key)
public function get($key)
{
$items = &$this->items;
return $this->hasBy($key,$items) ? $items[$key] :
Expand All @@ -38,7 +38,7 @@ public function get(string|int $key)
* @info
* @return bool
*/
public function has(string|int $key): bool
public function has($key): bool
{
return $this->hasBy($key,$this->items);
}
Expand All @@ -49,7 +49,7 @@ public function has(string|int $key): bool
* @return bool
* @info
*/
private function hasBy(string|int $key, array &$items): bool
private function hasBy($key, &$items): bool
{
return isset($items[$key]) // isset в 4 раза быстрее array_key_exists
|| (is_array($items) && array_key_exists($key, $items))
Expand All @@ -60,7 +60,7 @@ private function hasBy(string|int $key, array &$items): bool
* @param int|string $key
* @param $value
*/
public function set(string|int $key, $value): void
public function set($key, $value): void
{
$this->items[$key] = $value;
}
Expand All @@ -70,7 +70,7 @@ public function set(string|int $key, $value): void
* @param int|string $key
* @return bool
*/
public function delete(string|int $key): bool
public function delete($key): bool
{
unset($this->items[$key]);

Expand Down
3 changes: 1 addition & 2 deletions src/Core/View/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,6 @@ public function layout(string $template, $content_template, $vars = [], $before
return $view;
}


/**
* @param CoreInterface $app
* @uses View::$core
Expand Down Expand Up @@ -457,7 +456,7 @@ public function fetch($content)

protected function getTemplate()
{
return 'use function ' . __NAMESPACE__ . '\\app,asset,route,css,js,adminRoute,apiRoute;'.PHP_EOL.' ?>' . $this->template;
return 'use function ' . __NAMESPACE__ . '\\{app,asset,route,css,js,adminRoute,apiRoute};'.PHP_EOL.' ?>' . $this->template;
}

public function __toString()
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Kernel/HttpRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public function sendResponse(ResponseInterface $response)
$sender = new ResponseSender($response);
$sender->render();
if (\function_exists('fastcgi_finish_request')) {
fastcgi_finish_request();
\fastcgi_finish_request();
} elseif (!\in_array(\PHP_SAPI, ['cli', 'phpdbg'], true)) {
static::closeOutputBuffers(0, true);
}
Expand Down

0 comments on commit 26bc324

Please # to comment.