Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129560 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 lists.php.net (Postfix) with ESMTPS id 1FA111A00BC for ; Fri, 5 Dec 2025 08:44:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1764924244; bh=297lqXmBwgFs2NZuuOOfCIJYNUdczY7lq3hC5jb9ksQ=; h=References:In-Reply-To:From:Date:Subject:Cc:From; b=lNUEnGR4zevKXgEDErHeywwMzYcnmg+dERbVkz7EuDTtr0qlHHAC2qT8+5UQDl80z WLetaoMmcCUtRnOvt4gcZKw7MT4hwqIN5D2C7VCytYkrRbFJpYzf17DwUkJ6WuM0rH QkpsDrsEVBIwZ9g3u9yfIXe49/wQHinQElyt2XnTsyiKn59oigUGM8ldH4AgATQfIX WLtAloZ/tBUK+yldxwk6gOCpYsqInLsQGiWn/GB7aDwXxUOvVQvtDm99H22lOU1ZSY 8rpsjI5JYoYXfU/sab/nJ0L6DSGm1sxR+ih8WPcfiBy0p0IeixGTLbr6fhoHXbBjTw 4QHKGEHkabpCg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id D9BA3180062 for ; Fri, 5 Dec 2025 08:44:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on php-smtp4.php.net X-Spam-Level: **** X-Spam-Status: No, score=4.9 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, MALFORMED_FREEMAIL,MISSING_HEADERS,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,T_SPF_TEMPERROR autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (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 ; Fri, 5 Dec 2025 08:43:57 +0000 (UTC) Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-47774d3536dso17228495e9.0 for ; Fri, 05 Dec 2025 00:43:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1764924231; x=1765529031; darn=lists.php.net; h=content-transfer-encoding:cc:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=eHbdseL5ueiiKFYg8sKC55SV8r31c3Jm/OnW3KfH0Bk=; b=cS7nHiD1/BgC8YyymTRkhktnSQeJoKhuZMNywyLUNtwJRe4IaYs/ZYLpbd2lthmxJg 2ojQYaChZ0HSyzmwUEYds7nxxA4O3KbKUlqQIZbUPphdHIFTNe1iayMLUsD5l/oh1P/R L9x34Sv0QRaNEJnuMQBywO+/wQ4C+cCFDN71aqnyaksbN3w8bz3gF2ersirQmIpWsoAh cfFGtzLHFPJr9d4IFxQXa5OGgE4gfhaZ31ilR5Djp1llIWY0TjsJHAcoqHhXCsTiIkwq GDTNCxaHFNx1nchNV22Nlz4Dtzu8VFSxuxx/mZcz7IA5lHkNI07rTy0K4QuvgKOJbHQX AUDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764924231; x=1765529031; h=content-transfer-encoding:cc:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=eHbdseL5ueiiKFYg8sKC55SV8r31c3Jm/OnW3KfH0Bk=; b=j7oq9EuvzhOwI/xjITNimi/+BtAlX0zE4wWWV7xqVLLanY4CnZa9GWvXuqa0pUkQ0H LCuSjmp800dJZR4P2x0OJda8iGLZQRstbUDfOoyhvkikDN3COctCtU1qZEObILs8WNwG giI3nGD45+jwrUc41/+76yu80CR9p5HwQDyTXHW5YC+D6/9/njhNCRRFjBWSdhP8j2fb QOVBqWnuL3brk6PB1UP5nTRV268UkagCit8YXKDjXm2O067nH23FbVqbyIZvL+PjJ2EB KNjn4E/1ARcG0TUE1fY4Fl8tTwTNX0vEVEeLBtOrAs0720Gm1KGjUXLWGs2Z0dlErugj xNQw== X-Gm-Message-State: AOJu0YxR9vLObP8C6xdHk0/fOwMiMLhoY+V639bTwthv4H/gVYWa6smN DOnYQv6kQ002IS9nf/L2AmSlFy2+MhHoGXPCs0ZSMwZI+05ZL+9aDIakTyw3mNHeXrx3E0Uq9SM KjoisqValbekohcug1K9zwCf/r4crYWo28flKvNFMkQ== X-Gm-Gg: ASbGncsG7cMopeOi06v8g4E8GWoGwGvB3H7MvWQkTNJwznDXSHE+TVm5mgQi0vos+sf NE9Hn6+Dfdn13O5uRn1W2GSwHwR/AwIdTsJwj0+YcGlWOPLo6KmhPqqKqqN8Vj56Ws+xeBIMM2g SZBACdb+Tx1d8MYijLDv0EiXOkTlsq5tbPEnqvB843nHjvkX700LD5xscp2mGffCDB/JNo2V/5y +ILQmFgNfDd2KHDHIKcnIgfhg1QpeiqKRSHqSUIrYM6sfzSpGOEVhtBylmKjsXYmk2Rrg== X-Google-Smtp-Source: AGHT+IEgCA24p7zFmR/RfpNi9qghUweEqo36kmLn+rj4sWagBwYK81LlAyxDPquLje7aAWICn5qA/PrO0feUZ8YsNJg= X-Received: by 2002:a05:600c:1e8f:b0:477:9fa0:7495 with SMTP id 5b1f17b1804b1-4792eb47356mr56442315e9.14.1764924231139; Fri, 05 Dec 2025 00:43:51 -0800 (PST) Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 References: <3D90E174-23F2-4B90-B881-20A0AD30CF0C@rwec.co.uk> <31ed0152483193e85ca3a9eebc5e6d14@bastelstu.be> <7497bedc-a13e-a627-f733-cb2495249e63@php.net> In-Reply-To: Date: Fri, 5 Dec 2025 10:43:38 +0200 X-Gm-Features: AQt7F2opZuCj7pnPFahL3X8k1l7E5uzXxOvVlGDJ1gBcr1RItV-67wQCqgCLcKc Message-ID: Subject: Re: [PHP-DEV] [RFC] [Discussion] Stringable Enums Cc: php internals Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable From: raveren@gmail.com (=?UTF-8?Q?Rokas_=C5=A0leinius?=) On Fri, Dec 5, 2025, 02:42 Bob Weinand wrote: > > Hey Larry, > > On 5.12.2025 01:21:43, Larry Garfield wrote: > > I've long argued against allowing __toString() for reasons others have al= ready covered, so I won't bother repeating it. But off hand I don't see wh= y __debugInfo() would cause a problem. I am not sure it's useful before AD= Ts happen, but I don't think it would cause any harm? > > I found to semi-commonly (the ergonomics of querying are bad) add attribu= tes to enum cases. A __debugInfo() handler could provide information about = all attached metadata. > > > Bob Slight correction: not metadata, we already have it in the form of the entire internal object state. It's full of noise, the user rarely wants that. __debugInfo() could contain a user-readable representation of the important parts of an object. For example dumping a Carbon object: Illuminate\Support\Carbon 2025-12-05 09:38:17.634246 Europe/Berlin (+01:00) vs Illuminate\Support\Carbon @1764923897 {#304 #endOfTime: false #startOfTime: false #constructedObjectId: "00000000000001300000000000000000" #localMonthsOverflow: null #localYearsOverflow: null #localStrictModeEnabled: null #localHumanDiffOptions: null #localToStringFormat: null #localSerializer: null #localMacros: null #localGenericMacros: null #localFormatFunction: null #localTranslator: null #dumpProperties: array:3 [ 0 =3D> "date" 1 =3D> "timezone_type" 2 =3D> "timezone" ] #dumpLocale: null #dumpDateProperties: null }