Re: STH Docs.

From: Date: Mon, 18 May 2015 12:11:15 +0000
Subject: Re: STH Docs.
References: 1 2 3 4 5 6 7 8 9 10  Groups: php.doc 
Request: Send a blank email to phpdoc+get-969385658@lists.php.net to get a copy of this message
below +++ en/language/types/scalar_typed_parameters.xml @@ -0,0 +1,69 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- $Revision: 299488 $ --> + +<sect1 xml:id="language.types.scalar-typed-parameters" xmlns=" http://docbook.org/ns/docbook"> + <title>Scalar Typed Parameteres</title> + <warning> + Scalar Typed parameters documentation is currently been documented. + </warning> + <note> + <para> + Typed Parameters is also knowns as Type Hinting. + </para> + </note> + <para> + PHP 7 introduces scalar typed parameters. Functions are now able to force parameters + to be <type>string</type>, <type>int</type>, <type>float</type> or <type>bool</type>. + By default all PHP Files are in weakly typed mode. + To enable strict type checking declare(strict_types=1) directive must be the first, + statement in the file. strict_types takes has two options, 1 for strict type + checking and 0 for weak type checking. This only effect the file this is stated in and not + files either included in this file or other files that includes this file. + Whether or not the function being called was declared in a file that uses strict or weak + type checking is irrelevant. The type checking mode depends on the file where the function is called. + </para> + <example> + <title>Scalar Typed Parameters examples</title> + <programlisting role="php"> +<![CDATA[ +<?php +declare(strict_types=1); // Fatal error if this is not the first statement + +foo(); // strictly type-checked function call + +function foobar() { + foo(); // strictly type-checked function call +} + +class baz { + function foobar() { + foo(); // strictly type-checked function call + } +} + On Mon, May 18, 2015 at 5:36 PM, Peter Cowburn <petercowburn@gmail.com> wrote: > > > On 18 May 2015 at 12:45, Pasindu De Silva <ppasindud@gmail.com> wrote: > >> Hi Guys >> I have patched the intial doc for Scalar Type Declarations, and making >> "scalar typed parameters" a placeholder, which could be replaced >> when we have some consensus on the wording. so we can carry with the >> documenting the rest. >> > > Could you attach the patch here? > > >> >> +1 >> Pasindu >> >> On Sat, May 16, 2015 at 12:50 PM, Pasindu De Silva <ppasindud@gmail.com> >> wrote: >> >>> Guys, >>> do we have a consensus on whether type hinting has to be changed >>> to Parameter Typing or Typed Parameters or else left the same. >>> The scalar docs can go under >>> http://php.net/manual/en/language.types.php >>> >>> If we are going the change then for oop5.typehinting >>> We could clone "language.oop5.typehinting" to be >>> "language.types.other-typed-parameters" and put a warning on oop5.typehinting >>> about the change >>> later change things that are linked to oop5.typehinting to >>> types.other-typed-parameters. >>> >>> +1 >>> Thanks >>> >>> On Thu, Apr 30, 2015 at 9:32 PM, Hannes Magnusson <bjori@php.net> wrote: >>> >>>> Its difficult to redirect all translations of an page too. >>>> >>>> Historically we try to refer to the shorturl >>>> (http://php.net/oop5.typehinting) as that will do automatic language >>>> negotiation, in which case we only need to keep an errorhandler >>>> redirect for one entry. >>>> >>>> Our policy is to never rename/remove xml:ids of chunks. >>>> The best thing to do is to keep that xml:id for historical description >>>> (if that route is taken), and then we at least have the ID on file and >>>> might be able to do reasonable fallback to its container. >>>> >>>> Keep in mind that translations will not break if they have translated >>>> langauge/oop5.xml, and will include the current typehint page for a >>>> long long time, unless there is a reference to the new xml:id outside >>>> of the same hierarchy. >>>> >>>> This is a tricky thing to be doing and translators should likely be >>>> notified of the changes once they are done. >>>> >>>> -Hannes >>>> >>>> >>>> On Wed, Apr 29, 2015 at 4:37 AM, Pasindu De Silva <ppasindud@gmail.com> >>>> wrote: >>>> > Thanks for the info, >>>> > If the redirection of >>>> >>>> http://php.net/manual/en/language.oop5.typehinting.php >>>> > is done, not sure whether >>>> > it have effects on other languages maybe not. >>>> > >>>> >> Levi Morrison wrote: >>>> >> > - Please don't use the phrase "type hint" anywhere >>>> > >>>> > >>>> > some other suggestions would be helpful. >>>> > >>>> > -- >>>> > Pasindu De Silva >>>> > ppasindud@gmail.com >>>> >>> >>> >>> >>> -- >>> >>> *Pasindu De Silva**ppasindud@gmail.com <ppasindud@gmail.com>* >>> >> >> >> >> -- >> >> *Pasindu De Silva**ppasindud@gmail.com <ppasindud@gmail.com>* >> > > -- *Pasindu De Silva**ppasindud@gmail.com <ppasindud@gmail.com>*

« previous php.doc (#969385658) next »