Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:124286 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by qa.php.net (Postfix) with ESMTPS id A6CE81A009C for ; Mon, 8 Jul 2024 11:48:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1720439395; bh=f8fMzoRLPt7G4B//nL2clznH0BgoAL0lr1wF1MFITkk=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=SDG3SIQdk73Pu4jZPFNANAz0zmNIuL6O28Gxf5gMtIvWJughmaslu7CjMhTAEhqdx tHFiW28+mH3eTe0Kw8Z5XwyZvfiPaQZ1t5Mm2koWI8OZRTTTcH7ch5fgvmDXWdRB6W JDNYIqD6k/5/rSfdz508M3X6eyPOqiUCXU90F3Ot3uNCz1royyF51A1Q6hwGJA1Pvz XbhkUeXnc0sNMa3AuaNf0YsSRCa7u5yJ/OzWV/Nfw+AXfb3240Umnb3/GOQqmA5Ue9 X35YousHUNpV1gbQtFgU6F/Jiea0JC5cTsY1Tqb4Xla0ltwBDJKNDce1jvRrO0luB0 chMrUyYE7n4uw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 5A2DE18006F for ; Mon, 8 Jul 2024 11:49:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from mail-yb1-f179.google.com (mail-yb1-f179.google.com [209.85.219.179]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Mon, 8 Jul 2024 11:49:53 +0000 (UTC) Received: by mail-yb1-f179.google.com with SMTP id 3f1490d57ef6-e03a581276eso3207487276.2 for ; Mon, 08 Jul 2024 04:48:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1720439308; x=1721044108; darn=lists.php.net; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=h/yF0XTIA6o08O7vsWBwL4yqQ8ay4GEzDZsrLajRjm0=; b=emKNve0P+uNYBkeBPMi98OnsTjExQgue8cPTS8B0wAKrKpdEbkdYduwSoZIKNnoyYG SxkHelmcZ5JxAE3hXstTIsZjgPdD1GlVOVdLTx2RPT7HXeHGDD/JLdPARy6CSrdMWzAB joCT6qT4aTzxP2CPbJIUxSHwUkLgQttPfL2O0iORRO4Y2zVGwmydP6x0gxCSSzK9C2Ns t3YOxPc6PiDKBl2TlHfreOTGCSRnN5HexImfCSimRpsa+WFCoUZ/GITUdX2FwKzO1csS Rr1GEwY6nNV/COtdHe4pxnxMOs+99f9c7wx7g941SpwnGXeOA5Qt9zAS/IjhdpnqXHIr v0mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720439308; x=1721044108; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=h/yF0XTIA6o08O7vsWBwL4yqQ8ay4GEzDZsrLajRjm0=; b=Fzbw09iiPuwkeFPZs2rFxaXVVfI5RvFIDiu5WSXLS2lkgk/DSENN2JyjSSgM+npGIM iYLs3qSfz1symRfFMkHgpGppvjHgW6q6G490E+N2NNKSQG75fjLlVj7Q/8L7kPBUpilw iIj9sBULtH2cstYfN0JK9t4DGKHClv0ZhmqPKj9bhDvmfq5azrw7xG6H7LqWenai5WZD QPxA+dP9iub//CTwUO/4NMZHvMSiBdSHw+b5sGfFXOouhRMHmE3UTh7MzDATvpfjq8AX 8prb7Wr83eHCyTJYWZ+h5A/L3F/cb/tCJJlI8GF2bptSFCcufy09e+edK9dj+bAAStlT /xyw== X-Forwarded-Encrypted: i=1; AJvYcCXQ4oEaldEmY47afoXCzxn/LO5cCuzl6rWYbSBvnro1WdgAmaLXxvsQRjyD1jH8mahTM7orMWTnHDUjuu/631MIXwENaVkruw== X-Gm-Message-State: AOJu0YyqZLR5bJBcsuUeDYoVDtOXPqx621r+Db256PQTnhrP8zXdLMns P66SfgI7nBWDs6Xb/W0CBjGxlxz6ULSl7flxj3pij5QuhjrM1SFbbHa32xaqZ5FCKDTG/YPJ0DZ PnkWIABS4lvsAmW6lckkXroBNJHg= X-Google-Smtp-Source: AGHT+IGqxDOTIfDqrD3ay/+GKvg91oX7sBWS9lPT+TrIS8YgMGnGmY+DnSm+YPyywU6Ry1mEyinPB8F5nLdmB/0d9vc= X-Received: by 2002:a25:aba7:0:b0:e03:629f:5c41 with SMTP id 3f1490d57ef6-e03c1bc82e7mr11270219276.55.1720439308329; Mon, 08 Jul 2024 04:48:28 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 References: <743774dd-2281-458d-b0fa-d3e8806a3516@scriptfusion.com> <3B6AF286-642C-4850-9577-B10049CE4C1E@koalephant.com> In-Reply-To: <3B6AF286-642C-4850-9577-B10049CE4C1E@koalephant.com> Date: Mon, 8 Jul 2024 14:48:10 +0300 Message-ID: Subject: Re: [PHP-DEV] [RFC] Static class To: Stephen Reay Cc: Bilge , Mike Schinkel , php internals Content-Type: multipart/alternative; boundary="000000000000d4aab1061cbafda2" From: drealecs@gmail.com (=?UTF-8?Q?Alexandru_P=C4=83tr=C4=83nescu?=) --000000000000d4aab1061cbafda2 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Jul 8, 2024 at 1:12=E2=80=AFPM Stephen Reay wrote: > > > So really the question should be: why do you feel the need to *disallow* = a > combination that has no technical issues, and works already? If you're > going to disallow abstract why not disallow any class inheritance at all? > Because that's what abstract relates to: class hierarchy. Why remove some > support but keep the rest? > > > Exactly what I wanted to say for this topic. Have a look at this example that could be very similar in production code in some systems:

On Mon, Jul 8, 2024 at 1:12=E2=80=AFPM St= ephen Reay <php-lists@koalep= hant.com> wrote:


So really the question should be: why do you feel the = need to *disallow* a combination that has no technical issues, and works al= ready? If you're going to disallow abstract why not disallow any class = inheritance at all? Because that's what abstract relates to: class hier= archy. Why remove some support but keep the rest?

=

Exactly what I wanted to s= ay for this topic. Have a look at this example that could be very similar i= n production code in some systems:
<?php

interface= A {
public static function run();
public = static function stop();}

abstract class B imp= lements A {
public static function run() {
static::c= reate();
static::start(); }
}

class C exte= nds B {
public static function create() {
echo "Create\n
";
}

= public static function start() {
echo "Start\n";
}=

public static function stop() {
echo = "Stop\n";
}
}

function e= xecute($class) {
if
(!is_subclass_of($class, A::class)) {
thr= ow new RuntimeException("Class must implement A interface"= ;
);
}

$clas= s::run(= );
$class::stop();
};
execute<= span style=3D"font-family:"JetBrains Mono",monospace;color:rgb(8,= 8,8)">(C::class)= ;

If we support inheritance for stat= ic classes, we should allow static on both interface and abstract classes.<= br>

Alex
--000000000000d4aab1061cbafda2--