Skip to content

Commit 8f66762

Browse files
committed
Changed helper function names from camel to snake case
1 parent 9509d46 commit 8f66762

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ The package also has a few handy helpers to get Chuck in action. Here's the synt
9696

9797
```php
9898
act(new ChuckNorris($data));
99-
actWhen($isChuckNorrisMighty, new ChuckNorris($data));
100-
actUnless($isChuckNorrisPuny, new ChuckNorris($data));
99+
act_when($isChuckNorrisMighty, new ChuckNorris($data));
100+
act_unless($isChuckNorrisPuny, new ChuckNorris($data));
101101
```
102102

103103
## Last thoughts

src/helpers.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function act(Actionable $action)
1919
}
2020
}
2121

22-
if (! function_exists('actWhen')) {
22+
if (! function_exists('act_when')) {
2323
/**
2424
* Initiate the given action if the given condition is true.
2525
*
@@ -30,13 +30,13 @@ function act(Actionable $action)
3030
*
3131
* @return mixed|void
3232
*/
33-
function actWhen($condition, Actionable $action)
33+
function act_when($condition, Actionable $action)
3434
{
3535
return (new Action())->actWhen($condition, $action);
3636
}
3737
}
3838

39-
if (! function_exists('actUnless')) {
39+
if (! function_exists('act_unless')) {
4040
/**
4141
* Initiate the given action if the given condition is false.
4242
*
@@ -47,7 +47,7 @@ function actWhen($condition, Actionable $action)
4747
*
4848
* @return mixed|void
4949
*/
50-
function actUnless($condition, Actionable $action)
50+
function act_unless($condition, Actionable $action)
5151
{
5252
return (new Action())->actUnless($condition, $action);
5353
}

tests/Unit/Helpers/ActUnlessTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class ActUnlessTest extends TestCase
1010
public function testActUnlessRunsIfFalsy()
1111
{
1212
// Act.
13-
$response = actUnless(false, new ActionWithAllEvents());
13+
$response = act_unless(false, new ActionWithAllEvents());
1414

1515
// Assert.
1616
$this->assertTrue($response);
@@ -19,7 +19,7 @@ public function testActUnlessRunsIfFalsy()
1919
public function testActUnlessRejectsIfTruthy()
2020
{
2121
// Act.
22-
$response = actUnless(true, new ActionWithAllEvents());
22+
$response = act_unless(true, new ActionWithAllEvents());
2323

2424
// Assert.
2525
$this->assertNull($response);

tests/Unit/Helpers/ActWhenTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class ActWhenTest extends TestCase
1010
public function testActWhenRunsIfTruthy()
1111
{
1212
// Act.
13-
$response = actWhen(true, new ActionWithAllEvents());
13+
$response = act_when(true, new ActionWithAllEvents());
1414

1515
// Assert.
1616
$this->assertTrue($response);
@@ -19,7 +19,7 @@ public function testActWhenRunsIfTruthy()
1919
public function testActWhenRejectsIfFalsy()
2020
{
2121
// Act.
22-
$response = actWhen(false, new ActionWithAllEvents());
22+
$response = act_when(false, new ActionWithAllEvents());
2323

2424
// Assert.
2525
$this->assertNull($response);

0 commit comments

Comments
 (0)