-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Fix redundant type casts #44274
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix redundant type casts #44274
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,7 +57,7 @@ protected function setUp(): void | |
|
||
protected function renderForm(FormView $view, array $vars = []) | ||
{ | ||
return (string) $this->renderer->renderBlock($view, 'form', $vars); | ||
return $this->renderer->renderBlock($view, 'form', $vars); | ||
} | ||
|
||
protected function renderLabel(FormView $view, $label = null, array $vars = []) | ||
|
@@ -66,42 +66,42 @@ protected function renderLabel(FormView $view, $label = null, array $vars = []) | |
$vars += ['label' => $label]; | ||
} | ||
|
||
return (string) $this->renderer->searchAndRenderBlock($view, 'label', $vars); | ||
return $this->renderer->searchAndRenderBlock($view, 'label', $vars); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
} | ||
|
||
protected function renderHelp(FormView $view) | ||
{ | ||
return (string) $this->renderer->searchAndRenderBlock($view, 'help'); | ||
return $this->renderer->searchAndRenderBlock($view, 'help'); | ||
} | ||
|
||
protected function renderErrors(FormView $view) | ||
{ | ||
return (string) $this->renderer->searchAndRenderBlock($view, 'errors'); | ||
return $this->renderer->searchAndRenderBlock($view, 'errors'); | ||
} | ||
|
||
protected function renderWidget(FormView $view, array $vars = []) | ||
{ | ||
return (string) $this->renderer->searchAndRenderBlock($view, 'widget', $vars); | ||
return $this->renderer->searchAndRenderBlock($view, 'widget', $vars); | ||
} | ||
|
||
protected function renderRow(FormView $view, array $vars = []) | ||
{ | ||
return (string) $this->renderer->searchAndRenderBlock($view, 'row', $vars); | ||
return $this->renderer->searchAndRenderBlock($view, 'row', $vars); | ||
} | ||
|
||
protected function renderRest(FormView $view, array $vars = []) | ||
{ | ||
return (string) $this->renderer->searchAndRenderBlock($view, 'rest', $vars); | ||
return $this->renderer->searchAndRenderBlock($view, 'rest', $vars); | ||
} | ||
|
||
protected function renderStart(FormView $view, array $vars = []) | ||
{ | ||
return (string) $this->renderer->renderBlock($view, 'form_start', $vars); | ||
return $this->renderer->renderBlock($view, 'form_start', $vars); | ||
} | ||
|
||
protected function renderEnd(FormView $view, array $vars = []) | ||
{ | ||
return (string) $this->renderer->renderBlock($view, 'form_end', $vars); | ||
return $this->renderer->renderBlock($view, 'form_end', $vars); | ||
} | ||
|
||
protected function setTheme(FormView $view, array $themes, $useDefaultThemes = true) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,7 +31,7 @@ public function testThatRenderLogsTime() | |
$container = $this->createMock(Container::class); | ||
$templateNameParser = $this->getTemplateNameParser(); | ||
$globalVariables = $this->getGlobalVariables(); | ||
$loader = $this->getLoader($this->getStorage()); | ||
$loader = $this->getLoader(new StringStorage('foo')); | ||
|
||
$stopwatch = new Stopwatch(); | ||
|
||
|
@@ -60,17 +60,7 @@ private function getGlobalVariables(): GlobalVariables | |
return $this->createMock(GlobalVariables::class); | ||
} | ||
|
||
private function getStorage(): StringStorage | ||
{ | ||
return $this->getMockBuilder(StringStorage::class) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I replaced the mock with a real instance. |
||
->disableOriginalConstructor() | ||
->getMockForAbstractClass(); | ||
} | ||
|
||
/** | ||
* @param StringStorage $storage | ||
*/ | ||
private function getLoader($storage): Loader | ||
private function getLoader(StringStorage $storage): Loader | ||
{ | ||
$loader = $this->getMockForAbstractClass(Loader::class); | ||
$loader->expects($this->once()) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -730,7 +730,7 @@ private function createExpression(ContainerBuilder $container, string $expressio | |
private function createRequestMatcher(ContainerBuilder $container, string $path = null, string $host = null, int $port = null, array $methods = [], array $ips = null, array $attributes = []): Reference | ||
{ | ||
if ($methods) { | ||
$methods = array_map('strtoupper', (array) $methods); | ||
$methods = array_map('strtoupper', $methods); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
} | ||
|
||
if (null !== $ips) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FormRendererInterface::renderBlock()
retturns a string