Skip to content

Commit 741ee5a

Browse files
committed
initial commit for fork of the Slim framework
- fixes in tests - fixes in code
1 parent 565632b commit 741ee5a

38 files changed

+439
-355
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ coverage
44
vendor
55
.DS_Store
66
.idea
7+
.phpunit.result.cache

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ It's recommended that you use [Composer](https://getcomposer.org/) to install Sl
1616
$ composer require slim/slim "^3.0"
1717
```
1818

19-
This will install Slim and all required dependencies. Slim requires PHP 5.5.0 or newer.
19+
This will install Slim and all required dependencies. Slim requires PHP 8.0.0 or newer.
2020

2121
## Usage
2222

Slim/App.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -661,9 +661,10 @@ protected function isEmptyResponse(ResponseInterface $response)
661661
*
662662
* @return bool
663663
*/
664-
protected function isHeadRequest(RequestInterface $request)
664+
protected function isHeadRequest(RequestInterface $request): bool
665665
{
666-
return strtoupper($request->getMethod()) === 'HEAD';
666+
$method = $request->getMethod();
667+
return strtoupper(isset($method) ? $method : '') === 'HEAD';
667668
}
668669

669670
/**

Slim/Collection.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public function clear()
109109
*
110110
* @return bool
111111
*/
112-
public function offsetExists($key)
112+
public function offsetExists($key): bool
113113
{
114114
return $this->has($key);
115115
}
@@ -121,7 +121,7 @@ public function offsetExists($key)
121121
*
122122
* @return mixed The key's value, or the default value
123123
*/
124-
public function offsetGet($key)
124+
public function offsetGet($key): mixed
125125
{
126126
return $this->get($key);
127127
}
@@ -132,7 +132,7 @@ public function offsetGet($key)
132132
* @param string $key The data key
133133
* @param mixed $value The data value
134134
*/
135-
public function offsetSet($key, $value)
135+
public function offsetSet($key, $value): void
136136
{
137137
$this->set($key, $value);
138138
}
@@ -142,7 +142,7 @@ public function offsetSet($key, $value)
142142
*
143143
* @param string $key The data key
144144
*/
145-
public function offsetUnset($key)
145+
public function offsetUnset($key): void
146146
{
147147
$this->remove($key);
148148
}
@@ -152,7 +152,7 @@ public function offsetUnset($key)
152152
*
153153
* @return int
154154
*/
155-
public function count()
155+
public function count(): int
156156
{
157157
return count($this->data);
158158
}
@@ -162,7 +162,7 @@ public function count()
162162
*
163163
* @return ArrayIterator
164164
*/
165-
public function getIterator()
165+
public function getIterator(): ArrayIterator
166166
{
167167
return new ArrayIterator($this->data);
168168
}

Slim/Container.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function __construct(array $values = [])
7070
*
7171
* @return void
7272
*/
73-
private function registerDefaultServices($userSettings)
73+
private function registerDefaultServices($userSettings): void
7474
{
7575
$defaultSettings = $this->defaultSettings;
7676

@@ -100,7 +100,7 @@ private function registerDefaultServices($userSettings)
100100
* @throws ContainerValueNotFoundException No entry was found for this identifier.
101101
* @throws ContainerExceptionInterface Error while retrieving the entry.
102102
*/
103-
public function get($id)
103+
public function get($id): mixed
104104
{
105105
if (!$this->offsetExists($id)) {
106106
throw new ContainerValueNotFoundException(sprintf('Identifier "%s" is not defined.', $id));
@@ -111,7 +111,7 @@ public function get($id)
111111
if ($this->exceptionThrownByContainer($exception)) {
112112
throw new SlimContainerException(
113113
sprintf('Container error while retrieving "%s"', $id),
114-
null,
114+
0,
115115
$exception
116116
);
117117
} else {
@@ -128,7 +128,7 @@ public function get($id)
128128
*
129129
* @return bool
130130
*/
131-
private function exceptionThrownByContainer(InvalidArgumentException $exception)
131+
private function exceptionThrownByContainer(InvalidArgumentException $exception): bool
132132
{
133133
$trace = $exception->getTrace()[0];
134134

@@ -143,7 +143,7 @@ private function exceptionThrownByContainer(InvalidArgumentException $exception)
143143
*
144144
* @return boolean
145145
*/
146-
public function has($id)
146+
public function has($id): bool
147147
{
148148
return $this->offsetExists($id);
149149
}

Slim/Handlers/AbstractError.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function __construct($displayErrorDetails = false)
3232
*
3333
* @return void
3434
*/
35-
protected function writeToErrorLog($throwable)
35+
protected function writeToErrorLog($throwable): void
3636
{
3737
if ($this->displayErrorDetails) {
3838
return;
@@ -57,7 +57,7 @@ protected function writeToErrorLog($throwable)
5757
*
5858
* @return string
5959
*/
60-
protected function renderThrowableAsText($throwable)
60+
protected function renderThrowableAsText($throwable): string
6161
{
6262
$text = sprintf('Type: %s' . PHP_EOL, get_class($throwable));
6363

0 commit comments

Comments
 (0)