Slide 1

Slide 1 text


 PHP Conference 2023 Hideki Kinjyo GitHub: o0h / Twitter: @o0h_ 
 
 [ൃද൛]

Slide 2

Slide 2 text

ࣗݾ঺հ / GitHub: @o0h / X: @o0h_ FW CakePHP

Slide 3

Slide 3 text

⏳estimate: 0 1 /25

Slide 4

Slide 4 text

⏳estimate: 0 1 /25

Slide 5

Slide 5 text


 ⏳estimate: 0 1 /25

Slide 6

Slide 6 text

ҧ͏ʂʂ Τϥʔ͸ఢ͡Όͳ͍ɺ ༑ୡͳΜͩʂʂ ⏳estimate: 1 /25

Slide 7

Slide 7 text

͜ΜͳࣄΛ࿩͍͖ͯ͠·͢ PHP ⏳estimate: 1 2 /25 ˒খ͞ͳએ఻ίʔφʔ˒

Slide 8

Slide 8 text

͜Μͳ΋ͷΛ࣋ͬͯؼͬͯ΋Β͍͍ͨ PHP ⏳estimate: 1 2 /25

Slide 9

Slide 9 text

͓͠ͳ͕͖ 1. 2. PHP 3. 4. PRO 5. PHP ⏳estimate: 1 2 /25

Slide 10

Slide 10 text

§1

Slide 11

Slide 11 text

ϓϩάϥϛϯάݴޠ͸ͳͥʮΤϥʔʯΛݴͬͯ͘Δͷʁ = ⏳estimate: 1 2 /25

Slide 12

Slide 12 text

PHP Software Developers 
 
 
 ⏳estimate: 1 2 /25

Slide 13

Slide 13 text

PHP Software Developers 
 
 
 ૝͍ ⏳estimate: 2 /25

Slide 14

Slide 14 text

⏳estimate: 2 /25

Slide 15

Slide 15 text

⏳estimate: 2 /25

Slide 16

Slide 16 text

Τϥʔͷ͋Δੈքɺͳ͍ੈքɾɾɾͲ͕ͬͪྑ͍Ͱ͔͢ʁ : 31 : : : ⏳estimate: 2~3 /25

Slide 17

Slide 17 text

Τϥʔͷ͋Δੈքɺͳ͍ੈքɾɾɾͲ͕ͬͪྑ͍Ͱ͔͢ʁ (= ) => => => ⏳estimate: 2~3 /25

Slide 18

Slide 18 text

Τϥʔͷ͋Δੈքͷํ͕ɺ༏͍͠ੈք 2 ⏳estimate: 2~3 /25

Slide 19

Slide 19 text

PHP 👀 ⏳estimate: 2~3 /25

Slide 20

Slide 20 text

ྫ͑͹sprintf()ͷྫ (% ) switch src: IUUQTHJUIVCDPNQIQQIQTSDCMPCQIQFYUTUBOEBSEGPSNBUUFE@QSJOUD--

Slide 21

Slide 21 text

ྫ͑͹sprintf()ͷྫ case (default ) ⏳estimate: 3 /25

Slide 22

Slide 22 text

ྫ͑͹sprintf()ͷྫ src: IUUQTHJUIVCDPNQIQQIQTSDCMPCQIQFYUTUBOEBSEGPSNBUUFE@QSJOUD-- (% )

Slide 23

Slide 23 text


 ⏳estimate: 3 /25

Slide 24

Slide 24 text

Τϥʔɺ͑Βʙ͍👏 : : ⏳estimate: 3~4 /25

Slide 25

Slide 25 text

§2 PHP

Slide 26

Slide 26 text

§2 PHP .1 .2 PHP

Slide 27

Slide 27 text

Τϥʔʹ͸ʮఔ౓ʯ͕͋Δͧ ( ) 
 ⏳estimate: 4 /25

Slide 28

Slide 28 text

