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

#139 - use your own regex pattern #160

Merged
merged 1 commit into from
Jun 15, 2018
Merged

#139 - use your own regex pattern #160

merged 1 commit into from
Jun 15, 2018

Conversation

smoench
Copy link
Contributor

@smoench smoench commented May 3, 2018

fixes #139

README.md Outdated
@@ -420,9 +420,11 @@ layers:
collectors:
- type: className
regex: .*Controller.*
predefined_delimiter: true
Copy link
Collaborator

Choose a reason for hiding this comment

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

can you add a hint, that default is true?

Copy link

Choose a reason for hiding this comment

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

a better solution: have a classNameRegex type that takes a plain regex as argument (no fiddling with the regex besides validating it)

Copy link

@Ocramius Ocramius left a comment

Choose a reason for hiding this comment

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

Overall, the patch solves the issue, but complicates an already complex matcher.

I'd first look at having completely alternative matchers (specialised) rather than even more configurable ones.

README.md Outdated
@@ -420,9 +420,11 @@ layers:
collectors:
- type: className
Copy link

Choose a reason for hiding this comment

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

Something unrelated that I just noticed: this could simply be the class FQN, and then customising all this stuff would be a breeze.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

opened an issue #164

README.md Outdated
```

Every classname that matches the regular expression `.*Controller.*` becomes a part of the *controller* layer.
Every class name that matches the regular expression `.*Controller.*` becomes a part of the *controller* layer.
Set `predefined_delimiter` to `false` to use your own delimiters and/or modifiers.
Copy link

Choose a reason for hiding this comment

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

This requires a practical example of how the generated regex looks like before/after.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

README.md Outdated
@@ -420,9 +420,11 @@ layers:
collectors:
- type: className
regex: .*Controller.*
predefined_delimiter: true
Copy link

Choose a reason for hiding this comment

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

a better solution: have a classNameRegex type that takes a plain regex as argument (no fiddling with the regex besides validating it)

@@ -11,10 +11,12 @@

class ClassNameCollectorTest extends TestCase
{
public function dataProviderStatisfy()
public function dataProviderSatisfy()
Copy link

Choose a reason for hiding this comment

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

A bit of denglish here: satisfiedRegexDataProvider maybe?

*/
public function testStatisfy($configuration, $className, $expected)
public function testSatisfy(array $configuration, string $className, bool $expected)
Copy link

Choose a reason for hiding this comment

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

Zame here about denglish: something wrong about the naming of this method

@smoench smoench force-pushed the custom-regex branch 2 times, most recently from ad61b47 to 047c796 Compare May 18, 2018 08:11
@smoench
Copy link
Contributor Author

smoench commented May 24, 2018

@Ocramius I have updated this PR. I will fix the language issues in a follow-up PR :)

@smoench smoench merged commit f53359f into master Jun 15, 2018
@smoench smoench deleted the custom-regex branch June 15, 2018 07:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ClassNameCollector defines its own regex modifiers and delimiters - shouldn't
4 participants