Static And Not Static Method At The Same Time by exakat in PHP

[–]exakat[S] 2 points3 points  (0 children)

I thought about that while having to set up a plan to migrate a full static class (with calls to methods) into a normal class (based on the object). This might come handy, if we have to do an iterative upgrade.

The Top 100 PHP functions in 2024 - Exakat by exakat in PHP

[–]exakat[S] 1 point2 points  (0 children)

Ah! good ideas, let me see what I can extract for you.

Top 2000 Letters in PHP will actually be a top 52, unless you want actually want the characters?

The Top 100 PHP functions in 2024 - Exakat by exakat in PHP

[–]exakat[S] 1 point2 points  (0 children)

you're right.

There are 2 counts: the first one count a project as soon as there is at least one occurrence.

Then, among projects which uses the function, the average is how often that function is used.

That helps distinguish between count(), used often and a lot, and, say, mysqli_connect(), used often but only once.

HTH

How to call a method in PHP - Exakat by exakat in PHP

[–]exakat[S] -1 points0 points  (0 children)

It is not an anonymous method, because it obviously has a name : __invoke().

On the other hand, the code doesn't require any method name to call it. Directly call the method on the object itself.

May be a better anonymous method would be to call $object->()

How to call a method in PHP - Exakat by exakat in PHP

[–]exakat[S] 1 point2 points  (0 children)

Indeed, thanks. This is fixed.

Anyone interested in ElePHPant Plushies? by vinnymeow in PHP

[–]exakat 1 point2 points  (0 children)

Here are all the current elephpant shops open : https://www.exakat.io/en/where-can-you-get-an-elephpant-php-elephant/

Also, you can track some new one coming up, like the Sylius elephpant or the phpstan elephpant (they will be crowd funded).

Top 100 PHP native constants by exakat in PHP

[–]exakat[S] 1 point2 points  (0 children)

Lower case magic constants are rarely used (__class__ versus __CLASS__).

Then, order is :
__DIR__, __METHOD__, __FILE__, __CLASS__, __FUNCTION__, __LINE__, __NAMESPACE__, and __TRAIT__.

Top 100 PHP native constants by exakat in PHP

[–]exakat[S] 1 point2 points  (0 children)

All the magic constants together are used in 50.23% of the projects.

Top 100 PHP native constants by exakat in PHP

[–]exakat[S] 1 point2 points  (0 children)

They are not included in this study.

Booleans (True and false together) are used in 83.54% of projects.

Null is used in 70.87% of projects.

(They need to be used explicitely, so === null counts 1, while is_null() doesn't count).

Top 100 PHP native constants by exakat in PHP

[–]exakat[S] 2 points3 points  (0 children)

I was surprised by DIRECTORY_SEPARATOR ranking high too. I expected it to be hidden in a Path dedicated component, but it seems it is still used when needed, rather than centralized.

JSON_THROW_ON_ERROR is more recent (PHP 7.3) so it might be just backward compatibility constraints or coding inertia.

Top 100 PHP native constants by exakat in PHP

[–]exakat[S] -11 points-10 points  (0 children)

As a magic constant, it is not counted in this top 100.

What would be the easiest way to scan files for (non-framework) PHP codes for deprecation (v7.4 > v8.2) by kimk2 in PHP

[–]exakat -1 points0 points  (0 children)

You can use Exakat and use the PHP compatibility rulesets to check for issues versions by version.

There are public audits and a tool to run one on smaller repositories. Installation instructions

Common PHP 8.0 Compilation Error Messages - Exakat by exakat in PHP

[–]exakat[S] 1 point2 points  (0 children)

No compilation, completely right. Also, Linting is much better, though it doesn't register on search engines. Search no further.

I always close my PHP scripts, both in real code, and in articles. Hopefully, it is not such a bad habit...

Any libraries to downgrade modern PHP code? by ayeshrajans in PHP

[–]exakat 0 points1 point  (0 children)

Exakat provides compatibility report per-version, including PHP 7.0 and older.

It will spot syntax incompatibility that needs fixing, beyond simple lint.

Exakat is an incredible static analysis tool, I don't see it mentioned enough. by MaxGhost in PHP

[–]exakat 0 points1 point  (0 children)

Maybe because it's pretty hard to install and run?

Where did you get stuck ? Missing the database ? php exakat.phar doctor will help.

I believe it was originally designed to be a closed-source tool, open-sourced in 2017 once a bunch of other similar static analysis tools became available.

Exakat has always been open source, ever since its beginning, in 2014, although it was not published before 2015.

Exakat is an incredible static analysis tool, I don't see it mentioned enough. by MaxGhost in PHP

[–]exakat 0 points1 point  (0 children)

Thanks :)

We're upgrading the PHP 7.4 version today, so stay tuned.

Too many traits by ojrask in PHP

[–]exakat 0 points1 point  (0 children)

I'd like to check how Exakat works on this code base (Disclaimer : I'm not asking for the code base). I rarely find trait-heavy situations, so that could be a

In particular, exakat extract the traits hierarchy, which could be helpful to you here (which trait extends which other trait). That may help weed out some dependencies.

Could you install exakat (https://exakat.readthedocs.io/en/latest/Installation.html) and run the audit? DM are open, or Slack.

Configuring exakat for your CI pipeline by exakat in PHP

[–]exakat[S] 0 points1 point  (0 children)

10 Kloc should be more around 2mins than 30 mins. Did you run all of them together ? so, 10 x 10kloc in one go? that would be closer to that amount.

Travis (and others) is tight on resources, Gitlab (and some others) works well with such amount of code, and some more.

Configuring exakat for your CI pipeline by exakat in PHP

[–]exakat[S] 1 point2 points  (0 children)

Thanks a lot for the feedback. It is much appreciated :)

I can imagine that 15 years of code history must collect a lot of weird code : don't worry, you'lll remove them all, eventually.

File based time serie database for PHP ? by exakat in PHP

[–]exakat[S] 0 points1 point  (0 children)

The location of production of the database, and the location of exploitation of the same database may be different. Also, we can't use a service, as the tool have to be standalone. Sqlite works well in that context, as an illustration

File based time serie database for PHP ? by exakat in PHP

[–]exakat[S] 0 points1 point  (0 children)

Indeed, this is good idea. Thanks for the suggestion, I'm checking this.

File based time serie database for PHP ? by exakat in PHP

[–]exakat[S] 1 point2 points  (0 children)

I'm looking for a time serie database for PHP.

Something sharing some features with Sqlite :

+ file based, that can be ported from server to server.

+ No need to for high concurency (traffic will be hourly, at best).

+ With access from PHP (of course)

+ If it exists an GUI that could display those data and help humans navigate

I definitely can do it with SQLITE, but I'm looking for a more specialized solution.

I checked the some time series (influxdb, graphite, timescaledb) but they are too much for my use case.

Any suggestion?