Skip to content
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

[Feature]: Allow extening PHP views with different annotations. #171

Closed
1 task done
calvinalkan opened this issue Dec 6, 2022 · 2 comments
Closed
1 task done
Labels
feature New feature or request released

Comments

@calvinalkan
Copy link
Member

Thanks for taking the time to fill out this feature request!"

  • I have searched the issue tracker for similar requests

Which @snicco/* package(s) are relevant/related of the feature request?

templating

Description

Using the simple PHPViewFactory it is currently possible to extend a parent template by using the annotation.

<?php

/*
 *  Extends: layout.php
 */

?>

<h1> Hello World </h1>

It would be nice to expand support to using doc-block annotations instead of only simple multi-line comments.

<?php

/**
* Extends: layout.php
* 
* @var string $message
*/

?>

<h1> echo $message </h1>

The first option works currently, the second one does not.

Proposed solution

We would need to change the regex parsing in the PHPViewFactory::parseParentView method.

Alternatives

No response

@calvinalkan calvinalkan added the feature New feature or request label Dec 6, 2022
calvinalkan added a commit to calvinalkan/snicco that referenced this issue Dec 6, 2022
@calvinalkan
Copy link
Member Author

This was not caused by the regex parsing.

It turns out that this happened due to the "Extends" keyword NOT being present in the first 100 bytes of the file contents.

Previously, we only searched the first 100 bytes. We now have this configurable with a default of 100 bytes.

@snicco-bot
Copy link
Collaborator

🎉 This issue has been resolved in version 1.5.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request released
Projects
None yet
Development

No branches or pull requests

2 participants