[ࣸਅ] (্) ৅ҹ ενʔϜࣜՃ࣪ث EE-RQ35ܕ/EE-RQ50ܕ औѻઆ໌ॻ (Լ) ΞΠϦεΦʔϠϚ ਅۭอଘϑʔυγʔϥʔ VPF-385T औѻઆ໌ॻ ࢀߟ: Ոి඼Λ҆શʹ࢖͏ͨΊͷϚʔΫʛҰൠࡒஂ๏ਓՈి੡඼ڠձ https://aeha.or.jp/safety/mark/index.html ৘ใͷ෼ྨͷྫ: ՈిͷϚχϡΞϧ : :

Slide 29

Slide 29 text

৘ใͷ෼ྨͷྫ: ՈిͷϚχϡΞϧ [ࣸਅ] ৅ҹ ενʔϜࣜՃ࣪ث EE-RQ35ܕ/EE-RQ50ܕ औѻઆ໌ॻ

Slide 30

Slide 30 text

৘ใ͕෼ྨ͞Ε͍ͯΔͱศརͰ͢Ͷʂ ⏳estimate: 5 /25

Slide 31

Slide 31 text

ͲΜͳʮఔ౓ʯ͕͋Δʁ : : ( ): : ⏳estimate: 5~6 /25

Slide 32

Slide 32 text

§2 PHP .1 .2 PHP ⏳estimate: 5~6 /25

Slide 33

Slide 33 text

PHPʹ͓͚ΔΤϥʔఆ਺(ΤϥʔϨϕϧ) IUUQTXXXQIQOFUNBOVBMKBFSSPSGVODDPOTUBOUTQIQ

Slide 34

Slide 34 text

PHPͷΤϥʔܥ౷

Slide 35

Slide 35 text

PHPͷΤϥʔܥ౷ ͦΕͧΕɺ఻͑Α͏ͱ͍ͯ͠Δҙਤ͕ҧͬͨΓ 
 ΋ͨΒ݁͢Ռ͕ҧ͏Μͩͳʙ ۠ผ͕͋ΔΜͩͳʙ ⏳estimate: 6 /25

Slide 36

Slide 36 text

PHPͷΤϥʔͨͪʙ͜Ε͚ͩ͸֮͑Α͏ʙ E_ERROR => [ ] PHP E_WARNING => [ ] PHP E_NOTICE => [ ] PHP ⏳estimate: 6 /25

Slide 37

Slide 37 text

E_ERROR / ॏେ (Throwable) ⏳estimate: 6~7 /25

Slide 38

Slide 38 text

E_WARNING / ܯࠂ ( ) ( ) URL

Slide 39

Slide 39 text

E_NOTICE / ஫ҙ

Slide 40

Slide 40 text

§3

Slide 41

Slide 41 text

§3 .1 .2 ⏳estimate: 7 /25

Slide 42

Slide 42 text

ྑ͘ͳͦ͞͏ͳίʔυͱ͍͏ͷ͕͋Δ ⏳estimate: 7 /25

Slide 43

Slide 43 text

ᐆດ͞ʹ͍ͭͯ: shin1x1͞Μʮ੍໿ͷྗʯ https://speakerdeck.com/shin1x1/restricting-states ⏳estimate: 7~8 /25

Slide 44

Slide 44 text

ᐆດ͞ʹ͍ͭͯ: shin1x1͞Μʮ੍໿ͷྗʯ https://speakerdeck.com/shin1x1/restricting-states ⏳estimate: 7~8 /25

Slide 45

Slide 45 text

ᐆດ͞ʹ͍ͭͯ: shin1x1͞Μʮ੍໿ͷྗʯ https://speakerdeck.com/shin1x1/restricting-states ⏳estimate: 7~8 /25

Slide 46

Slide 46 text

ᐆດ͞ʹ͍ͭͯ: shin1x1͞Μʮ੍໿ͷྗʯ https://speakerdeck.com/shin1x1/restricting-states ⏳estimate: 8 /25

Slide 47

Slide 47 text

ᐆດ͞ʹ͍ͭͯ: t-wada͞Μͷʮ༧๷ʹউΔ๷ޚͳ͠ʯ https://speakerdeck.com/twada/growing-reliable-code-phperkaigi-2022 ⏳estimate: 8 /25

Slide 48

Slide 48 text

ᐆດ͞ʹ͍ͭͯ: t-wada͞Μͷʮ༧๷ʹউΔ๷ޚͳ͠ʯ https://speakerdeck.com/twada/growing-reliable-code-phperkaigi-2022 ⏳estimate: 8 /25

