-
-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implements syndication feeds (new feature) #2
Conversation
hey @llaville thank you very much for your work! I really like it! there are a few things I'd like to discuss with you before accepting/merging it.
so instead of: private string $name;
public function __construct(string $name) {
$this->name = $name;
}
public function getName(): string {
return $this->name;
} we'd have: public readonly string $name;
public function __construct(string $name) {
$this->name = $name;
} this guarantees property immutability and reduces code complexity.
// before
echo 'Found ',
count($clist),
' categories on channel ',
$clist->getChannel(),
PHP_EOL; // after
echo 'Found ',
count($clist),
' categories on channel ',
$clist->getChannel(),
PHP_EOL; |
@flavioheleno Agree with your comments. I'll fix it now ! PS: for first point the compatibility with PHP 7.4 won't be kept because https://php.watch/versions/8.0/constructor-property-promotion is available since PHP 8.0 Are you agree to raise PHP min requirement to 8.0 ? Sorry : your first point is not about constructor promotion property but readonly properties that require at least PHP 8.1 BTW, I'm agree to apply changes if you want ? including composer raising constraint |
hey, we should def push to at least |
@flavioheleno ready for review |
@flavioheleno any news about this PR review ? |
Hey @llaville, I've left a comment on it, just waiting for your reply so we can move on with it :) |
@flavioheleno : Could you please point to me your comment, I didn't see it |
does this link work? #2 (comment) |
Not for me ! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was expecting something like this instead:
<?php
declare(strict_types = 1);
namespace Pickling\Resource\Feed;
use SimpleXMLElement;
final class Category extends News {
public function __construct(SimpleXMLElement $xml, public readonly string $categoryName) {
parent::__construct($xml);
}
}
Then you'd simply use $categoryInst->categoryName
instead of $categoryInst->getCategoryName()
:)
It could also be even more simple and instead of $categoryName
be simply $name
, as it's a property of Category
class.
Does it make sense or am I missing something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want, you could envisage to use this syntax, but in this case, you 'll have to change all other source code API in same case. E.g:
- https://github.com/pecm/pickling/blob/main/src/Resource/Package/Info.php
- https://github.com/pecm/pickling/blob/main/src/Resource/Package/Release/Info.php
and so on ... I've not listed all cases here !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are right, I'll take the PR as-is and then work on the API later on :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@flavioheleno I suggest to publish at least one release before to do this. That will avoid users (like me) that used your package in state to have BC breaks, when your API will change.
Sorry, although it saved my comment, without action it did not actually send the comment.. 🤦 |
Hello @flavioheleno,
I've discovered your package recently, and I like it !
I would like to propose with this PR to add syndication feeds reading that is missing from features list.
As this project was not updated since a long time, there are probably some parts (CI) that won't work. Will seen it soon ;-)
At least all unit tests PASSED
vendor/bin/phpunit tests/ --bootstrap vendor/autoload.php
Hope you'll like my contribution ?