klabauterjan

@klabauterjan@phpc.social

This profile is from a federated server and may be incomplete. Browse more on the original instance.

SenseException, to php German
@SenseException@phpc.social avatar

talks 10 years ago: "Use value objects instead of arrays."

PHP talks nowadays: "Use value objects instead of arrays."

klabauterjan,

@SenseException Everyone around me: still uses arrays instead of value objects 🥲

klabauterjan, to php

Is there a way to install PHIVE packages without confirming or specifying the signatures?

I want to run "phive install" in CI and do not know which packages will be installed. Thus I cannot use "--trust-gpg-keys".

klabauterjan,

@heiglandreas unfortunately "--force-accept-unsigned" still asks for confirmation of the signature. I think it only works when trying to download unsigned PHARs.

I do not know the packages to install CI, as I am building a reusable GitLab CI component. The component will do a "phive install", check if PHPStan gets installed and then use it to statically analyze the code

Using "phive install phpstan --trust-gpg-keys" does not work as this ignores the version constraint in the "phive.xml"

klabauterjan,

@heiglandreas I like that idea, I'll give this a try!

sebastian, to opensource
@sebastian@phpc.social avatar

There goes my Sunday:

"Excluding merges, 1 author has pushed 36 commits to main and 36 commits to all branches. On main, 97 files have changed and there have been 99,239 additions and 56,143 deletions."

https://github.com/sebastianbergmann/foal

klabauterjan,

@sebastian, this looks really interesting, thank you for your work! I'd like to use your tool to check some "god classes" for never used or unreachable code.
Unfortunately I can't even get the example to work. I'm running PHP 8.3 with Zend OPCache and vld installed via PECL.
When executing the tool in diff mode, there is no output at all. Executing the test suite fails because of the missing diff.
My guess is that I'm missing some PHP INI settings. Could you point me in the right direction?

klabauterjan,

@sebastian, dumping the PHP configuration with the command generated via "afterOptimization", confirms that all PHP settings are set. But using the same command does not optimize the OP codes.
Maybe I'm running a wrong version of Zend OPCache or vld?
OPCache was bundled with PHP 8.3 from shivammathur on MacOS. To install vld I used "pecl install vld-beta" which installed version 0.18.
I don't want to bother you with my system config, I'm just curious if I'm doing something obvious wrong

Crell, to php
@Crell@phpc.social avatar

Teacher: Replace any validation a function does on its inputs with more robust types instead. Eliminate all conditionals that could be types instead.

Student: But doesn't that just push the validation problem up a level?

Teacher: Exactly. Now do it again. And keep doing it until you run out of upper levels.

Student: But now I'm just parsing input into an object as soon as I get it. There's nothing for other code to even do.

And the Student was enlightened.

#PHP #Types #Programming

klabauterjan, (edited )

@Crell, is this the talk you're referring to?
https://youtu.be/2JB1_e5wZmU

kboyd, to random
@kboyd@phpc.social avatar

TIL: For an ancient branch/PR, rebase is way better than merge for getting things up to date.

klabauterjan,

@kboyd but this will rewrite the public history of the feature branch, which is discouraged - or am I missing something?

Crell, to php
@Crell@phpc.social avatar

This is fun. Upgrading a library to 10, it works fine but Xdebug isn't detected (for code coverage). php -i confirms xdebug is set to "debug,coverage", but I get a message that it must be set, or an env var provided. Providing the env var works fine, but the xdebug setting is not.

What's going on?

klabauterjan,

@Crell maybe the library is doing some magic (like composer) to restart the PHP process without xdebug?

outofcontrol, to php
@outofcontrol@phpc.social avatar

AFAIK the following 8.2 functions benefit from being prefixed with \

array_key_exists
array_slice
boolval
call_user_func
call_user_func_array
chr
count
defined
doubleval
floatval
func_get_args
func_num_args
get_called_class
get_class
gettype
in_array
intval
is_array
is_bool
is_double
is_float
is_int
is_integer
is_long
is_null
is_object
is_resource
is_scalar
is_string
ord
sizeof
strlen
strval

Pulled from https://github.com/php/php-src/blob/PHP-8.2.11/Zend/zend_compile.c#L4397

Please chime in if I'm wrong.

klabauterjan,

@outofcontrol, does "use function is_array;" at the top of a file have the same performance effect as a backslash in front of every function call?

  • All
  • Subscribed
  • Moderated
  • Favorites
  • megavids
  • thenastyranch
  • rosin
  • GTA5RPClips
  • osvaldo12
  • love
  • Youngstown
  • slotface
  • khanakhh
  • everett
  • kavyap
  • mdbf
  • DreamBathrooms
  • ngwrru68w68
  • provamag3
  • magazineikmin
  • InstantRegret
  • normalnudes
  • tacticalgear
  • cubers
  • ethstaker
  • modclub
  • cisconetworking
  • Durango
  • anitta
  • Leos
  • tester
  • JUstTest
  • All magazines