Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > de.comp.lang.php > #3497

Re: Designfrage

From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Newsgroups de.comp.lang.php
Subject Re: Designfrage
Date 2015-10-05 22:33 +0200
Organization PointedEars Software (PES)
Message-ID <2096934.Cc3SdgHTVJ@PointedEars.de> (permalink)
References <1t55f16c9di4689n3e8%sfroehli@Froehlich.Priv.at> <murnm1$qlc$1@dont-email.me> <2915507.bUqziVz7J1@PointedEars.de>

Show all headers | View raw


Thomas 'PointedEars' Lahn wrote:

> Funktionen, deren Rückgabewert nicht mittels Parameter für die “return”-
> Anweisung angegeben wurde, haben in PHP implizit den Rückgabewert NULL:
> 
>   class C
>   {
>     private $answer = 42;
> 
>     public function foo ()
>     {
>       return $this->answer;
>     }

Refactoring-Fehler: Hier sollte natürlich nur

  public function foo () {}

stehen.  Alternativ auch:

  public function foo ()
  {
    return;
  }

>     […]
>   }
> 
>   $instance = new C();
> 
>   /* class C#1 (0) { } */
>   var_dump($instance);
> 
>   /* int(42) */

Copypaste-Fehler: Hier sollte natürlich

  /* NULL */

stehen.

>   var_dump($instance->foo());

-- 
PointedEars
Zend Certified PHP Engineer
Twitter: @PointedEars2
Please do not cc me. / Bitte keine Kopien per E-Mail.

Back to de.comp.lang.php | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Designfrage Stefan+Usenet@Froehlich.Priv.at (Stefan Froehlich) - 2015-09-10 11:48 +0000
  Re: Designfrage Niels Braczek <nbraczek@freenet.de> - 2015-09-10 14:53 +0200
  Re: Designfrage Claus Reibenstein <4spamersonly@kabelmail.de> - 2015-09-10 18:57 +0200
    Re: Designfrage Gregor Kofler <usenet@gregorkofler.com> - 2015-09-11 00:54 +0200
      Re: Designfrage Claus Reibenstein <4spamersonly@kabelmail.de> - 2015-09-11 12:07 +0200
  Re: Designfrage failwell <steve@mindfav.com> - 2015-10-04 17:29 +0000
    Re: Designfrage Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-10-05 22:28 +0200
      Re: Designfrage Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-10-05 22:33 +0200
      Re: Designfrage "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-12-12 19:16 +0100
        Re: Designfrage Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-12-12 20:25 +0100
  Re: Designfrage Andreas Treichel <gmblar@gmail.com> - 2015-11-01 11:09 +0100

csiph-web