Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
scaffolder
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
grifart libs
scaffolder
Commits
fe29b6d3
Commit
fe29b6d3
authored
2 years ago
by
Daniel Kurowski
Browse files
Options
Downloads
Patches
Plain Diff
kept -> preserved
parent
11aa4cd9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!57
Resolve "KeepMethod → Preserve"
Pipeline
#41054
passed
2 years ago
Stage: build
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/Capabilities/PreservedMethod.php
+6
-6
6 additions, 6 deletions
src/Capabilities/PreservedMethod.php
tests/Capabilities/PreservedMethod/PreservedMethodTest.expected.phps
+1
-1
1 addition, 1 deletion
...ilities/PreservedMethod/PreservedMethodTest.expected.phps
with
7 additions
and
7 deletions
src/Capabilities/PreservedMethod.php
+
6
−
6
View file @
fe29b6d3
...
...
@@ -25,11 +25,11 @@ final class PreservedMethod implements Capability
// method already exists, just transfer it to new class
if
(
$current
!==
null
&&
$current
->
getClassType
()
->
hasMethod
(
$this
->
methodName
))
{
$
kept
Method
=
$current
->
getClassType
()
->
getMethod
(
$this
->
methodName
);
$
preserved
Method
=
$current
->
getClassType
()
->
getMethod
(
$this
->
methodName
);
$classToBeGenerated
->
setMethods
([
...
\array_values
(
$classToBeGenerated
->
getMethods
()),
$
kept
Method
,
$
preserved
Method
,
]);
return
;
}
...
...
@@ -42,12 +42,12 @@ final class PreservedMethod implements Capability
return
$method
;
};
$
methodToBeKept
=
$classToBeGenerated
->
hasMethod
(
$this
->
methodName
)
$
preservedMethod
=
$classToBeGenerated
->
hasMethod
(
$this
->
methodName
)
?
$classToBeGenerated
->
getMethod
(
$this
->
methodName
)
:
$addMethodStub
(
$classToBeGenerated
);
$
methodToBeKept
->
setComment
(
'This method is
kept
while scaffolding.'
.
"
\n
"
.
$
methodToBeKept
->
getComment
()
$
preservedMethod
->
setComment
(
'This method is
preserved
while scaffolding.'
.
"
\n
"
.
$
preservedMethod
->
getComment
()
);
}
}
This diff is collapsed.
Click to expand it.
tests/Capabilities/PreservedMethod/PreservedMethodTest.expected.phps
+
1
−
1
View file @
fe29b6d3
...
...
@@ -14,7 +14,7 @@ use Grifart\ClassScaffolder\Definition\ClassDefinitionBuilder;
final
class
ExistentClass
{
/**
* This method is
kept
while scaffolding.
* This method is
preserved
while scaffolding.
*/
public
function
newMethod
():
void
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment