Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
ChangelogFileCollection example
protected
function
getTargetNextMajorUpgradeFile
(
string
$version
, bool
$realPath
= true
)
: string
{
return
(
$realPath
?
$this
->
getUpgradeDir
(
)
. '/' : ''
)
. \
sprintf
(
'UPGRADE-%s.md',
$this
->
getNextMajorVersion
(
$version
)
)
;
}
/** * Prepare the list of changelog files which need to process */
protected
function
prepareChangelogFiles
(
?string
$version
= null, bool
$includeFeatureFlags
= false
)
: ChangelogFileCollection
{
$entries
=
new
ChangelogFileCollection
(
)
;
$finder
=
new
Finder
(
)
;
$finder
->
in
(
$version
?
$this
->
getTargetReleaseDir
(
$version
)
:
$this
->
getUnreleasedDir
(
)
)
->
files
(
)
->
sortByName
(
)
->
depth
(
'0'
)
->
name
(
'*.md'
)
;
if
(
$finder
->
hasResults
(
)
)
{
foreach
(
$finder
as
$file
)
{
$definition
=
$this
->parser->
parse
(
$file
->
getContents
(
)
)
;
$issues
=
$this
->validator->
validate
(
$definition
)
;
if
(
$issues
->
count
(
)
)
{
$messages
= \
array_map
(
static
fn
(
ConstraintViolationInterface
$violation
)
=>
$violation
->
getMessage
(
)
, \
iterator_to_array
(
$issues
)
)
;