Slide 49

Slide 49 text

ྑ͘ͳ͍ίʔυ͕͜͏ͯ͠ੜ·ΕΔͧ ( ) ⏳estimate: 8~9 /25

Slide 50

Slide 50 text

ΤϥʔͱՄೳੑ ❌ 
 ⭕ ⏳estimate: 8~9 /25

Slide 51

Slide 51 text

͜ͷίʔυ͸ո͍͕͠ɾɾɾ ⏳estimate: 9 /25

Slide 52

Slide 52 text

͜ͷίʔυ͸ո͍͕͠ɾɾɾ PHP ⏳estimate: 9~10 /25

Slide 53

Slide 53 text

§3 .1 .2 ⏳estimate: 9~10 /25

Slide 54

Slide 54 text

Α͘ͳͦ͞͏ͳίʔυΛආ͚ΔͨΊʹ ⏳estimate: 10 /25

Slide 55

Slide 55 text

Τϥʔɺcase-by-case ( ) ( ) ⏳estimate: 10 /25

Slide 56

Slide 56 text

࣮ྫʂϓϩάϥϛϯά ( ) 
 ⏳estimate: 10~11 /25

Slide 57

Slide 57 text

࣮ྫʂPHP ( )

Slide 58

Slide 58 text

࣮ྫʂPHP : 
 include E_WARNING require E_ERROR 
 https://www.php.net/manual/ja/function.include.php ⏳estimate: 10~11 /25

Slide 59

Slide 59 text

ΤϥʔϨϕϧ͸ओ؍తʹܾ·Δ(ଆ໘΋͋Δ) ⏳estimate: 11 /25

Slide 60

Slide 60 text

ίϨ͸͋ͳͨͷ௚؍ʹ߹͏ʁ E_ERROR

Slide 61

Slide 61 text

ΤϥʔʹࣖΛ܏͚͍ͯ͜͏ʙ ⏳estimate: 11 /25

Slide 62

Slide 62 text

ΤϥʔʹࣖΛ܏͚͍ͯ͜͏ʙ 
 
 
 ⏳estimate: 11~12 /25

Slide 63

Slide 63 text

§4 PRO

Slide 64

Slide 64 text

Τϥʔɺා͍Ͱ͔͢ʁ ( ) ⏳estimate: 12 /25

Slide 65

Slide 65 text

ΤϥʔͷPRO͕ɺ஌͍ͬͯΔ͜ͱ 
 
 ( ) 
 
 ⏳estimate: 12~13 /25

Slide 66

Slide 66 text

Τϥʔ͕࣍ͷʮ૝ఆ֎ʯʮᐆດʯΛݺͿ ( ) [ग़య] 
 ᴷAndreas Zeller, தా लج, ࠓా ণ޺, େؠ ঘ޺, ஛ా ߳බ, ٶݪ ٱඒࢠ, फܗ ࣿ৫ 
 σόοάͷཧ࿦ͱ࣮ફ ―ͳͥϓϩάϥϜ͸͏·͘ಈ͔ͳ͍ͷ͔ P3 - P4

Slide 67

Slide 67 text

όά͸ʮൟ৩ʯ͢Δ 1 1 [ग़య] 
 ᴷ Shore, James, Warden, Shane, ฏು ݈ࣇ, ໦Լ ࢙඙, ࡫Ҫ ਸ࢘ 
 ΞʔτɾΦϒɾΞδϟΠϧσϕϩοϓϝϯτ : ૊৫Λ੒ޭʹಋ͘ΤΫετϦʔϜϓϩάϥϛϯά P169

Slide 68

Slide 68 text

Τϥʔ͕ڭ͑ͯ͘ΕΔ͜ͱɾ͘Εͳ͍͜ͱ 
 ⏳estimate: 13~14 /25

Slide 69

Slide 69 text

͖ͬ͞ͷίʔυ: Կ͕ਖ਼͍͠ʁ $taxRate 1.8 fl oat 0.8 fl oat 80(%) int ⏳estimate: 13~14 /25

Slide 70

Slide 70 text

ผͷྫ: ߏจΤϥʔ ( ) 7 if{} if {} 🤮 ⏳estimate: 13~14 /25

