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

API Update API to suit its status as its own module #1

Merged
merged 2 commits into from
Nov 5, 2024

Conversation

GuySartorelli
Copy link
Member

@GuySartorelli GuySartorelli commented Nov 1, 2024

This is a new repository.
The commit history on the 1 branch is all of the commits from silverstripe/silverstripe-framework relevant to the files we're migrating to this new module.

This PR is for updating namespaces, class names, etc as appropriate, and for adding all the boilerplace (e.g. composer.json) required to turn this into a functioning Silverstripe CMS module.

CI

Since this is a new repository, CI won't run here. There is a CI run in the creative commoners fork, but that doesn't install because of a clash between this and the API in framework which hasn't been removed yet.

The CI won't even run in a dedicated CI run, because the matrix doesn't want to generate until this module is added to supported modules.

The kitchen sink run does include the unit tests for this module, which are in the recipe-core test suite in that run.
I recommend merging if that goes green. I'll still need to do some more PRs for this repo (e.g. run module standardiser) which will trigger subsequent CI for this repo itself, and we should be able to catch e.g. linting issues in those PRs.

Issue

src/Exception/MissingTemplateException.php Outdated Show resolved Hide resolved
class SSViewer_BasicIteratorSupport implements TemplateIteratorProvider
class BasicIteratorSupport implements TemplateIteratorProvider
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing SSViewer_ prefix from any classes in this repo. They don't have anything to do with SSViewer anymore.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm keeping the SSTemplate prefix on classes in this repo which already had it because:

  1. It makes it instantly clear what kind of templates it's related to when used in project code
  2. It keeps things nicely tied together
  3. It removes the need to rename them, which (even if only slightly) means we're not introducing more upgrade pain.

.editorconfig Outdated
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copied from module standardiser, minus the bit about admin which isn't relevant here. Wanted it in here while I'm working to reduce cleanup required later.

phpcs.xml.dist Outdated
Comment on lines 16 to 20
<!--
<exclude name="PSR1.Methods.CamelCapsMethodName" />
<exclude name="PSR1.Files.SideEffects.FoundWithSymbols" />
<exclude name="PSR2.Classes.PropertyDeclaration" />
<exclude name="PSR2.ControlStructures.SwitchDeclaration" /> <!-- causes php notice while linting -->
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will clean this up before marking ready-to-merge.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should clean it up then as this PR's in review?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes! Sorry. I thought I'd forget that's why I added that comment lol.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cleaned up, and resolved linting failures from a local run.

Comment on lines -29 to +30
if (defined('THIRDPARTY_PATH')) {
require_once(THIRDPARTY_PATH . '/php-peg/Parser.php');
} else {
$base = dirname(__FILE__);
require_once($base.'/../thirdparty/php-peg/Parser.php');
}
// Make sure to include the base parser code
$base = dirname(__FILE__);
require_once($base.'/../thirdparty/php-peg/Parser.php');
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That const was pointing to the thirdparty directory in framework, which isn't going to exist anymore anyway.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which this interface seems fairly generic on the surface, it's really only relevant for the parser used for parsing ss templates.

I thought about removing this abstraction but that's not really worth the effort right now. The benefit of doing so is basically nil and it introduces some non-zero chance of regressions.

@GuySartorelli GuySartorelli marked this pull request as ready for review November 5, 2024 00:47
phpcs.xml.dist Outdated
Comment on lines 16 to 20
<!--
<exclude name="PSR1.Methods.CamelCapsMethodName" />
<exclude name="PSR1.Files.SideEffects.FoundWithSymbols" />
<exclude name="PSR2.Classes.PropertyDeclaration" />
<exclude name="PSR2.ControlStructures.SwitchDeclaration" /> <!-- causes php notice while linting -->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should clean it up then as this PR's in review?

src/Exception/MissingTemplateException.php Outdated Show resolved Hide resolved
@emteknetnz emteknetnz merged commit 5fc9870 into silverstripe:1 Nov 5, 2024
@emteknetnz emteknetnz deleted the pulls/1/new-repo branch November 5, 2024 02:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants