This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func! PhpRefactorShowMenu() | |
echohl Title | |
echo 'Available Refactorings:' | |
echohl None | |
echo '(em) Extract Method' | |
echo '(lv) rename Local Variable' | |
echo '(li) Local variable to Instance variable' | |
echo '(ou) Optimize Use' | |
echo '' | |
echo '(c) Cancel' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class TestClassSpec extends ObjectBehavior | |
{ | |
public function it_runs_action1(ActionClass $action) { | |
$action->action1()->shouldBeCalled(); | |
// I have to add this here even though it is not the focus of this test? | |
$action->action2()->shouldBeCalled(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Problem: | |
// I'm testing a method which adds a service to a service container class which takes a service | |
// name and a callback which creates the service. Like so: | |
function load(ServiceContainer $container) | |
{ | |
$container->set( | |
'event_dispatcher.listeners.db_extension', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Since we don't have method over loading, shouldn't this be possible? | |
*/ | |
interface Object1Saver | |
{ | |
public function save(Object1 $obj); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Say you have an entity class which has no need to expose its internal data | |
* fields in the business layer like so: | |
*/ | |
class LibraryBook | |
{ | |
/** @var string */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
interface Item | |
{ | |
public function runAction(); | |
} | |
interface SomeCollection | |
{ | |
public function foreachItem(callable $fn); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Given | |
(defn make-customer [name email] | |
{:name name, :email email}) | |
// Examples | |
(def customer1 (make-customer "Tom" "[email protected]")) | |
// vs... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Feature: View a widget | |
# Approach 1 | |
Scenario: View a widget's attributes | |
Given there is a widget named "the widget" with attribute1 "attr 1 val" and attribute2 "attr 2 val" and attribute3 "attr 3 val" | |
Then the widget named "the widget" should have attribute1 value "attr 1 val" and attribute2 value "attr 2 val" and attribute3 "attr 3 val" | |
# Approach 2 | |
Scenario: View a widget's attributes | |
Given there is a widget named "the widget" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// An example of navigating HAL enabled JSON APIs in Behat tests | |
// using https://github.com/tomphp/hal-client | |
use TomPHP\HalClient\Client; | |
class APIContext | |
{ | |
// ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// https://github.com/tomphp/php-transform | |
use function TomPHP\Transform\__; | |
$ticket1 = new Ticket(new User(['dob' => new DateTime('1980-01-22')])); | |
$ticket2 = new Ticket(new User(['dob' => new DateTime('1984-08-08')])); | |
$tickets = [$ticket1, $ticket2]; |