Slide 71

Slide 71 text

ผͷྫ: ߏจΤϥʔɺ͜ΕͩͬͨΒͲ͏ݟ͑Δʁ class{}

Slide 72

Slide 72 text

ผͷྫ: ߏจΤϥʔɺݟͨ໨ͰมΘΒͳ͍҆৺ײ ⏳estimate: 14 /25

Slide 73

Slide 73 text

Τϥʔͱ஥ྑ͘ͳΔʹ͸ PRO ⏳estimate: 14~15 /25

Slide 74

Slide 74 text

Τϥʔ͸ఢ͡Όͳ͍ɺ༑ୡͳΜͩʂʂ →ͦͷ৺͸ʁ ⏳estimate: 15~16 /25

Slide 75

Slide 75 text

Τϥʔͱ஥ྑ͘ͳΔͨΊͷίπ΋௫Έ·͠ΐ͏ʂ 
 ( ) = ( ) ⏳estimate: 16 /25

Slide 76

Slide 76 text

§5 PHP

Slide 77

Slide 77 text

§5 PHP .1 .2 ⏳estimate: 16~17 /25

Slide 78

Slide 78 text

ϓϩάϥϛϯάʹͱͬͯΤϥʔ͸ॏཁ ⏳estimate: 16~17 /25

Slide 79

Slide 79 text

PHP͸Ͳ͏͖ͯͨ͠ʁˠΑ͘࿩୊ʹͳΔ΍ͭ PHP5 -> PHP7 Throwable/Error E_STRICT : E_NOTICE, E_WARNING, E_DEPRECATED PHP7 -> PHP8 warning -> Error PHP8 -> PHP9 Error (8.2 Deprecated) Error

Slide 80

Slide 80 text

ᐆດ͞ͱͷઓ͍ PHP ⏳estimate: 17~18 /25

Slide 81

Slide 81 text

ᐆດ͞ͱͷઓ͍ E_WARNING/E_NOTICE Error throw E_NOTICE (7.4 ) E_NOTICE php.ini these are warnings which often result from a bug in your code, but it's possible that it was intentional ⏳estimate: 17~18 /25

Slide 82

Slide 82 text

php-src grep 7.x NOTICE WARNING 8.x WARNING E_NOTICE/ 
 E_WARNINGͷग़ݱ਺ git --no-pager grep E_NOTICE -- 'ext/**/*.c' | wc -l

Slide 83

Slide 83 text

RFCͳͲ PHP: rfc:engine_warnings 
 https://wiki.php.net/rfc/engine_warnings PHP: rfc:consistent_type_errors 
 https://wiki.php.net/rfc/consistent_type_errors Pull requests · php/php-src 
 https://github.com/php/php-src/pulls?q=label%3A%22Warning+promotion%22 PHP: rfc:unde fi ned_property_error_promotion 
 https://wiki.php.net/rfc/unde fi ned_property_error_promotion PHP: rfc:unde fi ned_variable_error_promotion 
 https://wiki.php.net/rfc/unde fi ned_variable_error_promotion

Slide 84

Slide 84 text

§5 PHP .1 .2

Slide 85

Slide 85 text

͜Ε͔ΒͲ͏ͳΓͦ͏ʁ NOTICE 
 PHP Error WARNING (DEPRECATED ) TypeError/ValueError

Slide 86

Slide 86 text

͜Ε͔ΒͲ͏͍ͯ͘͠ʁ PHP7.0 ⏳estimate: 20 /25

Slide 87

Slide 87 text

͜Ε͔ΒͲ͏͍ͯ͘͠ʁ E_NOTICE/E_WARNING (`===` strict ) PHPStan Psalm PHP ⏳estimate: 21 /25

Slide 88

Slide 88 text

No content

Slide 89

Slide 89 text

Τϥʔͱ্ख͘෇͖߹͏ͱɺ೉͕͠͞ݮΔ PHP 
 ⏳estimate: 21~22 /25

Slide 90

Slide 90 text

No content

Slide 91

Slide 91 text

͓͠·͍ʂ ͓෇͖߹͍͍͖ͨͩ 
 ͋Γ͕ͱ͏͍͟͝·ͨ͠