Fix strict types errors
This commit is contained in:
parent
4dde4cd9fa
commit
3c6a5bb385
|
@ -34,7 +34,7 @@ class NewsController extends BaseController
|
|||
$newsId = $request->getAttribute('news_id'); // optional
|
||||
|
||||
$news = $this->news->find($newsId);
|
||||
$isMeeting = $request->get('meeting', false);
|
||||
$isMeeting = (bool) $request->get('meeting', false);
|
||||
|
||||
return $this->showEdit($news, $isMeeting);
|
||||
}
|
||||
|
|
|
@ -169,7 +169,7 @@ class MetricsEngine implements EngineInterface
|
|||
return str_replace(
|
||||
array_keys($replace),
|
||||
array_values($replace),
|
||||
$value
|
||||
(string) $value
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ class ConfigureEnvironmentServiceProvider extends ServiceProvider
|
|||
protected function setTimeZone(CarbonTimeZone $timeZone): void
|
||||
{
|
||||
ini_set('date.timezone', (string) $timeZone);
|
||||
date_default_timezone_set($timeZone);
|
||||
date_default_timezone_set((string) $timeZone);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -213,7 +213,7 @@ trait MessageTrait
|
|||
*/
|
||||
public function getBody(): StreamInterface
|
||||
{
|
||||
$stream = Stream::create($this->getContent());
|
||||
$stream = Stream::create((string) $this->getContent());
|
||||
$stream->rewind();
|
||||
|
||||
return $stream;
|
||||
|
@ -237,7 +237,7 @@ trait MessageTrait
|
|||
$new = clone $this;
|
||||
|
||||
if (method_exists($new, 'setContent')) {
|
||||
$new->setContent($body);
|
||||
$new->setContent((string) $body);
|
||||
} else {
|
||||
$new->content = $body;
|
||||
}
|
||||
|
|
|
@ -164,7 +164,7 @@ class Request extends SymfonyRequest implements ServerRequestInterface
|
|||
*/
|
||||
public function withUri(UriInterface $uri, mixed $preserveHost = false): static
|
||||
{
|
||||
$new = $this->create($uri);
|
||||
$new = $this->create((string) $uri);
|
||||
if ($preserveHost) {
|
||||
$new->headers->set('HOST', $this->getHost());
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ trait StringInputLength
|
|||
try {
|
||||
$input = new DateTime($input);
|
||||
// Min 1s diff to exclude any not auto-detected dates / times like ...
|
||||
return abs((new DateTime())->diff($input)->format('%s')) > 1;
|
||||
return abs((int) (new DateTime())->diff($input)->format('%s')) > 1;
|
||||
} catch (Exception $e) {
|
||||
// Ignore it
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ class ErrorHandler implements MiddlewareInterface
|
|||
$statusCode = $response->getStatusCode();
|
||||
$contentType = $response->getHeader('content-type');
|
||||
$contentType = array_shift($contentType);
|
||||
if (!$contentType && strpos($response->getBody() ?? '', '<html') !== false) {
|
||||
if (!$contentType && strpos($response->getBody()?->getContents() ?? '', '<html') !== false) {
|
||||
$contentType = 'text/html';
|
||||
}
|
||||
|
||||
|
@ -100,7 +100,7 @@ class ErrorHandler implements MiddlewareInterface
|
|||
$viewsList = [$statusCode, $hundreds, $hundreds * 100];
|
||||
foreach ($viewsList as $view) {
|
||||
if ($this->loader->exists($this->viewPrefix . $view)) {
|
||||
return $view;
|
||||
return (string) $view;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -152,10 +152,10 @@ class LegacyMiddleware implements MiddlewareInterface
|
|||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
protected function renderPage(string $page, string $title, string $content): ResponseInterface
|
||||
protected function renderPage(string | int $page, string $title, string $content): ResponseInterface
|
||||
{
|
||||
if (!empty($page) && is_int($page)) {
|
||||
return response($content, (int) $page);
|
||||
return response($content, $page);
|
||||
}
|
||||
|
||||
if (strpos((string) $content, '<html') !== false) {
|
||||
|
|
|
@ -55,7 +55,7 @@ class LegacyMiddlewareTest extends TestCase
|
|||
->method('renderPage')
|
||||
->withConsecutive(
|
||||
['users', 'title', 'content'],
|
||||
['404', 'Page not found', 'It\'s not available!']
|
||||
[404, 'Page not found', 'It\'s not available!']
|
||||
)
|
||||
->willReturn($response);
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ class BaseModelImplementation extends BaseModel
|
|||
|
||||
public int $saveCount = 0;
|
||||
|
||||
public static QueryBuilder $queryBuilder = null;
|
||||
public static ?QueryBuilder $queryBuilder = null;
|
||||
|
||||
public function save(array $options = []): bool
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue