Skip to content
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 switch alternative syntax #2648

Merged
merged 1 commit into from
Aug 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions language/control-structures/alternative-syntax.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,10 @@ endif;
<programlisting role="php">
<![CDATA[
<?php switch ($foo): ?>

<?php case 1: ?>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't the actual problem that the rendered version dropped the indentation of this line?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe... that's something that should be flagged on PhD (and the joy of having no tests for it to catch regressions...) hopefully the new line break will "fix" this anyway

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was a CSS issue, no white-space: pre. I also found the previous version a more "natural" mistake, because it can easily halten that someone wants to indent the next line, whereas adding an empty line is less likely.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, if it's fixed then please feel free to revert.

...
<?php endswitch ?>
<?php endswitch; ?>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both styles do work, but having the semicolon is probably better.

]]>
</programlisting>
</informalexample>
Expand All @@ -85,7 +86,7 @@ endif;
<?php switch ($foo): ?>
<?php case 1: ?>
...
<?php endswitch ?>
<?php endswitch; ?>
]]>
</programlisting>
</informalexample>
Expand Down