pietercolpaert / hardf

Low level PHP library for RDF1.1 based on N3.js
https://packagist.org/packages/pietercolpaert/hardf
MIT License
36 stars 7 forks source link

Rework code (less JS, more PHP like), added tooling for development (PHPStan, PHP-CS-Fixer) #29

Closed k00ni closed 4 years ago

k00ni commented 4 years ago

I wanted to see if I can fix failing tests in PHP 7.4 (#28), ended up reworked many parts to get cleaner code and a better view on what is happening.

tl;dr: hardf code is way to much JS-like and not using proper PHP-concepts. For instance, hot swapping closures during parsing. That may feel handy, but it makes error-tracing so much harder (also static analysis). Further tooling added to make development more smooth.

@pietercolpaert: its a total overhaul of your code, hope its not too much at once.

Problems / issues

Further changes:

What do you think?

k00ni commented 4 years ago

Thank you for your trust. First I was hesitant because changed a lot of your initial code, but thinking about the long run changed my mind. My approach was to keep your concepts and style if possible, but implement it using more-or-less state of the art PHP. The whole PHP ecosystem changes towards more type-oriented programming, for instance. Also having a known coding style, like PSR-2, helps foreign developers to understand your code.

k00ni commented 4 years ago

We can leave this PR open, in case you wanna make additional performance checks for instance.

pietercolpaert commented 4 years ago

I think it’s better to move faster and release the higher quality PHP code, so that future pull requests can be based on that. What do you think?