[presentations] master: PHP Minds and PHP UK talks
[email protected] (Derick Rethans) Wed, 16 Feb 2022 12:49:46 +0000
| Newsgroups | php.pres |
|---|---|
| Message-ID | <[email protected]> |
Author: Derick Rethans (derickr) Date: 2022-02-16T12:48:23Z Commit: https://github.com/php/presentations/commit/5e2711864cef5359611a6002cbf23d540922df33 Raw diff: https://github.com/php/presentations/commit/5e2711864cef5359611a6002cbf23d540922df33.diff PHP Minds and PHP UK talks Changed paths: A php-phpminds21.xml A php-phpuk22.xml A slides/internals/joke.jpg A slides/internals/peppa.xml A slides/internals/php81-array-is-list.xml A slides/internals/php81-array-unpacking.xml A slides/internals/php81-deprecations.xml A slides/internals/php81-mysqli-error-mode.xml A slides/internals/php81-octal-literal.xml A slides/internals/php81-pure-intersection.xml A slides/internals/php81-readonly.xml A slides/internals/php81-return-type-internal.xml A slides/internals/silence.png M slides/internals/php81-final-class-constants.xml M slides/internals/php81-intl-date-pattern-generator.xml M slides/internals/php81-new-in-initialisers-locations.xml M slides/internals/php81-new-in-initialisers.xml Diff: diff --git a/php-phpminds21.xml b/php-phpminds21.xml new file mode 100644 index 00000000..2de05050 --- /dev/null +++ b/php-phpminds21.xml @@ -0,0 +1,112 @@ +<?xml version="1.0" encoding="utf-8"?> +<presentation css="derick.css"> +<topic>PHP</topic> +<title>What's new in PHP 8.1</title> +<event>PHP Minds</event> +<location>Virtual Nottingham, UK</location> +<date>October 14th, 2021</date> +<speaker>Derick Rethans</speaker> +<email>[email protected]</email> +<twitter>derickr</twitter> +<url>https://derickrethans.nl/talks/php-phpminds21</url> +<joindin></joindin> +<slide>slides/xdebug/title.xml</slide> +<slide>slides/mongodb/me.xml</slide> + +<!-- PHP 8.1 RMs --> +<slide>slides/internals/php81-rms.xml</slide> + + +<!-- BIG NEW FEATURES --> +Enumerations (https://wiki.php.net/rfc/enumerations) +<slide>slides/internals/php81-enums-1.xml</slide> +<slide>slides/internals/php81-enums-2.xml</slide> +<slide>slides/internals/php81-enums-3.xml</slide> +<slide>slides/internals/php81-enums-4.xml</slide> +<slide>slides/internals/php81-enums-5.xml</slide> +<slide>slides/internals/php81-enums-6.xml</slide> +<slide>slides/internals/php81-enums-7.xml</slide> + +<!-- SYNTAX --> +Static Variables in Inherited Methods (https://wiki.php.net/rfc/static_variable_inheritance) +<slide>slides/internals/php81-static-vars.xml</slide> + +Noreturn type (https://wiki.php.net/rfc/noreturn_type) (never) +<slide>slides/internals/php81-never-type.xml</slide> + +Final class constants (https://wiki.php.net/rfc/final_class_const) +<slide>slides/internals/php81-final-class-constants.xml</slide> + +Pure Intersection Types (https://wiki.php.net/rfc/pure-intersection-types) +<slide>slides/internals/php81-pure-intersection.xml</slide> + +Array unpacking with string keys (https://wiki.php.net/rfc/array_unpacking_string_keys) +<slide>slides/internals/php81-array-unpacking.xml</slide> + +New in Initialisers (https://wiki.php.net/rfc/new_in_initializers) +<slide>slides/internals/php81-new-in-initialisers.xml</slide> +<slide>slides/internals/php81-new-in-initialisers-locations.xml</slide> + +<!-- +Auto-capturing multi-statement closures (https://wiki.php.net/rfc/auto-capture-closure) +<slide>slides/internals/php81-auto-capture-multi-statement-closures.xml</slide> +--> + +<!-- +Property Accessors (https://wiki.php.net/rfc/property_accessors) +<slide>slides/internals/php81-property-accessors.xml</slide> +<slide>slides/internals/php81-property-accessors-implicit.xml</slide> +<slide>slides/internals/php81-property-accessors-explicit.xml</slide> +<slide>slides/internals/php81-property-accessors-interface.xml</slide> +--> + +Readonly properties 2.0 (https://wiki.php.net/rfc/readonly_properties_v2) +<slide>slides/internals/php81-readonly.xml</slide> + +Explicit Octal Integer Literal Notation (https://wiki.php.net/rfc/explicit_octal_notation) +<slide>slides/internals/php81-octal-literal.xml</slide> + +<!-- FEATURES --> +Add IntlDatePatternGenerator (https://wiki.php.net/rfc/intldatetimepatterngenerator) +<slide>slides/internals/php81-intl-date-pattern-generator.xml</slide> + +Fibers (https://wiki.php.net/rfc/fibers) +<slide>slides/internals/php81-fibers.xml</slide> + +Add array_is_list() (https://wiki.php.net/rfc/is_list) +<slide>slides/internals/php81-array-is-list.xml</slide> + +Change Default mysqli Error Mode (https://wiki.php.net/rfc/mysqli_default_errmode) +<slide>slides/internals/php81-mysqli-error-mode.xml</slide> + + +<!-- DEPRECATIONS --> +Implemented: +Restrict $GLOBALS usage (https://wiki.php.net/rfc/restrict_globals_usage) +<slide>slides/internals/php81-restrict-globals-usage.xml</slide> + +Phasing out Serializable (https://wiki.php.net/rfc/phase_out_serializable) +<slide>slides/internals/php81-serializable.xml</slide> + +Deprecate passing null to non-nullable arguments of internal functions (https://wiki.php.net/rfc/deprecate_null_to_scalar_internal_arg) +<slide>slides/internals/php81-null-internal-functions.xml</slide> + +Deprecate implicit non-integer-compatible float to int conversions (https://wiki.php.net/rfc/implicit-float-int-deprecate) +<slide>slides/internals/php81-implicit-float-conversions.xml</slide> + +Add return type declarations for internal methods (https://wiki.php.net/rfc/internal_method_return_types) +<slide>slides/internals/php81-return-type-internal.xml</slide> + +<!-- TIDBITS --> +Other deprecations (https://wiki.php.net/rfc/deprecations_php_8_1) +<slide>slides/internals/php81-deprecations.xml</slide> + + +<slide>slides/xdebug/php81-when.xml</slide> + +<slide>slides/xdebug/phpinternalsnews.xml</slide> + +<slide>slides/internals/questions-new.xml</slide> +<slide>slides/xdebug/resources.xml</slide> + +</presentation> diff --git a/php-phpuk22.xml b/php-phpuk22.xml new file mode 100644 index 00000000..464bf28c --- /dev/null +++ b/php-phpuk22.xml @@ -0,0 +1,112 @@ +<?xml version="1.0" encoding="utf-8"?> +<presentation css="derick.css"> +<topic>PHP</topic> +<title>What's new in PHP 8.1</title> +<event>PHP UK Conference</event> +<location>London, UK</location> +<date>February 17th, 2022</date> +<speaker>Derick Rethans</speaker> +<email>[email protected]</email> +<twitter>derickr</twitter> +<url></url> +<joindin></joindin> +<slide>slides/xdebug/title.xml</slide> +<slide>slides/mongodb/me.xml</slide> + +<!-- PHP 8.1 RMs --> +<slide>slides/internals/php81-rms.xml</slide> + + +<!-- BIG NEW FEATURES --> +Enumerations (https://wiki.php.net/rfc/enumerations) +<slide>slides/internals/php81-enums-1.xml</slide> +<slide>slides/internals/php81-enums-2.xml</slide> +<slide>slides/internals/php81-enums-3.xml</slide> +<slide>slides/internals/php81-enums-4.xml</slide> +<slide>slides/internals/php81-enums-5.xml</slide> +<slide>slides/internals/php81-enums-6.xml</slide> +<slide>slides/internals/php81-enums-7.xml</slide> + +<!-- SYNTAX --> +Static Variables in Inherited Methods (https://wiki.php.net/rfc/static_variable_inheritance) +<slide>slides/internals/php81-static-vars.xml</slide> + +Noreturn type (https://wiki.php.net/rfc/noreturn_type) (never) +<slide>slides/internals/php81-never-type.xml</slide> + +Final class constants (https://wiki.php.net/rfc/final_class_const) +<slide>slides/internals/php81-final-class-constants.xml</slide> + +Pure Intersection Types (https://wiki.php.net/rfc/pure-intersection-types) +<slide>slides/internals/php81-pure-intersection.xml</slide> + +Array unpacking with string keys (https://wiki.php.net/rfc/array_unpacking_string_keys) +<slide>slides/internals/php81-array-unpacking.xml</slide> + +New in Initialisers (https://wiki.php.net/rfc/new_in_initializers) +<slide>slides/internals/php81-new-in-initialisers.xml</slide> +<slide>slides/internals/php81-new-in-initialisers-locations.xml</slide> + +<!-- +Auto-capturing multi-statement closures (https://wiki.php.net/rfc/auto-capture-closure) +<slide>slides/internals/php81-auto-capture-multi-statement-closures.xml</slide> +--> + +<!-- +Property Accessors (https://wiki.php.net/rfc/property_accessors) +<slide>slides/internals/php81-property-accessors.xml</slide> +<slide>slides/internals/php81-property-accessors-implicit.xml</slide> +<slide>slides/internals/php81-property-accessors-explicit.xml</slide> +<slide>slides/internals/php81-property-accessors-interface.xml</slide> +--> + +Readonly properties 2.0 (https://wiki.php.net/rfc/readonly_properties_v2) +<slide>slides/internals/php81-readonly.xml</slide> + +Explicit Octal Integer Literal Notation (https://wiki.php.net/rfc/explicit_octal_notation) +<slide>slides/internals/php81-octal-literal.xml</slide> + +<!-- FEATURES --> +Add IntlDatePatternGenerator (https://wiki.php.net/rfc/intldatetimepatterngenerator) +<slide>slides/internals/php81-intl-date-pattern-generator.xml</slide> + +Fibers (https://wiki.php.net/rfc/fibers) +<slide>slides/internals/php81-fibers.xml</slide> + +Peppa +<slide>slides/internals/peppa.xml</slide> + +Add array_is_list() (https://wiki.php.net/rfc/is_list) +<slide>slides/internals/php81-array-is-list.xml</slide> + +Change Default mysqli Error Mode (https://wiki.php.net/rfc/mysqli_default_errmode) +<slide>slides/internals/php81-mysqli-error-mode.xml</slide> + + +<!-- DEPRECATIONS --> +Implemented: +Restrict $GLOBALS usage (https://wiki.php.net/rfc/restrict_globals_usage) +<slide>slides/internals/php81-restrict-globals-usage.xml</slide> + +Phasing out Serializable (https://wiki.php.net/rfc/phase_out_serializable) +<slide>slides/internals/php81-serializable.xml</slide> + +Deprecate passing null to non-nullable arguments of internal functions (https://wiki.php.net/rfc/deprecate_null_to_scalar_internal_arg) +<slide>slides/internals/php81-null-internal-functions.xml</slide> + +Deprecate implicit non-integer-compatible float to int conversions (https://wiki.php.net/rfc/implicit-float-int-deprecate) +<slide>slides/internals/php81-implicit-float-conversions.xml</slide> + +Add return type declarations for internal methods (https://wiki.php.net/rfc/internal_method_return_types) +<slide>slides/internals/php81-return-type-internal.xml</slide> + +<!-- TIDBITS --> +Other deprecations (https://wiki.php.net/rfc/deprecations_php_8_1) +<slide>slides/internals/php81-deprecations.xml</slide> + +<slide>slides/xdebug/phpinternalsnews.xml</slide> + +<slide>slides/internals/questions-new.xml</slide> +<slide>slides/xdebug/resources.xml</slide> + +</presentation> diff --git a/slides/internals/joke.jpg b/slides/internals/joke.jpg new file mode 100644 index 00000000..61c8f9f7 Binary files /dev/null and b/slides/internals/joke.jpg differ diff --git a/slides/internals/peppa.xml b/slides/internals/peppa.xml new file mode 100644 index 00000000..1d0258c4 --- /dev/null +++ b/slides/internals/peppa.xml @@ -0,0 +1,2 @@ +<slide style="title" background="joke.jpg"> +</slide> diff --git a/slides/internals/php81-array-is-list.xml b/slides/internals/php81-array-is-list.xml new file mode 100644 index 00000000..e97601f6 --- /dev/null +++ b/slides/internals/php81-array-is-list.xml @@ -0,0 +1,14 @@ +<slide> +<title>Added %array_is_list()%</title> + +<break lines="1"/> +<blurb class="centre">%array_is_list(array $array): bool%</blurb> +<break lines="1"/> +<blurb class="centre">returns true, if:</blurb> + +<div effect="fade-in"><blurb class="big-centre">There are only *numeric* keys</blurb></div> +<div effect="fade-in"><blurb class="big-centre">The numeric keys start with *%0%*</blurb></div> +<div effect="fade-in"><blurb class="big-centre">Numeric keys are *increasing*</blurb></div> +<div effect="fade-in"><blurb class="big-centre">Keys leave *no gaps*</blurb></div> + +</slide> diff --git a/slides/internals/php81-array-unpacking.xml b/slides/internals/php81-array-unpacking.xml new file mode 100644 index 00000000..bd39dd2c --- /dev/null +++ b/slides/internals/php81-array-unpacking.xml @@ -0,0 +1,41 @@ +<slide> +<title>Array Unpacking with String Keys</title> + +<div effect="fade-out"> +<blurb>Added in PHP 7.4:</blurb> +<example class="big"> +<?php +$apples = [ '🍎', '🍏' ]; +$fruits = [ '🍐', '🍑', ...$apples, '🍓', '🍅' ]; + +echo "Fruit salad: ", implode( '', $fruits ), "\n"; +?> +</example> +<blurb>Result:</blurb> +<example class="big"> +Fruit salad: 🍐🍑🍎🍏🍓🍅 +</example> +</div> + +<div effect="fade-in"> +<blurb>PHP 8.1 adds support for string keys</blurb> +<example class="big"> +<?php +$apples = [ 'red' => '🍎', 'green' => '🍏' ]; +$others = [ 'green' => '🍐', 'pink' => '🍑' ]; +$fruits = [ ...$apples, ...$others ]; + +var_dump( $fruits ); +?> +</example> +<blurb>Result:</blurb> +<example class="big"> +array(3) { + 'red' => string(4) "🍎" + 'green' => string(4) "🍐" + 'pink' => string(4) "🍑" +} +</example> +</div> + +</slide> diff --git a/slides/internals/php81-deprecations.xml b/slides/internals/php81-deprecations.xml new file mode 100644 index 00000000..48066801 --- /dev/null +++ b/slides/internals/php81-deprecations.xml @@ -0,0 +1,27 @@ +<slide> +<title>PHP 8.1 deprecations</title> + +<list> + <bullet>%date_sunrise()% and %date_sunset()%</bullet> + <bullet>%key()%, %current()%, %next()%, %prev()%, and %reset()% on objects</bullet> + <bullet>mb_check_encoding()% without argument</bullet> + <bullet>%FILE_BINARY% and %FILE_TEXT %constants</bullet> + <bullet>Passing bool for %$value% argument of %IntlCalendar::roll()%</bullet> + <bullet>Accessing static members on traits</bullet> + <bullet>%strptime()%</bullet> + <bullet>%strftime()% and %gmtstrftime()%</bullet> + <bullet>%mhash*()% function family</bullet> + <bullet>%ctype_*()% function family accepts int parameters</bullet> + <bullet>Return by reference with void type</bullet> + <bullet>NIL constant defined by the IMAP extension</bullet> + <bullet>Calling overloaded pgsql functions without the connection argument</bullet> + <bullet>%$num_points% parameter of %image(open|filled)polygon%</bullet> + <bullet>%mysqli::init()%</bullet> + <bullet>%filter.default% ini setting</bullet> + <bullet>%auto_detect_line_endings% ini setting</bullet> + <bullet>ssl_method option to SoapClient constructor</bullet> + <bullet>%FILTER_SANITIZE_STRING%</bullet> + <bullet>%oci8.old_oci_close_semantics% ini setting</bullet> + <bullet>%odbc_result_all()%</bullet> +</list> +</slide> diff --git a/slides/internals/php81-final-class-constants.xml b/slides/internals/php81-final-class-constants.xml index 0e6cbb86..14b8e19b 100644 --- a/slides/internals/php81-final-class-constants.xml +++ b/slides/internals/php81-final-class-constants.xml @@ -1,4 +1,4 @@ -<slide template="draft"> +<slide> <title>Final Class Constants</title> <blurb class="centre">Currently, class constants are always overridable by child classes</blurb> diff --git a/slides/internals/php81-intl-date-pattern-generator.xml b/slides/internals/php81-intl-date-pattern-generator.xml index 48923e85..45329ef8 100644 --- a/slides/internals/php81-intl-date-pattern-generator.xml +++ b/slides/internals/php81-intl-date-pattern-generator.xml @@ -1,4 +1,4 @@ -<slide template="draft"> +<slide> <title>IntlDatePatternGenerator</title> <div effect="fade-out"> diff --git a/slides/internals/php81-mysqli-error-mode.xml b/slides/internals/php81-mysqli-error-mode.xml new file mode 100644 index 00000000..3dcb6d76 --- /dev/null +++ b/slides/internals/php81-mysqli-error-mode.xml @@ -0,0 +1,24 @@ +<slide> +<title>Change Default mysqli Error Mode</title> + +<div effect="fade-out"> +<break lines="4"/> +<blurb class="centre">Old default:</blurb> + +<image align="center" filename="silence.png"/> +</div> + +<div effect="fade-in"> +<break lines="3"/> +<blurb class="centre">New default:</blurb> +</div> + +<div effect="fade-in"> +<break lines="1"/> +<blurb class="centre">%mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);%</blurb> +</div> + +<div effect="fade-in"><blurb class="big-centre">Exceptions</blurb></div> +<div effect="fade-in"><blurb class="big-centre">Exceptions</blurb></div> +<div effect="fade-in"><blurb class="big-centre">Exceptions</blurb></div> +</slide> diff --git a/slides/internals/php81-new-in-initialisers-locations.xml b/slides/internals/php81-new-in-initialisers-locations.xml index c86a750c..194576ca 100644 --- a/slides/internals/php81-new-in-initialisers-locations.xml +++ b/slides/internals/php81-new-in-initialisers-locations.xml @@ -1,4 +1,4 @@ -<slide template="draft"> +<slide> <title>New in Initialisers — Where?</title> <div effect="fade-in"> diff --git a/slides/internals/php81-new-in-initialisers.xml b/slides/internals/php81-new-in-initialisers.xml index 20b81732..629578d5 100644 --- a/slides/internals/php81-new-in-initialisers.xml +++ b/slides/internals/php81-new-in-initialisers.xml @@ -1,4 +1,4 @@ -<slide template="draft"> +<slide> <title>New in Initialisers</title> <blurb>In PHP 8.0:</blurb> diff --git a/slides/internals/php81-octal-literal.xml b/slides/internals/php81-octal-literal.xml new file mode 100644 index 00000000..89fe09ca --- /dev/null +++ b/slides/internals/php81-octal-literal.xml @@ -0,0 +1,26 @@ +<slide> +<title>Explicit Octal Integer Literal Notation</title> + +<blurb>Adds support for the %0o% and %0O% prefixes, like %0x% and %0B%:</blurb> + +<example inline="1" class="big"> +0*o*16 === 14; // true +0*o*123 === 83; // true + +0*O*16 === 14; // true +0*O*123 === 83; // true + +016 === 0*o*16; // true +016 === 0*O*16; // true +</example> + +<div effect="fade-in"> +<break lines="2"/> +<blurb>Numeric strings are ~always~ decimal:</blurb> +<example class="big" inline="1"> +(int) "*0*16" ⇒ 16 +(int) "*0o*16" ⇒ 0 +</example> +</div> + +</slide> diff --git a/slides/internals/php81-pure-intersection.xml b/slides/internals/php81-pure-intersection.xml new file mode 100644 index 00000000..56dfa957 --- /dev/null +++ b/slides/internals/php81-pure-intersection.xml @@ -0,0 +1,47 @@ +<slide> +<title>Pure Intersection Types</title> + +<div effect="fade-out"> +<blurb>To enforce a value is both %Traversable% and %Countable%:</blurb> +<example><![CDATA[<?php +class Test { + private ?Traversable $traversable = null; + private ?Countable $countable = null; + /** @var Traversable&Countable */ + private $both = null; + + public function __construct($countableIterator) { + $this->traversable =& $this->both; + $this->countable =& $this->both; + $this->both = $countableIterator; + } +} +]]></example> +</div> + +<div effect="fade-in"> +<blurb>In PHP 8.1:</blurb> +<example inline="1"><![CDATA[<?php +class Test { + private *Traversable&Countable* $countableIterator; + + public function setIterator(*Traversable&Countable* $countableIterator): void { + $this->countableIterator = $countableIterator; + } + + public function getIterator(): *Traversable&Countable* { + return $this->countableIterator; + } +} +]]></example> +</div> + +<div effect="fade-in"> +<break lines="2"/> +<list> + <bullet>Only for class and interface names</bullet> + <bullet>Variance rules are respected, but they are complicated</bullet> +</list> +</div> + +</slide> diff --git a/slides/internals/php81-readonly.xml b/slides/internals/php81-readonly.xml new file mode 100644 index 00000000..0cc6596c --- /dev/null +++ b/slides/internals/php81-readonly.xml @@ -0,0 +1,37 @@ +<slide> +<title>Readonly Properties</title> + +<div effect="fade-out"> +<blurb>To enforce 'readonly'-bility:</blurb> +<example inline="1"><![CDATA[<?php +class User +{ + public function __construct(*private* string $name) {} + + *public function getName()*: string { + return $this->name; + } +} +]]></example> +</div> + +<div effect="fade-in"> +<blurb>In PHP 8.1, with a real keyword, %readonly%:</blurb> +<example inline="1"><![CDATA[<?php +class User +{ + public function __construct(public *readonly* string $name) {} +} +]]></example> +</div> + +<div effect="fade-in"> +<break lines="2"/> +<blurb>Restrictions:</blurb> +<list> + <bullet>Can only be initialised once</bullet> + <bullet>Can only be initialised from the scope where it was declared</bullet> +</list> +</div> + +</slide> diff --git a/slides/internals/php81-return-type-internal.xml b/slides/internals/php81-return-type-internal.xml new file mode 100644 index 00000000..551bdf51 --- /dev/null +++ b/slides/internals/php81-return-type-internal.xml @@ -0,0 +1,39 @@ +<slide> +<title>Internal Method Return Types</title> + +<blurb>Non-final internal method return types are now declared.</blurb> +<example><![CDATA[<?php +class MyDateTime extends DateTime +{ + public function modify(string $modifier) { return false; } +} +]]></example> + +<div effect="fade-in-out"> +<blurb>In PHP 8.1:</blurb> +<example>Deprecated: Declaration of MyDateTime::modify(string $modifier) + should be compatible with DateTime::modify(string $modifier): DateTime|false</example> +</div> + +<div effect="fade-in-out"> +<blurb>In PHP 9.0:</blurb> +<example>Fatal error: Declaration of MyDateTime::modify(string $modifier) + must be compatible with DateTime::modify(string $modifier): DateTime|false</example> +</div> + +<div effect="fade-in"> +<break/> +<blurb>To support PHP 7.4 through PHP 8.1:</blurb> +<example inline="1"><![CDATA[<?php +class MyDateTime extends DateTime +{ + /** + * @return DateTime|false + */ + *#[ReturnTypeWillChange]* + public function modify(string $modifier) { return false; } +} +]]></example> +</div> + +</slide> diff --git a/slides/internals/silence.png b/slides/internals/silence.png new file mode 100644 index 00000000..fe0e74b8 Binary files /dev/null and b/slides/internals/silence.png differ