Skip to content

Commit

Permalink
fix php7.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergey Surkov committed Aug 30, 2021
1 parent 8f4e795 commit 6b539c6
Show file tree
Hide file tree
Showing 34 changed files with 89 additions and 89 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"symbiotic web"
],
"require": {
"php": ">=8.0",
"php": ">=7.2",
"psr/http-server-handler": "1.0.*",
"psr/http-server-middleware": "1.0.1",
"psr/http-factory": "1.0.1",
Expand Down
8 changes: 4 additions & 4 deletions src/Apps/AppsRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,21 @@ class AppsRepository implements AppsRepositoryInterface
/**
* @var ApplicationInterface[]
*/
protected array $apps = [];
protected $apps = [];
/**
* @var array
*/
protected array $apps_plugins = [];
protected $apps_plugins = [];

/**
* @var array
*/
protected array $apps_config = [];
protected $apps_config = [];

/**
* @var array
*/
protected array $disabled_apps = [];
protected $disabled_apps = [];

/**
* @param array $ids
Expand Down
12 changes: 6 additions & 6 deletions src/Container/BaseContainerTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ trait BaseContainerTrait /*implements \Symbiotic\Container\BaseContainerInterfac
* @return array|\ArrayAccess
* @todo: Can do protected, on the one hand it is convenient, but to give everyone in a row to manage is not correct!?
*/
abstract protected function &getContainerItems(): array|\ArrayAccess;
abstract protected function &getContainerItems();

/**
* @param string $key
Expand All @@ -28,7 +28,7 @@ abstract protected function &getContainerItems(): array|\ArrayAccess;
*
* @return mixed|null
*/
public function get(string|int $key)
public function get($key)
{
$items = &$this->getContainerItems();
return $this->hasBy($key,$items) ? $items[$key] :
Expand All @@ -43,7 +43,7 @@ public function get(string|int $key)
* @info
* @return bool
*/
public function has(string|int $key): bool
public function has($key): bool
{
$items = &$this->getContainerItems();
return $this->hasBy($key,$items);
Expand All @@ -55,7 +55,7 @@ public function has(string|int $key): bool
* @return bool
* @info
*/
private function hasBy(string|int $key, \ArrayAccess|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 @@ -66,7 +66,7 @@ private function hasBy(string|int $key, \ArrayAccess|array &$items): bool
* @param int|string $key
* @param $value
*/
public function set(string|int $key, $value): void
public function set($key, $value): void
{
$items = &$this->getContainerItems();
$items[$key] = $value;
Expand All @@ -77,7 +77,7 @@ public function set(string|int $key, $value): void
* @param int|string $key
* @return mixed
*/
public function delete(string|int $key): bool
public function delete($key): bool
{
$items = &$this->getContainerItems();
unset($items[$key]);
Expand Down
2 changes: 1 addition & 1 deletion src/Container/CachedContainerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ interface CachedContainerInterface extends DIContainerInterface, \Serializable
* @param string $abstract - ключ сервиса для кеширования, использовать интерфейс с которым был добавлен сервис
*
*/
public function cached(string $abstract, Closure|string $concrete = null, string $alias = null);
public function cached(string $abstract, $concrete = null, string $alias = null);

public function addToCache(string $abstract);
}
8 changes: 4 additions & 4 deletions src/Container/CachedContainerTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ trait CachedContainerTrait /*implements CachedContainerInterface*/
/**
* @var null|CacheInterface
*/
protected ?CacheInterface $container_cache = null;
protected $container_cache = null;

protected string $container_key = '';
protected $container_key = '';
/**
* Массив ключей разрешенных сервисов для кеширования
* @var array|string[]
*/
protected array $allow_cached = [];
protected $allow_cached = [];

/**
* set cache storage
Expand All @@ -47,7 +47,7 @@ public function addToCache(string $abstract)
* @param string $abstract - ключ сервиса для кеширования
*
*/
public function cached(string $abstract, Closure|string $concrete = null, string $alias = null)
public function cached(string $abstract, $concrete = null, string $alias = null)
{

/**
Expand Down
16 changes: 8 additions & 8 deletions src/Container/ContainerTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ public function isAlias(string $name)
* @param bool $shared
* @return void
*/
public function bind(string $abstract, Closure|string $concrete = null, bool $shared = false): void
public function bind(string $abstract, $concrete = null, bool $shared = false): void
{
unset($this->instances[$abstract], $this->aliases[$abstract]);

Expand Down Expand Up @@ -277,7 +277,7 @@ public function getClosure(string $abstract, string $concrete)
* @param bool $shared
* @return $this
*/
public function bindIf(string $abstract, Closure|string $concrete = null, bool $shared = false)
public function bindIf(string $abstract, $concrete = null, bool $shared = false)
{
if (!$this->bound($abstract)) {
$this->bind($abstract, $concrete, $shared);
Expand All @@ -294,7 +294,7 @@ public function bindIf(string $abstract, Closure|string $concrete = null, bool $
* @param string|null $alias
* @return static
*/
public function singleton(string $abstract, Closure|string $concrete = null, string $alias = null)
public function singleton(string $abstract, $concrete = null, string $alias = null)
{
$this->bind($abstract, $concrete, true);
if (is_string($alias)) {
Expand Down Expand Up @@ -459,7 +459,7 @@ public function wrap(\Closure $callback, array $parameters = [], $defaultMethod
* @param string|null $defaultMethod
* @return mixed
*/
public function call(callable|string $callback, array $parameters = [], string $defaultMethod = null)
public function call($callback, array $parameters = [], string $defaultMethod = null)
{
return BoundMethod::call($this, $callback, $parameters, $defaultMethod);
}
Expand Down Expand Up @@ -625,7 +625,7 @@ protected function getContextualConcrete(string $for_building, string $need)
* @param string $abstract
* @return bool
*/
protected function isBuildable(string|\Closure $concrete, string $abstract)
protected function isBuildable($concrete, string $abstract)
{
return $concrete === $abstract || $concrete instanceof \Closure;
}
Expand All @@ -638,7 +638,7 @@ protected function isBuildable(string|\Closure $concrete, string $abstract)
*
* @throws BindingResolutionException|ContainerException
*/
public function build(string|Closure $concrete)
public function build($concrete)
{
// If the concrete type is actually a Closure, we will just execute it and
// hand back the results of the functions, which allows functions to be
Expand Down Expand Up @@ -831,7 +831,7 @@ protected function resolveClass(\ReflectionParameter $parameter)
* @param callable|null $callback closure or Invokable object
* @return void
*/
public function resolving(string|\Closure $abstract, callable $callback = null)
public function resolving($abstract, callable $callback = null)
{
if (is_string($abstract)) {
$abstract = $this->getAlias($abstract);
Expand All @@ -851,7 +851,7 @@ public function resolving(string|\Closure $abstract, callable $callback = null)
* @param callable|null $callback closure or Invokable object
* @return void
*/
public function afterResolving(\Closure|string $abstract, callable $callback = null)
public function afterResolving($abstract, callable $callback = null)
{
if (is_string($abstract)) {
$abstract = $this->getAlias($abstract);
Expand Down
2 changes: 1 addition & 1 deletion src/Container/ContextualBindingBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class ContextualBindingBuilder
* @param string|array $concrete
* @return void
*/
public function __construct(DIContainerInterface $container, string|array $concrete)
public function __construct(DIContainerInterface $container, $concrete)
{
$this->concrete = $concrete;
$this->container = $container;
Expand Down
2 changes: 1 addition & 1 deletion src/Container/ContextualBindingsInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ interface ContextualBindingsInterface
*
* @return ContextualBindingBuilder
*/
public function when(string|array $concrete): ContextualBindingBuilder;
public function when($concrete): ContextualBindingBuilder;


/**
Expand Down
4 changes: 2 additions & 2 deletions src/Container/ContextualBindingsTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ trait ContextualBindingsTrait /*implements ContextualBindingsInterface*/
*
* @var string[][]
*/
public array $contextual = [];
public $contextual = [];

/**
* Define a contextual binding.
*
* @param array|string $concrete
* @return ContextualBindingBuilder
*/
public function when(string|array $concrete): ContextualBindingBuilder
public function when($concrete): ContextualBindingBuilder
{
/**
* @var DIContainerInterface $this
Expand Down
14 changes: 7 additions & 7 deletions src/Container/DIContainerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function alias(string $abstract, string $alias);
* @param bool $shared
* @return void
*/
public function bind(string $abstract, Closure|string $concrete = null, bool $shared = false): void;
public function bind(string $abstract, $concrete = null, bool $shared = false): void;

/**
* Bind a new callback to an abstract's rebind event.
Expand All @@ -59,7 +59,7 @@ public function rebinding(string $abstract, Closure $callback);
* @param bool $shared
* @return void
*/
public function bindIf(string $abstract, Closure|string $concrete = null, bool $shared = false);
public function bindIf(string $abstract, $concrete = null, bool $shared = false);

/**
* Register a shared binding in the container.
Expand All @@ -69,7 +69,7 @@ public function bindIf(string $abstract, Closure|string $concrete = null, bool $
* @param string|null $alias
* @return static
*/
public function singleton(string $abstract, Closure|string $concrete = null, string $alias = null);
public function singleton(string $abstract, $concrete = null, string $alias = null);

/**
* "Extend" an abstract type in the container.
Expand Down Expand Up @@ -109,7 +109,7 @@ public function resolve(string $abstract, array $parameters = [], bool $raiseEve
* @return mixed
* @example function(DependencyInjectionInterface $container, array $params = []){.... return $object;}
*/
public function build(string|Closure $concrete);
public function build($concrete);


/**
Expand All @@ -135,7 +135,7 @@ public function clear():void;
* @param string|null $defaultMethod
* @return mixed
*/
public function call(callable|string $callback, array $parameters = [], string $defaultMethod = null);
public function call($callback, array $parameters = [], string $defaultMethod = null);

/**
* Determine if the given abstract type has been resolved.
Expand All @@ -152,7 +152,7 @@ public function resolved(string $abstract);
* @param callable|null $callback
* @return void
*/
public function resolving(string|Closure $abstract, callable $callback = null);
public function resolving($abstract, callable $callback = null);

/**
* Register a new after resolving callback.
Expand All @@ -161,7 +161,7 @@ public function resolving(string|Closure $abstract, callable $callback = null);
* @param callable|null $callback
* @return void
*/
public function afterResolving(string|Closure $abstract, callable $callback = null);
public function afterResolving($abstract, callable $callback = null);

/**
* Determine if a given string is an alias.
Expand Down
2 changes: 1 addition & 1 deletion src/Container/DeepGetterTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
trait DeepGetterTrait /* implements ContainerInterface*/
{

private string $deep_delimiter = '::';
private $deep_delimiter = '::';

/**
* @param string $key - Возможно использование доступа внутри объекта через точку ,
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 \Symbiotic\Container\BaseContainerInterfa
*
* @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, array &$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
8 changes: 4 additions & 4 deletions src/Container/ServiceContainerTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ trait ServiceContainerTrait /*implements \Symbiotic\Container\ServiceContainerIn
*
* @var \Symbiotic\Core\ServiceProvider[]
*/
protected array $serviceProviders = [];
protected $serviceProviders = [];

/**
* The names of the loaded service providers.
*
* @var array
*/
protected array $loadedProviders = [];
protected $loadedProviders = [];

protected array $defer_services = [];
protected $defer_services = [];

/**
* Indicates if the application has "booted".
Expand Down Expand Up @@ -189,7 +189,7 @@ public function getProvider($provider)
* @param string |object $provider
* @return false|string
*/
protected function getClass(string|object $provider)
protected function getClass($provider)
{
return \is_string($provider) ? \ltrim($provider, '\\') : \get_class($provider);
}
Expand Down
Loading

0 comments on commit 6b539c6

Please sign in to comment.