-
Notifications
You must be signed in to change notification settings - Fork 32
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
Index reserved keywords for better user experience #19
base: master
Are you sure you want to change the base?
Conversation
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.
Is this still relevant?
gen-phpweb-sqlite-db.php
Outdated
|
||
if ($f === 'reserved.keywords.php') { | ||
// Yes, this is fragile. | ||
$handle = fopen($file, 'r'); |
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.
There is no error handling 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.
What sort of handling would you like to see here? Would it be enough to move this into the above if
statement?
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.
At least not try to run any code if you can't open the file. Right now ,that would error on line 173 with the fgets
.
Possibly. What's the plan for keeping the list introduced in php/web-php#804 up-to-date? This change adds functionality with very little burden of maintenance as far as I can tell. |
gen-phpweb-sqlite-db.php
Outdated
|
||
if ($f === 'reserved.keywords.php') { | ||
// Yes, this is fragile. | ||
$handle = fopen($file, 'r'); |
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.
At least not try to run any code if you can't open the file. Right now ,that would error on line 173 with the fgets
.
URLs like https://www.php.net/strpos or https://php.net/implode render the expected documentation page.
Some URLs are specifically configured to redirect to the expected documentation page, like https://php.net/_GET or https://www.php.net/foreach.
However URLs for language features such as
yield
(https://php.net/yield) andendif
(https://php.net/endif) redirect to a function search page which claims that the feature does not exist.This pull request adds some logic to read the list of reserved keywords from the relevant page of documentation and updates the index to include these results. This means that all the URLs in this description should work as expected.
Note that if php/web-php#804 gets merged before this, we can probably re-assess if this is necessary. There are some comments in the code about refactoring this to read from phd directly or to have phd generate a search database itself.