Replies

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

Skoop, to random
@Skoop@phpc.social avatar

Phun with PHAR: I try to get PHPStan up and running with extensions, but it seems impossible to make PHPStan PHAR work with extensions.

I don't really understand why extensions don't work with the PHAR. It should not really be an issue, right?

OndrejMirtes,
@OndrejMirtes@phpc.social avatar

@thepanz @acelaya @Skoop There is no reason not to install PHPStan with Composer. It has zero dependencies and won’t conflict with your project.

And it’s the only way for extensions to work. If you install a PHPStan extension, it depends on phpstan/phpstan so it will install PHPStan with Composer anyway.

Just follow the docs https://phpstan.org/user-guide/getting-started#installation, it’s also mentioned there. And Phive isn’t because there’s no need to use it for PHPStan.

zonuexe, to random
@zonuexe@phpc.social avatar

These are slides about PHPStan's benevolent union type, which I talked about at a meetup with @Girgias in Tokyo yesterday. The article is in Japanese, but the slide PDF is in English. https://tadsan.fanbox.cc/posts/7650964

OndrejMirtes,
@OndrejMirtes@phpc.social avatar

@zonuexe The most notable example of benevolent union types are array keys if you type Foo[] instead of array<int, Foo>.

You can turn benevolent union types to be checked same as usual union types with checkBenevolentUnionTypes: true (but it’s going to be brutal)

dantleech, to random
@dantleech@fosstodon.org avatar

Releasing a project after 2 years is always fun. updating dependencies, bumping php version, finding out that the PHAR build no longer works...

But here is Fink 0.11.2:

https://github.com/dantleech/fink

It's a pretty decent PHP link checker, and was one of those fun projects that had a limited scope and as such could be considered "done".

OndrejMirtes,
@OndrejMirtes@phpc.social avatar

@dantleech If I have an anchor # in my link, is it going to download the URL and check if there’s an HTML element with that ID in that document? That would definitely sell it to me!

Thanks.

zonuexe, to random
@zonuexe@phpc.social avatar

PHPerKaigi, one of the largest PHP conferences in Japan, has been held since yesterday. This is my third presentation at the PHP conference this year, and as always, I'm working as a member of the staff.

OndrejMirtes,
@OndrejMirtes@phpc.social avatar

@zonuexe I love waking up in the morning to dozens of Japanese tweets about PHPStan 🤩

ramsey, (edited ) to php
@ramsey@phpc.social avatar

“Ever since 7 came out, and with the improvements in the language since then—particularly around performance—PHP outshines basically every other application stack on the web. So, if you’re worried about performance and you’re worried about developer productivity, you should be choosing PHP.”

— Matthew Weier O’Phinney ( @mwop ), “The 2024 State of PHP Development,” Zend by Perforce ( @zend )

OndrejMirtes,
@OndrejMirtes@phpc.social avatar

@danrot @ramsey @mwop @zend You’re mostly gonna be waiting for the database to return results anyway, and on top of that add waiting for all the compiling as a developer.

OndrejMirtes, to random
@OndrejMirtes@phpc.social avatar

London here I come! ✈️🐘 @phpukconference

OndrejMirtes,
@OndrejMirtes@phpc.social avatar

@MarkBaker @phpukconference This is a prototype 😊 Stay tuned!

OndrejMirtes, to random
@OndrejMirtes@phpc.social avatar

I'm cooking something... and I can't wait to share it with you!

Coming soon to PHPStan Pro: You'll be able to see ignored errors! Including the errors from the baseline.

This should help many projects get rid of huge baselines, or at least manage them comfortably!

video/mp4

OndrejMirtes,
@OndrejMirtes@phpc.social avatar

These options look sensible, right? Would you prefer more control?

Of course I'll keep adjusting this after launch if it turns out people would like to have more granular options.

OndrejMirtes,
@OndrejMirtes@phpc.social avatar

@dantleech I researched it a while ago, I think both are fine?

OndrejMirtes, to random
@OndrejMirtes@phpc.social avatar

I'm catching some flak for requiring array_filter callback to return a strict bool in the latest PHPStan release.

Returning non-bool like int or string is most likely a bug on user's side. Zero means the value gets filtered out, same for falsey strings like '' and '0'.

Doing:
array_filter($a, fn (array $subarrays) => count($subarrays))

is probably on purpose, but what about:
array_filter($a, fn (Entity $e) => $e->getId())

Yeah, that looks more like a bug, in both cases it's returning an int.

OndrejMirtes,
@OndrejMirtes@phpc.social avatar

But people insist that when PHP allows it PHPStan should too. Should I revert to less strict behaviour?

OndrejMirtes, to random
@OndrejMirtes@phpc.social avatar

Are you plagued by reported undefined properties when you "declare" them on an interface using @​property?

On PHP 8.2+ it doesn't fly because dynamic properties are restricted to classes with #[AllowDynamicProperties] attribute or __get() method.

We've come up with new PHPDoc tag @​phpstan-require-extends that can be used above interfaces and traits to require the implementing/using class to extend a certain parent.

If it allows dynamic properties it'll make them exist on the interface too!

OndrejMirtes,
@OndrejMirtes@phpc.social avatar
OndrejMirtes,
@OndrejMirtes@phpc.social avatar

This is going to get released in PHPStan 1.10.56 after the weekend. I’m going to enjoy a bit of skiing ⛷️ over the next two days.

OndrejMirtes,
@OndrejMirtes@phpc.social avatar
OndrejMirtes, to random
@OndrejMirtes@phpc.social avatar

Merry Christmas and happy 2024 everyone!

Here’s a surprise 🎁 PHPStan 2.0 will be released at some point next year and alongside that you’ll be able to get this cute little guy:

image/jpeg

OndrejMirtes,
@OndrejMirtes@phpc.social avatar

@Schrank Only on Christmas ;)

dantleech, to random
@dantleech@fosstodon.org avatar

hm, so PHP has "nested attributes":

 #[Iterations(10, new DefaultSampler(loop: 10))]  

but it depends on the new keyword which invokes the autoloader, which invalidates this apporach for PHPBench .. 😐 that's really frustrating as any other way of composing sampling pipelines with attributes is janky as f.

OndrejMirtes,
@OndrejMirtes@phpc.social avatar

@ocramius @dantleech @ciaran You can interpret “new” in AST however you want in your own code, look at the class constructor statically. You don’t need to autoload it.

OndrejMirtes,
@OndrejMirtes@phpc.social avatar

@ocramius @dantleech @ciaran I spent a lot of time last year refactoring so that PHPStan doesn’t need to go from Expr to runtime value, but instead to go Expr -> its own Type object, precisely to avoid autoloading.

You can do something similar 😊

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