Skip to content

Instantly share code, notes, and snippets.

@localdisk
Created April 15, 2018 04:26
Show Gist options
  • Save localdisk/833cd43f7cdf9b0ab9c9e424cf1b1a78 to your computer and use it in GitHub Desktop.
Save localdisk/833cd43f7cdf9b0ab9c9e424cf1b1a78 to your computer and use it in GitHub Desktop.
Interfaceとclassを1ファイル
<?php
declare(strict_types=1);
namespace Localdisk\Cart;
interface CartInterface
{
public function add(Product $product): void;
}
class SesssionCart implements CartInterface
{
public function add(Product $product)
{
// 実装
}
}
// 1. DBに入る Cart も作りたい
// 2. んーファイル分割するか
// 2-1. Interface は Localdisk\Cart\Interfaces に置くか
// use 書き換えるのめんどくさい…(PhpStormさん、ちゃんとやってくれるんだっけ…?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment