diff --git a/appendices/migration70/new-features.xml b/appendices/migration70/new-features.xml index f029284480..04678be71f 100644 --- a/appendices/migration70/new-features.xml +++ b/appendices/migration70/new-features.xml @@ -4,101 +4,6 @@ New features - - Null coalesce operator - - - The null coalesce operator (??) has been added as - syntactic sugar for the common case of needing to use a ternary in - conjunction with isset. It returns its first operand - if it exists and is not &null;; otherwise it returns its second operand. - - - - - -]]> - - - - - - - - Spaceship operator - - The spaceship operator is used for comparing two expressions. It returns an - integer less than, equal to, or greater than zero when - $a is respectively less than, equal to, or greater than - $b. Comparisons are performed according to PHP's usual - type comparison rules. - - - - 1; // 0 -echo 1 <=> 2; // -1 -echo 2 <=> 1; // 1 - -// Floats -echo 1.5 <=> 1.5; // 0 -echo 1.5 <=> 2.5; // -1 -echo 2.5 <=> 1.5; // 1 - -// Strings -echo "a" <=> "a"; // 0 -echo "a" <=> "b"; // -1 -echo "b" <=> "a"; // 1 -?> -]]> - - - - - - - - Constant arrays using <function>define</function> - - - Array constants can now be defined with - define. In PHP 5.6, they could only be defined with - &const;. - - - - - -]]> - - - - Scalar Type Declarations @@ -187,6 +92,7 @@ Fatal error: Uncaught TypeError: Argument 1 passed to add() must be of the type will apply. + Return Type Declarations @@ -312,6 +218,101 @@ Fatal error: Uncaught TypeError: Return value of B::test() must be an instance o not a valid return type - only an instance of the class A can be returned. + + + Null coalesce operator + + + The null coalesce operator (??) has been added as + syntactic sugar for the common case of needing to use a ternary in + conjunction with isset. It returns its first operand + if it exists and is not &null;; otherwise it returns its second operand. + + + + + +]]> + + + + + + + + Spaceship operator + + The spaceship operator is used for comparing two expressions. It returns an + integer less than, equal to, or greater than zero when + $a is respectively less than, equal to, or greater than + $b. Comparisons are performed according to PHP's usual + type comparison rules. + + + + 1; // 0 +echo 1 <=> 2; // -1 +echo 2 <=> 1; // 1 + +// Floats +echo 1.5 <=> 1.5; // 0 +echo 1.5 <=> 2.5; // -1 +echo 2.5 <=> 1.5; // 1 + +// Strings +echo "a" <=> "a"; // 0 +echo "a" <=> "b"; // -1 +echo "b" <=> "a"; // 1 +?> +]]> + + + + + + + + Constant arrays using <function>define</function> + + + Array constants can now be defined with + define. In PHP 5.6, they could only be defined with + &const;. + + + + + +]]> + + + Anonymous Classes