WE HAVE PSR-8

WE HAVE PSR-8

PHPカンファレンス2017 懇親会LT 発表スライドです

8c1ecc738eee0254a41c2d4b33cda7b6?s=128

Hisateru Tanaka

October 08, 2017
Tweet

Transcript

  1. WE HAVE PSR-8 )VHHBCMF

  2. ͨͳ͔ͻͯ͞Δ @tanakahisateru ॴ௕

  3. ࣮૷͖ͯ͠·ͨ͠ ࢖༻ٕज़ΤʔϫϯΞΠϩϯసࣸϓϦϯτγʔτ

  4. 143ීٴͯ͠Δ  ൪߸Ͱ಺༰ࢥ͍ग़ͤ·͔͢

  5. ΠϯλʔϑΣʔε143 143

  6.   $PEJOH4UZMF  "VUPMPBE  4FDVSJUZ

  7. *OUFSGBDF143 w 143-PHHFS*OUFSGBDF w 143)551.FTTBHF*OUFSGBDF w 143$POUBJOFS*OUFSGBDF

  8. <?php namespace Psr\Log; interface LoggerInterface { public function emergency($message, array

    $context = array()); public function alert($message, array $context = array()); public function critical($message, array $context = array()); public function error($message, array $context = array()); public function warning($message, array $context = array()); public function notice($message, array $context = array()); public function info($message, array $context = array()); public function debug($message, array $context = array()); public function log($level, $message, array $context = array()); }
  9. 143 )VHHBCMF*OUFSGBDF

  10. %SBGU

  11. ຋༁ͨ͠Α

  12. ͜ͷඪ४͸ɺΦϒδΣΫτ͕ޓ͍ͷײँͱࢧ࣋ Λද໌͢ΔͨΊͷɺҰൠతͳํ๏Λཱ֬͠· ͢ɻ͜ΕͰΦϒδΣΫτ͸ɺݐઃతͳํ๏Ͱ ޓ͍Λαϙʔτ͢Δ͜ͱ͕Ͱ͖ɺҟͳΔ1)1 ϓϩδΣΫτؒͷڠྗΛଅਐ͠·͢

  13. ͜ͷ࢓༷Ͱ͸ͭͷΠϯλʔϑΣʔε a1TSa)VHa)VHHBCMFͱ a1TSa)VHa(SPVQ)VHHBCMFΛఆٛ͠·͢ɻ

  14. )VHHBCMFΦϒδΣΫτ͸ɺͦͷIVH ϝιου Λݺͼग़͍͢͞ୈҰύϥϝʔλͱͯ͠UIJTΛ౉ ͢͜ͱͰɺଞͷΦϒδΣΫτ΁ͷࢥ͍΍Γͱࢧ࣋Λ දݱ͠·͢ɻ

  15. IVH ϝιου͕ݺͼग़͞ΕͨΦϒδΣΫτ͸ɺ গͳ͘ͱ΋ճɺݺͼग़ͨ͠ΦϒδΣΫτΛ IVH ͠ฦ͞ͳ͚Ε͹ͳΓ·ͤΜ .645 ɻ

  16. ϋά͢Δ͍ͭ͞ͷΦϒδΣΫτ͸ɺԿ౓΋൓෮ͯ͠ޓ͍ ʹܧଓͯ͠ϋά͠ฦ͢͜ͱ͕Ͱ͖·͢ .": ɻ ͔͠͠ɺ͢΂ͯͷϋάՄೳΦϒδΣΫτ͸ɺແݶϧʔϓ Λ๷͙ͨΊͷऴྃ৚݅Λ͍࣋ͬͯͳ͚Ε͹ͳΓ·ͤΜ .645 ɻ ͨͱ͑͹ɺ࠷େճ·Ͱͷ૬ޓϋά͔͠ڐՄ͠ͳ͍Α͏ ʹΦϒδΣΫτΛઃఆ͢Δͱɺͦͷޙɺϋάͷ࿈࠯Λഁ

    غͯ͠SFUVSO͢Δͱ͍ͬͨΑ͏ʹ͠·͢ .": ɻ
  17. ϋά͞Εͨͱ͖ɺΦϒδΣΫτ͸ɺঢ়ଶͷมߋͳ Ͳͷ෭࣍తͳΞΫγϣϯΛͱΔ͜ͱ͕Ͱ͖·͢ ʢ.":ʣɻ Ұൠతͳྫͱͯ͠ɺ಺෦ͷ޾෱ײ΋͘͠͸ॆ଍ײ ͷΧ΢ϯλʔΛΠϯΫϦϝϯτ͢Δ͜ͱ͕ڍ͛Β Ε·͢ɻ

  18. namespace Psr\Hug; /** * Defines a huggable object. * *

    A huggable object expresses mutual affection with another huggable object. */ interface Huggable { /** * Hugs this object. * * All hugs are mutual. An object that is hugged MUST in turn hug the other * object back by calling hug() on the first parameter. All objects MUST * implement a mechanism to prevent an infinite loop of hugging. * * @param Huggable $h * The object that is hugging this object. */ public function hug(Huggable $h); }
  19. )VHHBCMFͰͳ͍ਓʹݸਓͰIVH ͨ͠Β 5ZQF&SSPS"SHVNFOUQBTTFEUP IVH NVTUCFBOJOTUBODFPG )VHHBCMF JOTUBODFPG HJWFO PO ҙ༁Ωϟʔมଶ

  20. namespace Psr\Hug; /** * Defines a huggable object. * *

    A huggable object expresses mutual affection with another huggable object. */ interface GroupHuggable extends Huggable { /** * Hugs a series of huggable objects. * * When called, this object MUST invoke the hug() method of every object * provided. The order of the collection is not significant, and this object * MAY hug each of the objects in any order provided that all are hugged. * * @param $huggables * An array or iterator of objects implementing the Huggable interface. */ public function groupHug($huggables); }
  21. )VHHBCMFIVH )VHHBCMFI (SPVQ)BHHBCMFHSPVQ)VH IVHHBCMFT

  22. ʮΈΜͳ๊͖͠Ί͍ͨʯ μοΫλΠϐϯά0,

  23. ࣗॏ

  24. ෳ਺ͷ࣮૷

  25. None
  26. 1)1ίϛϡχςΟͱ͸ w ૬ޓʹڠྗ͠߹ͬͯͰ͖͍ͯΔ w ԶͷϓϩδΣΫτ͸͓·͑ΒͷϓϩδΣΫτͷ͓͔͛ w ͓·͑ΒͷϓϩδΣΫτʹԶ΋໾ཱͯΔ w 1)1ʹؔΘΔ͢΂ͯͷਓ͕͜͏͋Γ͍ͨ

  27. ࢲͨͪ͸͜Μͳ ΤΠϓϦϧϑʔ ϧ ࢓༷͕ड͚ೖΕΒΕΔɺѪ͋ ;ΕΔٕज़Λ࢖͍ͬͯΔͷͰ͢

  28. 8&)"7&143 ތͬͯ·͍Γ·͠ΐ͏

  29. ͍͍࢓ࣄͯ͠ΔͱࢥͬͨΒ ʮϋΨϏϦςΟߴ͍Ͷʯ ఻͍͖͑ͯ·͠ΐ͏

  30. )VHHBCMF

  31. ,/08/*446&

  32. ઌ೔େن໛ͳো֐͕ ൃੜ͠·ͯ͠

  33. ͜ͷ͋ͨΓʹ੬ऑੑ

  34. ܕΛҙࣝͨ͠1)1ΞϓϦέʔγϣϯ։ൃ ຊฤͰ͸

  35. ݞΛҙࣝͨ͠1)1ΧϯϑΝϨϯεࢀՃ ͓ख΍ΘΒ͔ʹ͓ئ͍͠·͢