Upgrade to Pro — share decks privately, control downloads, hide ads and more …

momochanにも分かるPSR講座

 momochanにも分かるPSR講座

39e7d3ad2417a5fd26d816a51c99e7ce?s=128

ゆうきゃん

April 08, 2021
Tweet

Transcript

  1. momochan ʹ΋෼͔ΔPSRߨ࠲ 2021.04.08 ucan-lab in גࣜձࣾϛϥΠτσβΠϯ

  2. None
  3. ͓͠ͳ͕͖ • PSRͱ͸ • PHP-FIGͱ͸ • PSRͷࡦఆϓϩηε • PSRҰཡ •

    PSRΧςΰϦ • PSRൈਮ঺հ
  4. PSRͱ͸

  5. PSRͱ͸ • https://www.php- fi g.org/psr • PHP Standards Recommendations •

    PHPඪ४ίʔσΟϯάקࠂ • ४ڌ(ڧ੍Ͱ͸ͳ͍)
  6. PHP-FIGͱ͸

  7. PHP-FIGͱ͸ • https://www.php- fi g.org/personnel • PSRͷ࡞੒Λߦ͍ͬͯΔ • PHPͷϑϨʔϜϫʔΫ΍πʔϧͳͲͷϓϩδΣΫτ։ൃ ऀʹΑͬͯߏ੒͞Ε͍ͯΔ૊৫

    • CakePHP, Composer, Magento, PEAR, Phalcon, Slim… • SymfonyͱLaravel͸ҙݟ͕߹Θͳ͘ͳͬͯ཭୤
  8. ࡦఆϓϩηε

  9. ࡦఆϓϩηε • Pre-Draft (ఏҊ) • Draft (૲Ҋ) • Review (ධՁ)

    • Accepted (ঝೝ) • Deprecated (ඇਪ঑) • Abandoned (์غ)
  10. PSRҰཡ

  11. PSRҰཡ Accepted (ঝೝ) • PSR-1 Basic Coding StandardʢجຊతͳίʔσΟϯάඪ४ʣ • PSR-3

    Logger InterfaceʢϩΨʔΠϯλϑΣʔεʣ • PSR-4 AutoloaderʢΦʔτϩʔμʔʣ • PSR-6 Caching InterfaceʢΩϟογϯάΠϯλʔϑΣΠεʣ • PSR-7 HTTP Message InterfaceʢHTTPϝοηʔδΠϯλʔϑΣΠεʣ • PSR-11 Container InterfaceʢίϯςφΠϯλϑΣʔεʣ • PSR-12 Extended Coding Styleʢ֦ுίʔσΟϯάελΠϧʣ • PSR-13 Hypermedia LinksʢϋΠύʔϝσΟΞϦϯΫʣ • PSR-14 Event DispatcherʢΠϕϯτσΟεύονϟʔʣ • PSR-15 HTTP HandlersʢHTTPϋϯυϥʣ
  12. PSRҰཡ Draft (૲Ҋ) • PSR-5 PHPDoc Standard (PHPDocඪ४) • PSR-19

    PHPDoc tags (PHPDocλά) • PSR-20 Clock (ΫϩοΫ)
  13. PSRҰཡ Deprecated (ඇਪ঑) • PSR-0ɹAutoloaderʢΦʔτϩʔμʔʣ • PSR-2ɹCoding Style GuideʢίʔσΟϯάε λΠϧΨΠυʣ

  14. PSRҰཡ Abandoned (์غ) • PSR-8 Huggable Interface (ϋάΞϒϧΠϯλʔϑΣ Πε) •

    PSR-9 Security Advisories (ηΩϡϦςΟΞυόΠβ Ϧ) • PSR-10 Security Reporting Process (ηΩϡϦςΟϨ ϙʔτϓϩηε)
  15. PSRΧςΰϦ

  16. PSRΧςΰϦ • ΦʔτϩʔσΟϯά(PSR-0, 4) • ΠϯλʔϑΣΠε(PSR-3, 6, 11,13, 14, 16)

    • HTTP(PSR-7, 15, 17, 18) • ίʔσΟϯάελΠϧ(PSR-1, 2, 12)
  17. PSRൈਮ঺հ

  18. PSRൈਮ঺հ(PSR-1) • Basic Coding Standard • ϑΝΠϧͰ͸λά <?php ΋͘͠͸<?= ͷΈΛ࢖༻͢Δ

    • PHPίʔυͷϑΝΠϧͰ͸BOMͳ͠ͷUTF-8ͷΈΛ࢖༻͢Δ • Ϋϥε໊͸ύεΧϧέʔεͰએݴ͢Δ • Ϋϥεఆ਺͸ɺશͯେจࣈͰΞϯμʔείΞ۠੾ΓΛར༻ͯ͠એ ݴ͢Δ • ϝιου໊͸ΩϟϝϧέʔεͰએݴ͢Δ
  19. PSRൈਮ঺հ(PSR-12, PSR-2) • Extended Coding Style Guide • PSR-2 ͷίʔσΟϯάελΠϧΨΠυͷ֦ுͱͳΔ

    • શͯͷ PHP ϑΝΠϧ͸ɺUnix LFʢϥΠϯϑΟʔυʣͷߦ຤ͷΈΛ࢖༻ ͢Δ • શͯͷ PHP ϑΝΠϧ͸ɺۭനҎ֎ͷߦͰऴΘΓɺ୯Ұͷ LF Ͱऴྃ͢Δ • PHP ͷΈΛؚΉϑΝΠϧͰ͸ɺऴྃλάΛলུ͢Δ • ΠϯσϯτϨϕϧ͝ͱʹ̐ͭͷεϖʔεͷΠϯσϯτΛ࢖༻͢Δ
  20. PSRൈਮ঺հ(PSR-20) • ClockInterface • ࣌ؒૢ࡞ܥͷΠϯλʔϑΣʔεʢݱࡏDraftதʣ • ݱࡏͷ࣌ؒʹґଘ͢ΔίʔυΛςετ͢Δͱ͖ʹ૬ޓ ӡ༻ੑΛՄೳʹ͢Δ • ݱࡏͷ࣌ࠁΛऔಘ͢ΔͨΊͷҰ؏ͨ͠ΠϯλʔϑΣΠε

    • ࠶ݱੑͷͨΊʹ࣮࣌ؒΛ؆୯ʹෳ੡Ͱ͖·͢ɻ
  21. ͓͠·͍

  22. 143׬શʹཧղͨ͠ʂ