Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
typed_data
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
typed_data
Commits
725f280f
Commit
725f280f
authored
Sep 27, 2024
by
Tim Rohaly
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3477442
by tr: Parameter typing in DataFetcher service
parent
0ab84160
No related branches found
No related tags found
1 merge request
!34
Issue #3477442 by tr: Parameter typing in DataFetcher service
Pipeline
#294878
passed with warnings
Sep 27, 2024
Stage: build
Stage: validate
Stage: test
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/DataFetcher.php
+6
-4
6 additions, 4 deletions
src/DataFetcher.php
src/DataFetcherInterface.php
+4
-4
4 additions, 4 deletions
src/DataFetcherInterface.php
src/DataFetcherTrait.php
+2
-0
2 additions, 0 deletions
src/DataFetcherTrait.php
with
12 additions
and
8 deletions
src/DataFetcher.php
+
6
−
4
View file @
725f280f
<?php
declare
(
strict_types
=
1
);
namespace
Drupal\typed_data
;
use
Drupal\Core\Cache\CacheableDependencyInterface
;
...
...
@@ -27,7 +29,7 @@ class DataFetcher implements DataFetcherInterface {
/**
* {@inheritdoc}
*/
public
function
fetchDataByPropertyPath
(
TypedDataInterface
$typed_data
,
string
$property_path
,
BubbleableMetadata
$bubbleable_metadata
=
NULL
,
string
$langcode
=
NULL
):
TypedDataInterface
{
public
function
fetchDataByPropertyPath
(
TypedDataInterface
$typed_data
,
string
$property_path
,
?
BubbleableMetadata
$bubbleable_metadata
=
NULL
,
?
string
$langcode
=
NULL
):
TypedDataInterface
{
$sub_paths
=
explode
(
'.'
,
$property_path
);
return
$this
->
fetchDataBySubPaths
(
$typed_data
,
$sub_paths
,
$bubbleable_metadata
,
$langcode
);
}
...
...
@@ -35,7 +37,7 @@ class DataFetcher implements DataFetcherInterface {
/**
* {@inheritdoc}
*/
public
function
fetchDataBySubPaths
(
TypedDataInterface
$typed_data
,
array
$sub_paths
,
BubbleableMetadata
$bubbleable_metadata
=
NULL
,
string
$langcode
=
NULL
):
TypedDataInterface
{
public
function
fetchDataBySubPaths
(
TypedDataInterface
$typed_data
,
array
$sub_paths
,
?
BubbleableMetadata
$bubbleable_metadata
=
NULL
,
?
string
$langcode
=
NULL
):
TypedDataInterface
{
$current_selector
=
[];
$bubbleable_metadata
=
$bubbleable_metadata
?:
new
BubbleableMetadata
();
...
...
@@ -104,7 +106,7 @@ class DataFetcher implements DataFetcherInterface {
/**
* {@inheritdoc}
*/
public
function
fetchDefinitionByPropertyPath
(
DataDefinitionInterface
$data_definition
,
string
$property_path
,
string
$langcode
=
NULL
):
DataDefinitionInterface
{
public
function
fetchDefinitionByPropertyPath
(
DataDefinitionInterface
$data_definition
,
string
$property_path
,
?
string
$langcode
=
NULL
):
DataDefinitionInterface
{
$sub_paths
=
explode
(
'.'
,
$property_path
);
return
$this
->
fetchDefinitionBySubPaths
(
$data_definition
,
$sub_paths
,
$langcode
);
}
...
...
@@ -112,7 +114,7 @@ class DataFetcher implements DataFetcherInterface {
/**
* {@inheritdoc}
*/
public
function
fetchDefinitionBySubPaths
(
DataDefinitionInterface
$data_definition
,
array
$sub_paths
,
string
$langcode
=
NULL
):
DataDefinitionInterface
{
public
function
fetchDefinitionBySubPaths
(
DataDefinitionInterface
$data_definition
,
array
$sub_paths
,
?
string
$langcode
=
NULL
):
DataDefinitionInterface
{
$current_selector
=
[];
foreach
(
$sub_paths
as
$name
)
{
...
...
...
...
This diff is collapsed.
Click to expand it.
src/DataFetcherInterface.php
+
4
−
4
View file @
725f280f
...
...
@@ -34,7 +34,7 @@ interface DataFetcherInterface {
* Thrown if the given path is not valid for the given data; e.g., a not
* existing property is referenced.
*/
public
function
fetchDataByPropertyPath
(
TypedDataInterface
$typed_data
,
string
$property_path
,
BubbleableMetadata
$bubbleable_metadata
=
NULL
,
string
$langcode
=
NULL
):
TypedDataInterface
;
public
function
fetchDataByPropertyPath
(
TypedDataInterface
$typed_data
,
string
$property_path
,
?
BubbleableMetadata
$bubbleable_metadata
=
NULL
,
?
string
$langcode
=
NULL
):
TypedDataInterface
;
/**
* Fetches data based upon the given sub-paths.
...
...
@@ -59,7 +59,7 @@ interface DataFetcherInterface {
* Thrown if the given path is not valid for the given data; e.g., a non-
* existent property is referenced.
*/
public
function
fetchDataBySubPaths
(
TypedDataInterface
$typed_data
,
array
$sub_paths
,
BubbleableMetadata
$bubbleable_metadata
=
NULL
,
string
$langcode
=
NULL
):
TypedDataInterface
;
public
function
fetchDataBySubPaths
(
TypedDataInterface
$typed_data
,
array
$sub_paths
,
?
BubbleableMetadata
$bubbleable_metadata
=
NULL
,
?
string
$langcode
=
NULL
):
TypedDataInterface
;
/**
* Fetches a data definition based upon the given property path.
...
...
@@ -79,7 +79,7 @@ interface DataFetcherInterface {
* Thrown if the given path is not valid for the given data; e.g., a not
* existing property is referenced.
*/
public
function
fetchDefinitionByPropertyPath
(
DataDefinitionInterface
$data_definition
,
string
$property_path
,
string
$langcode
=
NULL
):
DataDefinitionInterface
;
public
function
fetchDefinitionByPropertyPath
(
DataDefinitionInterface
$data_definition
,
string
$property_path
,
?
string
$langcode
=
NULL
):
DataDefinitionInterface
;
/**
* Fetches a data definition based upon the given sub-paths.
...
...
@@ -99,7 +99,7 @@ interface DataFetcherInterface {
* Thrown if the given path is not valid for the given data; e.g., a not
* existing property is referenced.
*/
public
function
fetchDefinitionBySubPaths
(
DataDefinitionInterface
$data_definition
,
array
$sub_paths
,
string
$langcode
=
NULL
):
DataDefinitionInterface
;
public
function
fetchDefinitionBySubPaths
(
DataDefinitionInterface
$data_definition
,
array
$sub_paths
,
?
string
$langcode
=
NULL
):
DataDefinitionInterface
;
/**
* Provides autocomplete suggestions for an incomplete property path.
...
...
...
...
This diff is collapsed.
Click to expand it.
src/DataFetcherTrait.php
+
2
−
0
View file @
725f280f
<?php
declare
(
strict_types
=
1
);
namespace
Drupal\typed_data
;
/**
...
...
...
...
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
sign in
to comment