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