Skip to content
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Fixed

- Missing `parameter:cucumber` token for Scenario Outline ([#246](https://github.com/cucumber/language-service/issues/246))
- support doc comments for php ([#253](https://github.com/cucumber/language-service/pull/253))

## [1.7.0] - 2025-05-18
### Added
Expand Down
6 changes: 3 additions & 3 deletions src/language/phpLanguage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const phpLanguage: Language = {
toStepDefinitionExpression(node) {
// match multiline comment
const text = node.text
const match = text.match(/^(\/\*\*[\s*]*)([\s\S]*)(\n[\s]*\*\/)/)
const match = text.match(/@(Given |When |Then )(.*)/)
Copy link
Contributor

Choose a reason for hiding this comment

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

The previous regex, whilst complex, matched a * at the start, which I believe is the comment signifier.

if (!match) throw new Error(`Could not match ${text}`)
return behatifyStep(match[2])
},
Expand Down Expand Up @@ -36,9 +36,9 @@ export const phpLanguage: Language = {
},
defaultSnippetTemplate: `
/**
* {{ keyword }} {{ expression }}
* @{{ keyword }} {{ expression }}
*/
public function {{ #camelize }}{{ expression }}{{ /camelize }}({{ #parameters }}{{ #seenParameter }}, {{ /seenParameter }}{{ name }}{{ /parameters }})
public function {{ #camelize }}{{ expression }}{{ /camelize }}({{ #parameters }}{{ #seenParameter }}, {{ /seenParameter }}\${{ name }}{{ /parameters }})
{
// {{ blurb }}
}
Expand Down
2 changes: 2 additions & 0 deletions test/language/testdata/php/StepDefinitions.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ class StepDefinitions
{
/**
* @Given ^a regexp$
*
* @return void
*/
public function regexp()
{
Expand Down
Loading