You probably know it, but I wanted to note that you can implement it in
userland with minimal effort: https://3v4l.org/DoXJo#v8.4.10
--
Best regards,
Bruce Weirdan mailto:
weir...@gmail.com
uction
server.
Why couldn't you just do
```php
if (php_sapi_name() === 'cli-server') {
$_ENV['APP_ENV'] = 'development';
}
```
in your entry point script?
--
Best regards,
Bruce Weirdan mailto:
weir...@gmail.com
form of contravariant return,
and thus breaks Liskov Substitution Principle. Your suggestion of making it
an opaque value that cannot be read outside of the called function is a
nice (and maybe the only) way to resolve this problem.
--
Best regards,
Bruce Weirdan mailto:
weir...@gmail.com
re less ergonomic than
what we already have now in docblocks.
--
Best regards,
Bruce Weirdan mailto:
weir...@gmail.com
ecode.xml
--
Best regards,
Bruce Weirdan mailto:
weir...@gmail.com
Is there a reason to keep crc32?
--
Best regards,
Bruce Weirdan mailto:
weir...@gmail.com
On Tue, Jun 25, 2024 at 9:51 AM Luigi Cardamone
wrote:
>
> Is it possible to replace "$this" with "this"? Cleaner and coherent with
> "self".
>
That wouldn't be possible, as `this` is a valid class name:
https://3v4l.org
This definitely looks like a powerful feature I'm looking forward to.
If property/param/return guards are implemented, do you see them eventually
replacing the property/param/return types we have nowadays?
Asking for a friend.
nd it very confusing if the following crashed
```php
function f(Universe $_u): void {}
$universe = new Universe(size:'big');
$shoe = new Shoe(size:'big);
if ($shoe === $universe) {
f($shoe); // shoe is *identical* to the universe, so it should be
a
On Tue, Feb 27, 2024 at 6:22 PM Bruce Weirdan wrote:
>
> Hi Larry and others
>
> On Fri, Feb 23, 2024 at 12:57 AM Larry Garfield
> wrote:
> >
> >
> > I've added an FAQ section explaining why the Python/JS approach wouldn't
> > really work.
jectStorage with an
incompatible `seek()` already implemented (e.g.
https://3v4l.org/uW9Yl), so it shouldn't happen in a patch release.
Not that I expect there to be many of those, but still.
--
Best regards,
Bruce Weirdan mailto:weir...@gmail.com
On Sun, Mar 10, 2024 at 2:38 AM Jim Winstead wrote:
>
> On Sat, Mar 9, 2024, at 1:04 PM, Bruce Weirdan wrote:
> > On Sat, Mar 9, 2024, 20:46 Jim Winstead wrote:
> >> If the adherence to semantic versioning is meant to be strict,
> >
> > PHP doesn't follow
Hi Jim
On Sat, Mar 9, 2024, 20:46 Jim Winstead wrote:
> If the adherence to semantic versioning is meant to be strict,
PHP doesn't follow semver and never had.
to also list `session.trans_sid_tags` and
`session.trans_sid_hosts` as
deprecated. And mentioning that `output_add_rewrite_var()` is
unaffected wouldn't harm either.
--
Best regards,
Bruce Weirdan mailto:weir...@gmail.com
ed this way and found some technical obstacles. If
you did, it would probably make sense to list them in the FAQ section.
[1]
https://wiki.php.net/rfc/property-hooks#why_not_pythonjavascript-style_accessor_methods
--
Best regards,
Bruce Weirdan mailto:weir...@gmail.com
ttps://www.postgresql.org/docs/current/two-phase.html), MySQL (
https://dev.mysql.com/doc/refman/8.0/en/xa.html) and Oracle (
https://docs.oracle.com/en/database/oracle/oracle-database/21/admin/distributed-transactions-concepts.html#GUID-8152084F-4760-4B89-A91C-9A84F81C23D1)
all support it.
--
$FileName { readfile($FileName); };
>
>
> title ?>
> bodyStream ?>
>
>
> Thank you for considering!
>
> Regards,
> Shailesh
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: https://www.php.net/unsub.php
>
()`
if we already know it will be deprecated and removed soon enough?
--
Best regards,
Bruce Weirdan mailto:weir...@gmail.com
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php
eone may *think* it would?
--
Best regards,
Bruce Weirdan mailto:weir...@gmail.com
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php
rather than just using
> new punctuation, if we wanted to encourage that analogy.
Would this be allowed in files included in the methods of the anonymous class?
`$this->` and `self::` is, and it's a pain point for static analyzers,
forcing us to invent
things like `@psalm-scope-this`
On Thu, Mar 2, 2023 at 1:23 PM Jakub Zelenka wrote:
> The schema version should be specified by $schema keyword
Unfortunately, it's not what happens in the wild. Some schemas even
forbid `$schema` (e.g. Composer's one).
--
Best regards,
On Tue, Feb 21, 2023 at 7:53 AM someniatko wrote:
> We want to write some tests for the Service class, but we don't want
> to use a real SomeDependency instance
> during tests. A common approach is to either extract an interface
> (JUST to make it testable), or to drop the
> `final` keyword and a
On Fri, Nov 4, 2022 at 10:49 AM Marco Pivetta wrote:
> What's convenient about `Foo::{$bar}` vs `constant(Foo::class . '::' .
> $bar)`? I'm a bit confused by this :|
>From the static analysis POV `Foo::{$bar}` is way better, as we can immediately
see that the code is trying to access a constant
On Mon, Mar 28, 2022 at 7:56 PM Karoly Negyesi wrote:
> match ($object) {
> Someinterface => 'foo',
> AnotherInterface => 'bar',
> }
>
> this can not clash with any existing code as using identifiers like this
> are a syntax error currently.
That's valid code actually, see https://3v4l.org/BE
On Tue, Jan 25, 2022 at 9:45 PM Chase Peeler wrote:
> it will make this much more difficult to read since the constants.php will
> have to be
> updated:
>
> if(!defined('dbserver')){
> define('dbserver','productiondb.example.com');
> }
> if(!defined('otherconstant')){
>define('otherconstan
the code
> decomposition taking into account ISP.
Prior art: @psalm-require-extends and @psalm-require-implements Psalm
annotations:
https://psalm.dev/docs/annotating_code/supported_annotations/#psalm-require-extends
--
Best regards,
Bruce Weirdan
;Has words' field): list:(internals.lists.php.net)
Do this: Never send it to Spam
--
Best regards,
Bruce Weirdan mailto:weir...@gmail.com
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php
work [1]
[1] https://3v4l.org/EfmJq
--
Best regards,
Bruce Weirdan mailto:weir...@gmail.com
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php
adonly it would probably be better
to declare that with a class modifier.
E.g.
```php
readonly class Entity {
public int $count;
public string $data;
}
```
Though `readonly` doesn't look like a perfect fit in that position to me.
--
Best regards,
y time.
Now that's a problem. If the same code produces different results for
expression literalness depending on external factors like available
memory it may pass in the test environment, but fail in production.
--
Best regards,
Bruce Weirdan mail
On Sat, Jun 26, 2021 at 1:21 AM Craig Francis wrote:
> We're going back to the original is_literal() proposal.
>
> https://wiki.php.net/rfc/is_literal
Nice work! `chr()` returning literal strings is somewhat questionable,
but otherwise this is looking very good.
--
Best regard
far from there real quick and now
people can't even name the thing.
--
Best regards,
Bruce Weirdan mailto:weir...@gmail.com
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php
> - String + int concatenation isn't an injection risk.
I think this demonstrates it very well could be:
https://externals.io/message/114988#115038
--
Best regards,
Bruce Weirdan mailto:weir...@gmail.com
--
PHP Internals - PHP Runtime Dev
hes `literal-int` from `int` and
considers the result of
literal-string + int concatenation a non-literal string:
https://psalm.dev/r/59ad602688
This may mean that Matthew's point has been misinterpreted.
--
Best regards,
Bruce Weirdan mailto:weir...@g
y used a lot).
To clarify, do you imply that *all* integers are safe? Or would they
also be differentiated into literal and non-literal varieties?
--
Best regards,
Bruce Weirdan mailto:weir...@gmail.com
--
PHP Internals - PHP Runtime Development Mai
uage.
--
Best regards,
Bruce Weirdan mailto:weir...@gmail.com
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php
t to make sure constructor is
*not* defined, e.g.
```
private final function __construct();
```
(often seen in singleton implementations).
--
Best regards,
Bruce Weirdan mailto:weir...@gmail.com
--
PHP Internals - PHP Runtime Development Mailing
that type
as a part of function signature like you can do with other types.
--
Best regards,
Bruce Weirdan mailto:
weir...@gmail.com
Interface::format()) would solve that.
--
Best regards,
Bruce Weirdan mailto:
weir...@gmail.com
if (is_array($array, $this->getFlags())) { ... }
}
```
--
Best regards,
Bruce Weirdan mailto:
weir...@gmail.com
PHP. But once it
gets introduced and *if* it forbids usage on some elements it wouldn't be
possible to fix this from userspace.
--
Best regards,
Bruce Weirdan mailto:
weir...@gmail.com
o pass a marker object and check
> the identity of that to know if no matches have been found:
>
> $none = new stdClass;
> $element = first($collection, fn($elt) => ...);
> if ($element === $none) {
> // nothing found
> }
>
Of course it should have been `$element = first($collection, fn($elt)
=>..., $none);`
--
Best regards,
Bruce Weirdan mailto:
weir...@gmail.com
matches have been found:
$none = new stdClass;
$element = first($collection, fn($elt) => ...);
if ($element === $none) {
// nothing found
}
--
Best regards,
Bruce Weirdan mailto:
weir...@gmail.com
On Wed, Jul 22, 2020 at 4:21 PM Christian Schneider
wrote:
> but not to arithmetic *operators* like 42 + "" because that doesn't
> currently trigger E_WARNING AFAIK.
>
It does produce warning since PHP 7.1 : https://3v4l.org/4CV1E
--
Best rega
--
Best regards,
Bruce Weirdan mailto:
weir...@gmail.com
gar to `$f($x)` with
> > the RFC), which allows to write e.g. `xs -: sort -: reverse` instead
> > of `reverse (sort xs)` or `(reverse . sort) xs`.
>
> If I ever actually wrote Haskell, I'd find that extremely useful. :-)
>
> --Larry Garfield
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Best regards,
Bruce Weirdan mailto:
weir...@gmail.com
s to the parsed form of php://input
What about $query and $body? That would be closer to the terminology
used in HTTP RFCs.
--
Best regards,
Bruce Weirdan mailto:weir...@gmail.com
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
There's also a fourth approach that does not involve any changes to
PHP: autoload + eval.
When PHP is looking for your class, in your autoload you load the
values from config, generate the class source and eval() it.
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: h
ING). That check would have to move to mysqli_stmt_execute, if it is
> still to be performed.
If `bind_param` is allowed to do incomplete bind (as in your example
where you supply 2 out of 3 required bound parameters) t
hen there's no need for additional method, as you could simply do:
$_SERVER['phone'] !?? $user->setName($_SERVER['phone']);
> $_SERVER['email'] !?? $user->setName($_SERVER['email']);
What you described is already achievable with short-circuit && :
isset($_SERVER['fname
On Fri, Oct 11, 2019 at 2:43 PM Andreas Hennings wrote:
> What other use cases exist for exit()?
Setting exit code for cli scripts.
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
going
to yield false
negatives [1]
[1] https://3v4l.org/4HgUL
--
Best regards,
Bruce Weirdan mailto:weir...@gmail.com
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
=typehint&l=en&p=all
--
Best regards,
Bruce Weirdan mailto:weir...@gmail.com
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
ead of (LATIN SMALL LETTER C U+0063).
Incidentally these two chars also share the same physical button in
English/Russian keyboard layouts,
so it's a mistake easy to make and very hard to spot visually:
https://3v4l.org/rjjU9
--
Best regards,
Bruce Weirdan
ogle something),
so it implies you have a way to enter latin characters. Keyboard layout
switching is a problem solved decades ago.
--
Best regards,
Bruce Weirdan mailto:
weir...@gmail.com
> array_map and array_filter combined
This example has array_map and array_filter in wrong order (duplicated once
or twice below as well).
The RFC proposes to allow multiple `for`s in comprehensions, and really
could benefit from an example of such usage.
On Tue, Feb 5, 2019 at 8:38 AM Dmitry Stogov wrote:
> > PHP+optimizer (-dopcache.jit_buffer_size=0): 32.29s (100%)
> > PHP+optimizer+JIT (-dopcache.jit_buffer_size=5000): 30.72s (95.1%)
> > PHP+optimizer+minimalJIT (-dopcache.jit_buffer_size=5000
> > -dopcache.jit=1201): 29.95s (92.7%)
>
After figuring out that opcache.jit_buffer_size is specified in bytes
(not in megabytes, as RFC states) I got ~5% speedup running
vimeo/psalm (static analyzer) on its own codebase with default
JIT flags and ~7.3% with minimal JIT (1201).
PHP+optimizer (-dopcache.jit_buffer_size=0): 32.29s (100%)
On Wed, Jan 23, 2019 at 2:32 PM Andrey O Gromov wrote:
> Proposed syntax
> class A($prop) extends B("BlaBla", $prop) {
> }
Would this work with anonymous classes? If so, how would the syntax look like?
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.ph
On Wed, Feb 01, 2017 at 07:45:50AM -0800, Rasmus Lerdorf wrote:
> The reason it is feasible to do this for single-expression closures in this
> short form syntax is that you don't typically need a local scope at all for
> these short closures and the syntax doesn't convey the idea that you would
>
> (Off-topic: there are some place where I can found the internals
talking about that?
> The externals.io not allows search.)
http://markmail.org/search/?q=https%3A%2F%2Fwiki.php.net%2Frfc%2Fenum+#query:https%3A%2F%2Fwiki.php.net%2Frfc%2Fenum%20list%3Anet.php.lists.internals+page:1+state:facets
(i
61 matches
Mail list logo