Skip to content

Support html+php #22

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

Merged
merged 3 commits into from
Apr 21, 2021
Merged

Support html+php #22

merged 3 commits into from
Apr 21, 2021

Conversation

Nyholm
Copy link
Member

@Nyholm Nyholm commented Apr 21, 2021

Thiis will fix #19

@Nyholm Nyholm merged commit d0ecde9 into main Apr 21, 2021
@Nyholm Nyholm deleted the html-php branch April 21, 2021 08:42
@@ -7,6 +7,7 @@ jobs:
phpstan:
name: PHPStan
runs-on: Ubuntu-20.04
continue-on-error: true
Copy link
Member

Choose a reason for hiding this comment

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

why continuing on error ? If some setup step fails, further steps will also fail in some non-understandable way, as they assume that the setup is done.

Copy link
Member Author

Choose a reason for hiding this comment

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

Are you sure?

I though this meant: "If one job fails, please continue with the others jobs anyways"

Ie, it will always run phpstan even if php-cs-fixer fails.

Copy link
Member

Choose a reason for hiding this comment

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

this is a setting of the job itself. It is about failed steps, not about failed jobs. One job does not impact other jobs, except for 2 reasons:

  • when using needs to declare a dependency between jobs (a job is skipped if its dependencies failed)
  • when using a matrix without fail-fast: false, a failed job in the matrix cancels other jobs of the matrix (that fail-fast: true default in github actions is quite annoying IMO. I'm always changing it, as I find value in seeing whether tests on a PHP version are working even if another PHP version broke)

$contents = 'class Foobar {'.$contents.'}';
}

// Allow us to use "..." as a placeholder
Copy link
Member

Choose a reason for hiding this comment

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

what if we have some places using an actual spread operator ?

Copy link
Member Author

Choose a reason for hiding this comment

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

We do that once in the symfony docs. So I saw this benefit is greater than the downside. But your comment is valid and it is not the best solution.

Copy link
Member

Choose a reason for hiding this comment

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

maybe a better heuristic would be to replace only ...; (which cannot be a valid usage of either a variadic parameter definition or a spread operator). I don't know whether we have other kind of usages of the placeholder in the doc.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, sure. ...;, ...) and ...,. That would cover most I think.

// Allow us to use "..." as a placeholder
$contents = str_replace('...', 'null', $contents);

$lines = explode(PHP_EOL, $contents);
Copy link
Member

Choose a reason for hiding this comment

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

you should explode on \n

Copy link
Member Author

Choose a reason for hiding this comment

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

Could you help me understand why?

Copy link
Member

Choose a reason for hiding this comment

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

because the doc source uses LF line endings, so this code would fail if a contributor tries running it on Windows as it would not explode lines properly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Handle that some PHP examples starts with <?php
2 participants