Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥

有効な使い方を正しく理解して実装する PHP8.3の最新機能 / Proper underst...

有効な使い方を正しく理解して実装する PHP8.3の最新機能 / Proper understanding and implementation of effective usage Latest features in PHP 8.3

PHPカンファレンス福岡2024
https://phpcon.fukuoka.jp/2024/

shiro seike

June 22, 2024
Tweet

More Decks by shiro seike

Other Decks in Programming

Transcript

  1. ©Fusic Co., Ltd. 2 ਗ਼Ո ࢙࿠ @seike460 AWS Community Builders

    Serverless ݄ؒPHPΧϯϑΝϨϯε2024 - PHPΧϯϑΝϨϯε๺ւಓ2024 ొஃ (LT) - PHPΧϯϑΝϨϯεؔ੢2024 ొஃ (LT) - PHPerKaigi2024 ొஃ (LT) - PHPΧϯϑΝϨϯεখాݪ2024 ొஃ - PHPΧϯϑΝϨϯε߳઒2024 ొஃ - PHPΧϯϑΝϨϯε෱Ԭ2024 ొஃ Nowʂ ࣗݾ঺հ ͸͡Ίʹ גࣜձࣾFusic ϓϦϯγύϧΤϯδχΞ/ΤόϯδΣϦετ
  2. ©Fusic Co., Ltd. 5 PHP8.3ͷϦϦʔεʹ͍ͭͯৼΓฦΔ - PHP 8.3.0 - 2023೥11݄23೔

    - PHP 8.3.1 - 2023೥12݄21೔ - PHP 8.3.2 - 2024೥1݄18೔ - PHP 8.3.3 - 2024೥2݄15೔ - PHP 8.3.4 - 2024೥3݄14೔ - PHP 8.3.6ɹɹɹɹ ※PHP8.3.5͸ReleasePage͔Β࡟আࡁ - 2024೥4݄11೔ - PHP 8.3.7 - 2024೥5݄9೔
  3. ©Fusic Co., Ltd. 6 PHP8.3.5͸…? PHP8.3.5͕ͳ͔ͬͨΜͰ͢ΑͶ ͬͯ࿩Λ@tadsanʹͨ͠Β ͋ͬͱ͍͏ؒʹௐ΂ͯ͘Ε·ͨ͠ʂ ▪೔ຊޠ༁ PHP

    ։ൃνʔϜ͸PHP 8.3.6 ͷଈ࣌ϦϦʔεΛΞφ΢ϯε͠·͢ ͜Ε͸CVE-2024-1874 ʹ ରॲͨ͠ηΩϡϦςΟϦϦʔεͰ͢
  4. ©Fusic Co., Ltd. 7 PHP8.3ͷαϙʔτظݶ - Active Support - 2025೥11݄23೔

    ࠓ೔͔Β520೔ - Security Support - 2026೥11݄23೔ ࠓ೔͔Β885೔
  5. ©Fusic Co., Ltd. 8 ͳͥ৽͍͠ػೳΛཧղ͢Δͷ͔ ਖ਼͘͠ػೳΛཧղ࣮ͯ͠૷͢ΔͱҎԼͷΑ͏ͳԸܙ͕ - ҆શੑͷ޲্ - όάͷࠞೖ΍ηΩϡϦςΟϗʔϧͷϦεΫͷ௿ݮʹܨ͕Δ

    - ίʔυදݱྗͷ޲্ - ίʔυͷҙਤΛ໌֬ʹͯ͠ՄಡੑΛ޲্ͤ͞Δࣄ͕Մೳ - ։ൃޮ཰ͷ޲্ - ReadonlyϓϩύςΟ΍Attributeͷ࢖༻ʹΑΓόάൃੜ཰ͷ཈੍ ίʔυʹҙࢥΛຒΊࠐΜͰɺίʔυΛ௨͠ඇಉظίϛϡχέʔγϣϯ͕Մೳ ݴޠදݱ͕๛͔ʹ͢Δ͜ͱͰೝ஌ෛՙΛԼ͍͖͛ͯ·͠ΐ͏
  6. ©Fusic Co., Ltd. 10 ৽ػೳͷϦετΞοϓ - ػೳͱͯ͠ͷ௥Ճ - Ϋϥεఆ਺ͷܕ෇͚ -

    Ϋϥεఆ਺ͷจࣈྻࢦఆ - Attribute#[\Override]ͷ௥Ճ - ಡΈऔΓઐ༻ϓϩύςΟͷσΟʔϓΫϩʔϯ - ίϚϯυϥΠϯLinterͷෳ਺ϑΝΠϧࢦఆ - ؔ਺ɺϝιουͷ௥Ճ - json_validate - Randomizer::getBytesFromString() - Randomizer::getFloat() - Randomizer::nextFloat() https://www.php.net/releases/8.3/ja.php
  7. ©Fusic Co., Ltd. 11 ৽ػೳͷϦετΞοϓ - ػೳͱͯ͠ͷ௥Ճ - Ϋϥεఆ਺ͷܕ෇͚ -

    Ϋϥεఆ਺ͷจࣈྻࢦఆ - Attribute#[\Override]ͷ௥Ճ - ಡΈऔΓઐ༻ϓϩύςΟͷσΟʔϓΫϩʔϯ https://www.php.net/releases/8.3/ja.php
  8. ©Fusic Co., Ltd. 24 Attribute#[\Override]ͷ௥Ճ ʲafterʳ #[\Override]ͱ͍͏Attribute͕௥Ճ ਌Class΍interfaceʹಉ͡Method͕ ఆٛ͞Ε͍ͯͳ͍৔߹Τϥʔ͕ൃੜ Ҿ਺΍໭Γ஋͕ؒҧ͍ͬͯΔ৔߹΍

    ݩͷϝιου͕มߋ͞Εͨ৔߹΋༗ޮ Fatal error: ExtendedCache::setCatLifetime() has #[\Override] attribute, but no matching parent method exists
  9. ©Fusic Co., Ltd. 32 ϓϩύςΟϑοΫ __get ϝιου ϓϩύςΟͷಡΈऔΓ࣌ʹݺͼग़͞ΕΔ __set ϝιου

    ϓϩύςΟͷॻ͖ࠐΈ࣌ʹݺͼग़͞ΕΔ __isset ϝιου isset ؔ਺΍ empty ؔ਺Ͱ ϓϩύςΟͷଘࡏ֬ೝ࣌ʹݺͼग़͞ΕΔ
  10. ©Fusic Co., Ltd. 37 ·ͱΊ PHP8.3͸2026೥·Ͱར༻͠·͢ɻ͔ͬ͠Γ޲͖߹͍·͠ΐ͏ Point 01 ܕ΍AttributeͰίʔυकΔͱ͍͏੔උ͕ਐΜͰ͓Γɺࣗ෼ͨͪʹͯ੔උ͢ΔࣄΛબ୒Ͱ͖Δ Point

    02 ࠓճ௥Ճ͞Εͨؔ਺Ҏ֎ͷ΋ͷ΋͋Γ·͢ʂͥͻChangeLogΛ௥ͬͯΈ·͠ΐ͏ʂ Point 03 ػೳͱͯ͠΋ɺίʔυӽ͠ͷҙࢥ఻ୡͷखஈͱͯ͠΋৽͍͠ػೳΛֶͿ͜ͱ͸༗༻ɺͥͻ࢖͍·͠ΐ͏ Point 04