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

Modern fragment foundation #4393

Merged
merged 30 commits into from Apr 26, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
046cb0f
prefer legacy element when using fragment with same name
m-vo Mar 26, 2022
bb86d9d
always set the template in the RegisterFragmentsPass
m-vo Mar 26, 2022
d481dcd
create a new FragmentTemplate
m-vo Apr 3, 2022
1b44558
allow creating enhanced contexts from plain arrays
m-vo Apr 3, 2022
b3d33e9
rework rendering fragments in the AbstractFragmentController
m-vo Apr 3, 2022
6a1504a
rework default template context for modern fragments
m-vo Apr 3, 2022
7ceab8a
deprecate the old template class, so that its usage in the old getRes…
m-vo Apr 3, 2022
d5aa393
rework back end wildcard
m-vo Apr 3, 2022
52284e8
adjust and add tests
m-vo Apr 3, 2022
bea6eef
fix quoting in the TemplateLoader
m-vo Apr 3, 2022
31f1084
fix a discouraged usage in the TwoFactorController
m-vo Apr 3, 2022
3e3cb31
rename headline attributes
m-vo Apr 4, 2022
d9498d0
fix testReturnsWildCardInBackendScope test
m-vo Apr 4, 2022
d12a7d0
CS
m-vo Apr 4, 2022
6187b54
add clarifying comment
m-vo Apr 5, 2022
31e4082
CS
leofeyer Apr 5, 2022
1fe0bf9
enable deprecation warning
m-vo Apr 6, 2022
9ad7872
rename 'back end' to 'backend'
m-vo Apr 6, 2022
23fecb1
expect self deprecations
m-vo Apr 6, 2022
6ed574a
Revert "expect self deprecations"
m-vo Apr 9, 2022
8e74730
remove triggering deprecation for legacy fragment templates for now
m-vo Apr 9, 2022
d0d73f1
enforce type hints
m-vo Apr 20, 2022
b498e2d
Revert "enforce type hints"
m-vo Apr 22, 2022
9614168
Merge branch '5.x' into modern-fragment-foundation
m-vo Apr 26, 2022
f5bf545
apply changes from #4536 + adjust tests
m-vo Apr 26, 2022
03ff8ad
Merge remote-tracking branch 'origin/5.x' into modern-fragment-founda…
m-vo Apr 26, 2022
facfa23
drop removed methods
m-vo Apr 26, 2022
abd3fc6
CS
leofeyer Apr 26, 2022
a3d3aed
Update core-bundle/tests/Twig/FragmentTemplateTest.php
m-vo Apr 26, 2022
8815efd
Adjust the deprecation message
leofeyer Apr 26, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions core-bundle/src/Resources/contao/library/Contao/System.php
Expand Up @@ -125,9 +125,9 @@ protected function __construct()
*
* @param string $strKey The property name
*
* @return mixed|null The property value or null
* @return mixed The property value or null
*/
public function __get($strKey)
public function __get(string $strKey): mixed
ausi marked this conversation as resolved.
Show resolved Hide resolved
{
if (!isset($this->arrObjects[$strKey]))
{
Expand Down
14 changes: 7 additions & 7 deletions core-bundle/src/Resources/contao/library/Contao/Template.php
Expand Up @@ -132,7 +132,7 @@ public function __construct($strTemplate='', $strContentType='text/html')
* @param string $strKey The property name
* @param mixed $varValue The property value
*/
public function __set($strKey, $varValue)
public function __set(string $strKey, mixed $varValue): void
{
$this->arrData[$strKey] = $varValue;
}
Expand All @@ -144,7 +144,7 @@ public function __set($strKey, $varValue)
*
* @return mixed The property value
*/
public function __get($strKey)
public function __get(string $strKey): mixed
{
if (isset($this->arrData[$strKey]))
{
Expand Down Expand Up @@ -186,7 +186,7 @@ public function __call($strKey, $arrParams)
*
* @return boolean True if the property is set
*/
public function __isset($strKey)
public function __isset(string $strKey): bool
{
return isset($this->arrData[$strKey]);
}
Expand All @@ -196,7 +196,7 @@ public function __isset($strKey)
*
* @param array $arrData The data array
*/
public function setData($arrData)
public function setData(array $arrData): void
{
$this->arrData = $arrData;
}
Expand All @@ -206,7 +206,7 @@ public function setData($arrData)
*
* @return array The data array
*/
public function getData()
public function getData(): array
{
return $this->arrData;
}
Expand All @@ -216,7 +216,7 @@ public function getData()
*
* @param string $strTemplate The template name
*/
public function setName($strTemplate)
public function setName(string $strTemplate): void
{
$this->strTemplate = $strTemplate;
}
Expand All @@ -226,7 +226,7 @@ public function setName($strTemplate)
*
* @return string The template name
*/
public function getName()
public function getName(): string
{
return $this->strTemplate;
}
Expand Down
35 changes: 7 additions & 28 deletions core-bundle/src/Twig/FragmentTemplate.php
Expand Up @@ -41,29 +41,17 @@ public function __construct(private string $templateName, private \Closure $onGe
// Do not call parent constructor
}

/**
* @param string $key
* @param mixed $value
*/
public function __set(/* string */ $key, $value): void
public function __set(string $key, mixed $value): void
{
$this->set($key, $value);
}

/**
* @param string $key
*
* @return mixed
*/
public function __get(/* string */ $key)
public function __get(string $key): mixed
{
return $this->get($key);
}

/**
* @param string $key
*/
public function __isset(/* string */ $key): bool
public function __isset(string $key): bool
{
return $this->has($key);
}
Expand All @@ -73,18 +61,12 @@ public function __call($strKey, $arrParams): never
self::throwOnAccess();
}

/**
* @param mixed $value
*/
public function set(string $key, $value): void
public function set(string $key, mixed $value): void
{
$this->context[$key] = $value;
}

/**
* @return mixed
*/
public function get(string $key)
public function get(string $key): mixed
{
return $this->context[$key] ?? throw new \RuntimeException(sprintf('Key "%s" does not exist.', $key));
}
Expand All @@ -97,7 +79,7 @@ public function has(string $key): bool
/**
* @param array<string, mixed> $data
*/
public function setData(/* array */ $data): void
public function setData(array $data): void
{
$this->context = $data;
}
Expand All @@ -110,10 +92,7 @@ public function getData(): array
return $this->context;
}

/**
* @param string $name
*/
public function setName(/* string */ $name): void
public function setName(string $name): void
{
$this->templateName = $name;
}
Expand Down