Skip to content

Commit

Permalink
initial commit for fork of the Slim framework
Browse files Browse the repository at this point in the history
- fixes in tests
- fixes in code
  • Loading branch information
sfilatov-idt committed Oct 19, 2023
1 parent 565632b commit 9a3ae59
Show file tree
Hide file tree
Showing 37 changed files with 436 additions and 372 deletions.
1 change: 1 addition & 0 deletions .phpunit.result.cache

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Slim/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -661,9 +661,9 @@ protected function isEmptyResponse(ResponseInterface $response)
*
* @return bool
*/
protected function isHeadRequest(RequestInterface $request)
protected function isHeadRequest(RequestInterface $request): bool
{
return strtoupper($request->getMethod()) === 'HEAD';
return strtoupper($request->getMethod() ?? '') === 'HEAD';
}

/**
Expand Down
12 changes: 6 additions & 6 deletions Slim/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public function clear()
*
* @return bool
*/
public function offsetExists($key)
public function offsetExists($key): bool
{
return $this->has($key);
}
Expand All @@ -121,7 +121,7 @@ public function offsetExists($key)
*
* @return mixed The key's value, or the default value
*/
public function offsetGet($key)
public function offsetGet($key): mixed
{
return $this->get($key);
}
Expand All @@ -132,7 +132,7 @@ public function offsetGet($key)
* @param string $key The data key
* @param mixed $value The data value
*/
public function offsetSet($key, $value)
public function offsetSet($key, $value): void
{
$this->set($key, $value);
}
Expand All @@ -142,7 +142,7 @@ public function offsetSet($key, $value)
*
* @param string $key The data key
*/
public function offsetUnset($key)
public function offsetUnset($key): void
{
$this->remove($key);
}
Expand All @@ -152,7 +152,7 @@ public function offsetUnset($key)
*
* @return int
*/
public function count()
public function count(): int
{
return count($this->data);
}
Expand All @@ -162,7 +162,7 @@ public function count()
*
* @return ArrayIterator
*/
public function getIterator()
public function getIterator(): ArrayIterator
{
return new ArrayIterator($this->data);
}
Expand Down
10 changes: 5 additions & 5 deletions Slim/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function __construct(array $values = [])
*
* @return void
*/
private function registerDefaultServices($userSettings)
private function registerDefaultServices($userSettings): void
{
$defaultSettings = $this->defaultSettings;

Expand Down Expand Up @@ -100,7 +100,7 @@ private function registerDefaultServices($userSettings)
* @throws ContainerValueNotFoundException No entry was found for this identifier.
* @throws ContainerExceptionInterface Error while retrieving the entry.
*/
public function get($id)
public function get($id): mixed
{
if (!$this->offsetExists($id)) {
throw new ContainerValueNotFoundException(sprintf('Identifier "%s" is not defined.', $id));
Expand All @@ -111,7 +111,7 @@ public function get($id)
if ($this->exceptionThrownByContainer($exception)) {
throw new SlimContainerException(
sprintf('Container error while retrieving "%s"', $id),
null,
0,
$exception
);
} else {
Expand All @@ -128,7 +128,7 @@ public function get($id)
*
* @return bool
*/
private function exceptionThrownByContainer(InvalidArgumentException $exception)
private function exceptionThrownByContainer(InvalidArgumentException $exception): bool
{
$trace = $exception->getTrace()[0];

Expand All @@ -143,7 +143,7 @@ private function exceptionThrownByContainer(InvalidArgumentException $exception)
*
* @return boolean
*/
public function has($id)
public function has($id): bool
{
return $this->offsetExists($id);
}
Expand Down
4 changes: 2 additions & 2 deletions Slim/Handlers/AbstractError.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function __construct($displayErrorDetails = false)
*
* @return void
*/
protected function writeToErrorLog($throwable)
protected function writeToErrorLog($throwable): void
{
if ($this->displayErrorDetails) {
return;
Expand All @@ -57,7 +57,7 @@ protected function writeToErrorLog($throwable)
*
* @return string
*/
protected function renderThrowableAsText($throwable)
protected function renderThrowableAsText($throwable): string
{
$text = sprintf('Type: %s' . PHP_EOL, get_class($throwable));

Expand Down
Loading

0 comments on commit 9a3ae59

Please sign in to comment.