Skip to content

Commit 7ac3d0f

Browse files
Add more nullsafe operators
1 parent 07b48a5 commit 7ac3d0f

File tree

3 files changed

+3
-5
lines changed

3 files changed

+3
-5
lines changed

Button.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ public function isRequired(): bool
271271
*/
272272
public function isDisabled(): bool
273273
{
274-
if ($this->parent && $this->parent->isDisabled()) {
274+
if ($this->parent?->isDisabled()) {
275275
return true;
276276
}
277277

Extension/DataCollector/FormDataCollector.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -326,9 +326,7 @@ private function &recursiveBuildFinalFormTree(FormInterface $form = null, FormVi
326326
foreach ($view->children as $name => $childView) {
327327
// The CSRF token, for example, is never added to the form tree.
328328
// It is only present in the view.
329-
$childForm = null !== $form && $form->has($name)
330-
? $form->get($name)
331-
: null;
329+
$childForm = $form?->has($name) ? $form->get($name) : null;
332330

333331
$output['children'][$name] = &$this->recursiveBuildFinalFormTree($childForm, $childView, $outputByHash);
334332
}

Form.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ public function getPropertyPath(): ?PropertyPathInterface
196196

197197
$parent = $this->parent;
198198

199-
while ($parent && $parent->getConfig()->getInheritData()) {
199+
while ($parent?->getConfig()->getInheritData()) {
200200
$parent = $parent->getParent();
201201
}
202202

0 commit comments

Comments
 (0)