diff --git a/src/Symfony/Bridge/Doctrine/Form/DataTransformer/CollectionToArrayTransformer.php b/src/Symfony/Bridge/Doctrine/Form/DataTransformer/CollectionToArrayTransformer.php index 3202dae97f5c2..fdc6037be7dab 100644 --- a/src/Symfony/Bridge/Doctrine/Form/DataTransformer/CollectionToArrayTransformer.php +++ b/src/Symfony/Bridge/Doctrine/Form/DataTransformer/CollectionToArrayTransformer.php @@ -18,13 +18,15 @@ /** * @author Bernhard Schussek + * + * @implements DataTransformerInterface */ class CollectionToArrayTransformer implements DataTransformerInterface { /** * Transforms a collection into an array. * - * @return mixed An array of entities + * @return mixed[] An array of entities * * @throws TransformationFailedException */ diff --git a/src/Symfony/Bundle/FrameworkBundle/Controller/AbstractController.php b/src/Symfony/Bundle/FrameworkBundle/Controller/AbstractController.php index 5acdfbe2dd932..08c97b66235a0 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Controller/AbstractController.php +++ b/src/Symfony/Bundle/FrameworkBundle/Controller/AbstractController.php @@ -20,6 +20,7 @@ use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormFactoryInterface; use Symfony\Component\Form\FormInterface; +use Symfony\Component\Form\FormTypeInterface; use Symfony\Component\HttpFoundation\BinaryFileResponse; use Symfony\Component\HttpFoundation\Exception\SessionNotFoundException; use Symfony\Component\HttpFoundation\JsonResponse; @@ -338,6 +339,13 @@ protected function createAccessDeniedException(string $message = 'Access Denied. /** * Creates and returns a Form instance from the type of the form. + * + * @template TData + * @template TFormType of FormTypeInterface + * + * @param class-string $type + * + * @return FormInterface */ protected function createForm(string $type, $data = null, array $options = []): FormInterface { diff --git a/src/Symfony/Component/Config/Resource/GlobResource.php b/src/Symfony/Component/Config/Resource/GlobResource.php index c77e837c245f9..63c8214e1488c 100644 --- a/src/Symfony/Component/Config/Resource/GlobResource.php +++ b/src/Symfony/Component/Config/Resource/GlobResource.php @@ -21,6 +21,8 @@ * * @author Nicolas Grekas * + * @implements \IteratorAggregate + * * @final */ class GlobResource implements \IteratorAggregate, SelfCheckingResourceInterface diff --git a/src/Symfony/Component/Console/Helper/HelperSet.php b/src/Symfony/Component/Console/Helper/HelperSet.php index 5c08a7606d289..8f4eab29aeb10 100644 --- a/src/Symfony/Component/Console/Helper/HelperSet.php +++ b/src/Symfony/Component/Console/Helper/HelperSet.php @@ -18,6 +18,8 @@ * HelperSet represents a set of helpers to be used with a command. * * @author Fabien Potencier + * + * @implements \IteratorAggregate */ class HelperSet implements \IteratorAggregate { @@ -89,7 +91,7 @@ public function getCommand() } /** - * @return Helper[] + * @return \Traversable */ public function getIterator() { diff --git a/src/Symfony/Component/DomCrawler/Crawler.php b/src/Symfony/Component/DomCrawler/Crawler.php index 37b5fe37f0fc7..2a51993297c45 100644 --- a/src/Symfony/Component/DomCrawler/Crawler.php +++ b/src/Symfony/Component/DomCrawler/Crawler.php @@ -18,6 +18,8 @@ * Crawler eases navigation of a list of \DOMNode objects. * * @author Fabien Potencier + * + * @implements \IteratorAggregate<\DOMNode> */ class Crawler implements \Countable, \IteratorAggregate { @@ -1109,7 +1111,7 @@ public function count() } /** - * @return \ArrayIterator|\DOMNode[] + * @return \Traversable<\DOMNode> */ public function getIterator() { diff --git a/src/Symfony/Component/EventDispatcher/GenericEvent.php b/src/Symfony/Component/EventDispatcher/GenericEvent.php index 34b95cedee817..1d1bd3c522473 100644 --- a/src/Symfony/Component/EventDispatcher/GenericEvent.php +++ b/src/Symfony/Component/EventDispatcher/GenericEvent.php @@ -19,6 +19,8 @@ * Encapsulates events thus decoupling the observer from the subject they encapsulate. * * @author Drak + * + * @implements \IteratorAggregate */ class GenericEvent extends Event implements \ArrayAccess, \IteratorAggregate { @@ -161,7 +163,7 @@ public function offsetExists($key) /** * IteratorAggregate for iterating over the object like an array. * - * @return \ArrayIterator + * @return \Traversable */ public function getIterator() { diff --git a/src/Symfony/Component/Finder/Finder.php b/src/Symfony/Component/Finder/Finder.php index b5a3b964db0e3..3bd2cc7635348 100644 --- a/src/Symfony/Component/Finder/Finder.php +++ b/src/Symfony/Component/Finder/Finder.php @@ -36,6 +36,8 @@ * $finder = Finder::create()->files()->name('*.php')->in(__DIR__); * * @author Fabien Potencier + * + * @implements \IteratorAggregate */ class Finder implements \IteratorAggregate, \Countable { @@ -601,7 +603,7 @@ public function in($dirs) * * This method implements the IteratorAggregate interface. * - * @return \Iterator|SplFileInfo[] An iterator + * @return \Traversable An iterator * * @throws \LogicException if the in() method has not been called */ diff --git a/src/Symfony/Component/Form/AbstractType.php b/src/Symfony/Component/Form/AbstractType.php index 3325b8bc27567..8c4f0e3405a5f 100644 --- a/src/Symfony/Component/Form/AbstractType.php +++ b/src/Symfony/Component/Form/AbstractType.php @@ -17,6 +17,9 @@ /** * @author Bernhard Schussek + * + * @template T + * @implements FormTypeInterface */ abstract class AbstractType implements FormTypeInterface { diff --git a/src/Symfony/Component/Form/AbstractTypeExtension.php b/src/Symfony/Component/Form/AbstractTypeExtension.php index 9d369bf294e96..97c572a83a7f9 100644 --- a/src/Symfony/Component/Form/AbstractTypeExtension.php +++ b/src/Symfony/Component/Form/AbstractTypeExtension.php @@ -15,6 +15,9 @@ /** * @author Bernhard Schussek + * + * @template T + * @implements FormTypeExtensionInterface */ abstract class AbstractTypeExtension implements FormTypeExtensionInterface { diff --git a/src/Symfony/Component/Form/Button.php b/src/Symfony/Component/Form/Button.php index e8d521047f6e2..c415a3f33ee0f 100644 --- a/src/Symfony/Component/Form/Button.php +++ b/src/Symfony/Component/Form/Button.php @@ -18,6 +18,10 @@ * A form button. * * @author Bernhard Schussek + * + * @template T + * + * @implements FormInterface */ class Button implements \IteratorAggregate, FormInterface { diff --git a/src/Symfony/Component/Form/ButtonBuilder.php b/src/Symfony/Component/Form/ButtonBuilder.php index 87adc69475dc5..f6a46acacd691 100644 --- a/src/Symfony/Component/Form/ButtonBuilder.php +++ b/src/Symfony/Component/Form/ButtonBuilder.php @@ -19,6 +19,10 @@ * A builder for {@link Button} instances. * * @author Bernhard Schussek + * + * @template T + * + * @implements FormBuilderInterface */ class ButtonBuilder implements \IteratorAggregate, FormBuilderInterface { @@ -135,7 +139,7 @@ public function all() /** * Creates the button. * - * @return Button The button + * @return FormInterface The button */ public function getForm() { diff --git a/src/Symfony/Component/Form/CallbackTransformer.php b/src/Symfony/Component/Form/CallbackTransformer.php index 5125214ff959c..c0049662b6f75 100644 --- a/src/Symfony/Component/Form/CallbackTransformer.php +++ b/src/Symfony/Component/Form/CallbackTransformer.php @@ -11,14 +11,20 @@ namespace Symfony\Component\Form; +/** + * @template T + * @template R + * + * @implements DataTransformerInterface + */ class CallbackTransformer implements DataTransformerInterface { private $transform; private $reverseTransform; /** - * @param callable $transform The forward transform callback - * @param callable $reverseTransform The reverse transform callback + * @param callable(T):R $transform The forward transform callback + * @param callable(R):T $reverseTransform The reverse transform callback */ public function __construct(callable $transform, callable $reverseTransform) { diff --git a/src/Symfony/Component/Form/ChoiceList/View/ChoiceGroupView.php b/src/Symfony/Component/Form/ChoiceList/View/ChoiceGroupView.php index 0c0654ed9f4e2..4a2b38d72076b 100644 --- a/src/Symfony/Component/Form/ChoiceList/View/ChoiceGroupView.php +++ b/src/Symfony/Component/Form/ChoiceList/View/ChoiceGroupView.php @@ -15,6 +15,8 @@ * Represents a group of choices in templates. * * @author Bernhard Schussek + * + * @implements \IteratorAggregate */ class ChoiceGroupView implements \IteratorAggregate { @@ -35,7 +37,7 @@ public function __construct(string $label, array $choices = []) /** * {@inheritdoc} * - * @return self[]|ChoiceView[] + * @return \Traversable */ public function getIterator() { diff --git a/src/Symfony/Component/Form/DataTransformerInterface.php b/src/Symfony/Component/Form/DataTransformerInterface.php index e5ac5992944e5..563d0bcc0ddcf 100644 --- a/src/Symfony/Component/Form/DataTransformerInterface.php +++ b/src/Symfony/Component/Form/DataTransformerInterface.php @@ -17,6 +17,9 @@ * Transforms a value between different representations. * * @author Bernhard Schussek + * + * @template T + * @template R */ interface DataTransformerInterface { @@ -53,9 +56,9 @@ interface DataTransformerInterface * of the first data transformer outputs NULL, the second must be able to * process that value. * - * @param mixed $value The value in the original representation + * @param T $value The value in the original representation * - * @return mixed The value in the transformed representation + * @return R The value in the transformed representation * * @throws TransformationFailedException when the transformation fails */ @@ -82,9 +85,9 @@ public function transform($value); * By convention, reverseTransform() should return NULL if an empty string * is passed. * - * @param mixed $value The value in the transformed representation + * @param R $value The value in the transformed representation * - * @return mixed The value in the original representation + * @return T The value in the original representation * * @throws TransformationFailedException when the transformation fails */ diff --git a/src/Symfony/Component/Form/Event/PostSetDataEvent.php b/src/Symfony/Component/Form/Event/PostSetDataEvent.php index eef537452acd9..a75e17301de03 100644 --- a/src/Symfony/Component/Form/Event/PostSetDataEvent.php +++ b/src/Symfony/Component/Form/Event/PostSetDataEvent.php @@ -17,6 +17,9 @@ * This event is dispatched at the end of the Form::setData() method. * * This event is mostly here for reading data after having pre-populated the form. + * + * @template T + * @extends FormEvent */ final class PostSetDataEvent extends FormEvent { diff --git a/src/Symfony/Component/Form/Event/PreSetDataEvent.php b/src/Symfony/Component/Form/Event/PreSetDataEvent.php index 5450400e06820..87e7473d07123 100644 --- a/src/Symfony/Component/Form/Event/PreSetDataEvent.php +++ b/src/Symfony/Component/Form/Event/PreSetDataEvent.php @@ -19,6 +19,9 @@ * It can be used to: * - Modify the data given during pre-population; * - Modify a form depending on the pre-populated data (adding or removing fields dynamically). + * + * @template T + * @extends FormEvent */ final class PreSetDataEvent extends FormEvent { diff --git a/src/Symfony/Component/Form/Event/PreSubmitEvent.php b/src/Symfony/Component/Form/Event/PreSubmitEvent.php index a72ac5d16028a..aa5856daa00c5 100644 --- a/src/Symfony/Component/Form/Event/PreSubmitEvent.php +++ b/src/Symfony/Component/Form/Event/PreSubmitEvent.php @@ -19,6 +19,8 @@ * It can be used to: * - Change data from the request, before submitting the data to the form. * - Add or remove form fields, before submitting the data to the form. + * + * @extends FormEvent> */ final class PreSubmitEvent extends FormEvent { diff --git a/src/Symfony/Component/Form/Event/SubmitEvent.php b/src/Symfony/Component/Form/Event/SubmitEvent.php index 71d3b06d47457..aa78d509c51f5 100644 --- a/src/Symfony/Component/Form/Event/SubmitEvent.php +++ b/src/Symfony/Component/Form/Event/SubmitEvent.php @@ -18,6 +18,9 @@ * transforms back the normalized data to the model and view data. * * It can be used to change data from the normalized representation of the data. + * + * @template T + * @extends FormEvent */ final class SubmitEvent extends FormEvent { diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/ArrayToPartsTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/ArrayToPartsTransformer.php index f79920971c015..c13f02387112a 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/ArrayToPartsTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/ArrayToPartsTransformer.php @@ -16,6 +16,8 @@ /** * @author Bernhard Schussek + * + * @implements DataTransformerInterface */ class ArrayToPartsTransformer implements DataTransformerInterface { diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/BaseDateTimeTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/BaseDateTimeTransformer.php index 4727c42e547c2..a8866defdf2a0 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/BaseDateTimeTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/BaseDateTimeTransformer.php @@ -14,6 +14,12 @@ use Symfony\Component\Form\DataTransformerInterface; use Symfony\Component\Form\Exception\InvalidArgumentException; +/** + * @template T + * @template R + * + * @implements DataTransformerInterface + */ abstract class BaseDateTimeTransformer implements DataTransformerInterface { protected static $formats = [ diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/BooleanToStringTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/BooleanToStringTransformer.php index f4fd09b627fc9..1606e0f4ae3a1 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/BooleanToStringTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/BooleanToStringTransformer.php @@ -20,6 +20,8 @@ * * @author Bernhard Schussek * @author Florian Eckerstorfer + * + * @implements DataTransformerInterface */ class BooleanToStringTransformer implements DataTransformerInterface { diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/ChoiceToValueTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/ChoiceToValueTransformer.php index e1feafe62e1d3..7284c968b1e62 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/ChoiceToValueTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/ChoiceToValueTransformer.php @@ -17,6 +17,8 @@ /** * @author Bernhard Schussek + * + * @implements DataTransformerInterface */ class ChoiceToValueTransformer implements DataTransformerInterface { diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/ChoicesToValuesTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/ChoicesToValuesTransformer.php index 6c9e4fe9dc2b9..ab15cb1d0a505 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/ChoicesToValuesTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/ChoicesToValuesTransformer.php @@ -17,6 +17,8 @@ /** * @author Bernhard Schussek + * + * @implements DataTransformerInterface */ class ChoicesToValuesTransformer implements DataTransformerInterface { @@ -28,7 +30,7 @@ public function __construct(ChoiceListInterface $choiceList) } /** - * @return array + * @return string[] * * @throws TransformationFailedException if the given value is not an array */ diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DataTransformerChain.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DataTransformerChain.php index 72d1586d499d1..75b70f3beb5de 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DataTransformerChain.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DataTransformerChain.php @@ -18,6 +18,8 @@ * Passes a value through multiple value transformers. * * @author Bernhard Schussek + * + * @implements DataTransformerInterface */ class DataTransformerChain implements DataTransformerInterface { diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateIntervalToArrayTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateIntervalToArrayTransformer.php index bb461bb3b0f3d..dd8e47b3a9c74 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateIntervalToArrayTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateIntervalToArrayTransformer.php @@ -19,6 +19,8 @@ * Transforms between a normalized date interval and an interval string/array. * * @author Steffen Roßkamp + * + * @implements DataTransformerInterface<\DateInterval, array> */ class DateIntervalToArrayTransformer implements DataTransformerInterface { diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateIntervalToStringTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateIntervalToStringTransformer.php index 8ae0cdb6664cf..9ba1a701a57ce 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateIntervalToStringTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateIntervalToStringTransformer.php @@ -19,6 +19,8 @@ * Transforms between a date string and a DateInterval object. * * @author Steffen Roßkamp + * + * @implements DataTransformerInterface<\DateInterval, string> */ class DateIntervalToStringTransformer implements DataTransformerInterface { diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeImmutableToDateTimeTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeImmutableToDateTimeTransformer.php index 6eb40af9d8e68..df8e7911f315d 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeImmutableToDateTimeTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeImmutableToDateTimeTransformer.php @@ -18,6 +18,8 @@ * Transforms between a DateTimeImmutable object and a DateTime object. * * @author Valentin Udaltsov + * + * @implements DataTransformerInterface<\DateTimeImmutable|null, \DateTime|null> */ final class DateTimeImmutableToDateTimeTransformer implements DataTransformerInterface { diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeZoneToStringTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeZoneToStringTransformer.php index 6dfccdfd3d1ba..d4e64beba37a0 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeZoneToStringTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeZoneToStringTransformer.php @@ -18,6 +18,8 @@ * Transforms between a timezone identifier string and a DateTimeZone object. * * @author Roland Franssen + * + * @implements DataTransformerInterface<\DateTimeZone|\DateTimeZone[]|null, string|string[]|null> */ class DateTimeZoneToStringTransformer implements DataTransformerInterface { @@ -42,6 +44,7 @@ public function transform($dateTimeZone) throw new TransformationFailedException('Expected an array of \DateTimeZone objects.'); } + /** @var string[] */ return array_map([new self(), 'transform'], $dateTimeZone); } @@ -66,6 +69,7 @@ public function reverseTransform($value) throw new TransformationFailedException('Expected an array of timezone identifier strings.'); } + /** @var \DateTimeZone[] */ return array_map([new self(), 'reverseTransform'], $value); } diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/IntlTimeZoneToStringTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/IntlTimeZoneToStringTransformer.php index aa4629f2efa15..eda554f9f25d2 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/IntlTimeZoneToStringTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/IntlTimeZoneToStringTransformer.php @@ -18,6 +18,8 @@ * Transforms between a timezone identifier string and a IntlTimeZone object. * * @author Roland Franssen + * + * @implements DataTransformerInterface<\IntlTimeZone|\IntlTimeZone[]|null, string|string[]|null> */ class IntlTimeZoneToStringTransformer implements DataTransformerInterface { @@ -42,6 +44,7 @@ public function transform($intlTimeZone) throw new TransformationFailedException('Expected an array of \IntlTimeZone objects.'); } + /** @var string[] */ return array_map([new self(), 'transform'], $intlTimeZone); } @@ -58,7 +61,7 @@ public function transform($intlTimeZone) public function reverseTransform($value) { if (null === $value) { - return; + return null; } if ($this->multiple) { @@ -66,6 +69,7 @@ public function reverseTransform($value) throw new TransformationFailedException('Expected an array of timezone identifier strings.'); } + /** @var \IntlTimeZone[] */ return array_map([new self(), 'reverseTransform'], $value); } diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php index 6fff32696b919..60ea16c9a5135 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php @@ -20,6 +20,8 @@ * * @author Bernhard Schussek * @author Florian Eckerstorfer + * + * @implements DataTransformerInterface */ class NumberToLocalizedStringTransformer implements DataTransformerInterface { diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/PercentToLocalizedStringTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/PercentToLocalizedStringTransformer.php index 0ee621be23875..72f49f7976296 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/PercentToLocalizedStringTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/PercentToLocalizedStringTransformer.php @@ -20,6 +20,8 @@ * * @author Bernhard Schussek * @author Florian Eckerstorfer + * + * @implements DataTransformerInterface */ class PercentToLocalizedStringTransformer implements DataTransformerInterface { diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/StringToFloatTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/StringToFloatTransformer.php index 27e60b4306336..46da0aaa79a8c 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/StringToFloatTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/StringToFloatTransformer.php @@ -14,6 +14,9 @@ use Symfony\Component\Form\DataTransformerInterface; use Symfony\Component\Form\Exception\TransformationFailedException; +/** + * @implements DataTransformerInterface + */ class StringToFloatTransformer implements DataTransformerInterface { private $scale; diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/UlidToStringTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/UlidToStringTransformer.php index ea3fdec341ea9..4996fa738c9ba 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/UlidToStringTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/UlidToStringTransformer.php @@ -19,6 +19,8 @@ * Transforms between a ULID string and a Ulid object. * * @author Pavel Dyakonov + * + * @implements DataTransformerInterface */ class UlidToStringTransformer implements DataTransformerInterface { diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/UuidToStringTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/UuidToStringTransformer.php index a019847ae4adc..9daf1b4c33dc2 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/UuidToStringTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/UuidToStringTransformer.php @@ -19,6 +19,8 @@ * Transforms between a UUID string and a Uuid object. * * @author Pavel Dyakonov + * + * @implements DataTransformerInterface */ class UuidToStringTransformer implements DataTransformerInterface { diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/ValueToDuplicatesTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/ValueToDuplicatesTransformer.php index 4f04645eb77d7..4ace46181b2fb 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/ValueToDuplicatesTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/ValueToDuplicatesTransformer.php @@ -16,6 +16,10 @@ /** * @author Bernhard Schussek + * + * @template T + * + * @implements DataTransformerInterface> */ class ValueToDuplicatesTransformer implements DataTransformerInterface { @@ -29,9 +33,9 @@ public function __construct(array $keys) /** * Duplicates the given value through the array. * - * @param mixed $value The value + * @param T $value The value * - * @return array The array + * @return array The array */ public function transform($value) { @@ -47,7 +51,9 @@ public function transform($value) /** * Extracts the duplicated value from an array. * - * @return mixed The value + * @param array The array + * + * @return T The value * * @throws TransformationFailedException if the given value is not an array or * if the given array can not be transformed diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/WeekToArrayTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/WeekToArrayTransformer.php index 37405998fa428..f1767b3533469 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/WeekToArrayTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/WeekToArrayTransformer.php @@ -18,6 +18,8 @@ * Transforms between an ISO 8601 week date string and an array. * * @author Damien Fayet + * + * @implements DataTransformerInterface */ class WeekToArrayTransformer implements DataTransformerInterface { diff --git a/src/Symfony/Component/Form/Extension/Core/Type/BaseType.php b/src/Symfony/Component/Form/Extension/Core/Type/BaseType.php index 3b5a3a01b5601..ef92fb2381155 100644 --- a/src/Symfony/Component/Form/Extension/Core/Type/BaseType.php +++ b/src/Symfony/Component/Form/Extension/Core/Type/BaseType.php @@ -25,6 +25,9 @@ * cannot be extended (via {@link \Symfony\Component\Form\FormExtensionInterface}) nor themed. * * @author Bernhard Schussek + * + * @template T + * @implements FormTypeInterface */ abstract class BaseType extends AbstractType { diff --git a/src/Symfony/Component/Form/Extension/Core/Type/FormType.php b/src/Symfony/Component/Form/Extension/Core/Type/FormType.php index 7fa7b60fc1791..e929d56818ccd 100644 --- a/src/Symfony/Component/Form/Extension/Core/Type/FormType.php +++ b/src/Symfony/Component/Form/Extension/Core/Type/FormType.php @@ -26,6 +26,9 @@ use Symfony\Component\PropertyAccess\PropertyAccess; use Symfony\Component\PropertyAccess\PropertyAccessorInterface; +/** + * @extends BaseType + */ class FormType extends BaseType { private $dataMapper; diff --git a/src/Symfony/Component/Form/Extension/Core/Type/TextType.php b/src/Symfony/Component/Form/Extension/Core/Type/TextType.php index 9b3c59db85bb4..d0f4bf33d22cf 100644 --- a/src/Symfony/Component/Form/Extension/Core/Type/TextType.php +++ b/src/Symfony/Component/Form/Extension/Core/Type/TextType.php @@ -16,6 +16,9 @@ use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; +/** + * @implements DataTransformerInterface + */ class TextType extends AbstractType implements DataTransformerInterface { public function buildForm(FormBuilderInterface $builder, array $options) diff --git a/src/Symfony/Component/Form/Form.php b/src/Symfony/Component/Form/Form.php index e22415c95efdb..4c32165f9fa38 100644 --- a/src/Symfony/Component/Form/Form.php +++ b/src/Symfony/Component/Form/Form.php @@ -65,6 +65,11 @@ * * @author Fabien Potencier * @author Bernhard Schussek + * + * @template T + * + * @implements FormInterface + * @implements \IteratorAggregate */ class Form implements \IteratorAggregate, FormInterface, ClearableErrorsInterface { @@ -79,7 +84,7 @@ class Form implements \IteratorAggregate, FormInterface, ClearableErrorsInterfac private $parent; /** - * @var FormInterface[]|OrderedHashMap A map of FormInterface instances + * @var OrderedHashMap A map of FormInterface instances */ private $children; @@ -1004,7 +1009,7 @@ public function offsetUnset($name) /** * Returns the iterator for this group. * - * @return \Traversable|FormInterface[] + * @return OrderedHashMap */ public function getIterator() { diff --git a/src/Symfony/Component/Form/FormBuilder.php b/src/Symfony/Component/Form/FormBuilder.php index 8c92046ee3590..a650bc13a2917 100644 --- a/src/Symfony/Component/Form/FormBuilder.php +++ b/src/Symfony/Component/Form/FormBuilder.php @@ -20,6 +20,8 @@ * A builder for creating {@link Form} instances. * * @author Bernhard Schussek + * + * @implements \IteratorAggregate */ class FormBuilder extends FormConfigBuilder implements \IteratorAggregate, FormBuilderInterface { @@ -212,7 +214,7 @@ public function getForm() /** * {@inheritdoc} * - * @return FormBuilderInterface[]|\Traversable + * @return \Traversable */ public function getIterator() { diff --git a/src/Symfony/Component/Form/FormBuilderInterface.php b/src/Symfony/Component/Form/FormBuilderInterface.php index 05c565bb6b472..754d1aa294135 100644 --- a/src/Symfony/Component/Form/FormBuilderInterface.php +++ b/src/Symfony/Component/Form/FormBuilderInterface.php @@ -13,6 +13,9 @@ /** * @author Bernhard Schussek + * + * @template T + * @extends FormConfigBuilderInterface */ interface FormBuilderInterface extends \Traversable, \Countable, FormConfigBuilderInterface { @@ -32,8 +35,8 @@ public function add($child, string $type = null, array $options = []); /** * Creates a form builder. * - * @param string $name The name of the form or the name of the property - * @param string|null $type The type of the form or null if name is a property + * @param string $name The name of the form or the name of the property + * @param class-string|null $type The type of the form or null if name is a property * * @return self */ @@ -72,7 +75,7 @@ public function all(); /** * Creates the form. * - * @return FormInterface The form + * @return FormInterface The form */ public function getForm(); } diff --git a/src/Symfony/Component/Form/FormConfigBuilderInterface.php b/src/Symfony/Component/Form/FormConfigBuilderInterface.php index d9064c1434a00..1f4b780d6a93e 100644 --- a/src/Symfony/Component/Form/FormConfigBuilderInterface.php +++ b/src/Symfony/Component/Form/FormConfigBuilderInterface.php @@ -12,11 +12,18 @@ namespace Symfony\Component\Form; use Symfony\Component\EventDispatcher\EventSubscriberInterface; +use Symfony\Component\Form\Event\PostSetDataEvent; +use Symfony\Component\Form\Event\PreSetDataEvent; +use Symfony\Component\Form\Event\PreSubmitEvent; +use Symfony\Component\Form\Event\SubmitEvent; use Symfony\Component\PropertyAccess\PropertyPathInterface; /** * @author Bernhard Schussek * + * @template T + * @extends FormConfigInterface + * * @method $this setIsEmptyCallback(callable|null $isEmptyCallback) Sets the callback that will be called to determine if the model data of the form is empty or not - not implementing it is deprecated since Symfony 5.1 */ interface FormConfigBuilderInterface extends FormConfigInterface @@ -24,9 +31,11 @@ interface FormConfigBuilderInterface extends FormConfigInterface /** * Adds an event listener to an event on this form. * - * @param int $priority The priority of the listener. Listeners - * with a higher priority are called before - * listeners with a lower priority. + * @param FormEvents::* $eventName + * @param callable(PreSetDataEvent)|callable(PostSetDataEvent)|callable(PreSubmitEvent)|callable(SubmitEvent) $listener + * @param int $priority The priority of the listener. Listeners + * with a higher priority are called before + * listeners with a lower priority. * * @return $this The configuration object */ @@ -248,7 +257,7 @@ public function setAutoInitialize(bool $initialize); /** * Builds and returns the form configuration. * - * @return FormConfigInterface + * @return FormConfigInterface */ public function getFormConfig(); } diff --git a/src/Symfony/Component/Form/FormConfigInterface.php b/src/Symfony/Component/Form/FormConfigInterface.php index e76986c4fb6b7..1ad4027545a16 100644 --- a/src/Symfony/Component/Form/FormConfigInterface.php +++ b/src/Symfony/Component/Form/FormConfigInterface.php @@ -19,6 +19,8 @@ * * @author Bernhard Schussek * + * @template T + * * @method callable|null getIsEmptyCallback() Returns a callable that takes the model data as argument and that returns if it is empty or not - not implementing it is deprecated since Symfony 5.1 */ interface FormConfigInterface @@ -167,7 +169,7 @@ public function getAttribute(string $name, $default = null); /** * Returns the initial data of the form. * - * @return mixed The initial form data + * @return T|null The initial form data */ public function getData(); diff --git a/src/Symfony/Component/Form/FormEvent.php b/src/Symfony/Component/Form/FormEvent.php index c466fafdc6d9e..8932b8f95e722 100644 --- a/src/Symfony/Component/Form/FormEvent.php +++ b/src/Symfony/Component/Form/FormEvent.php @@ -15,6 +15,8 @@ /** * @author Bernhard Schussek + * + * @template T */ class FormEvent extends Event { @@ -33,7 +35,7 @@ public function __construct(FormInterface $form, $data) /** * Returns the form at the source of the event. * - * @return FormInterface + * @return FormInterface */ public function getForm() { @@ -43,7 +45,7 @@ public function getForm() /** * Returns the data associated with this event. * - * @return mixed + * @return T|null */ public function getData() { diff --git a/src/Symfony/Component/Form/FormInterface.php b/src/Symfony/Component/Form/FormInterface.php index 25e9561d5c599..e068e128a647b 100644 --- a/src/Symfony/Component/Form/FormInterface.php +++ b/src/Symfony/Component/Form/FormInterface.php @@ -17,6 +17,8 @@ * A form group bundling multiple forms in a hierarchical structure. * * @author Bernhard Schussek + * + * @template T */ interface FormInterface extends \ArrayAccess, \Traversable, \Countable { @@ -118,9 +120,9 @@ public function setData($modelData); /** * Returns the model data in the format needed for the underlying object. * - * @return mixed When the field is not submitted, the default data is returned. - * When the field is submitted, the default data has been bound - * to the submitted view data. + * @return T|null When the field is not submitted, the default data is returned. + * When the field is submitted, the default data has been bound + * to the submitted view data. * * @throws Exception\RuntimeException If the form inherits data but has no parent */ @@ -320,7 +322,7 @@ public function getRoot(); public function isRoot(); /** - * @return FormView The view + * @return FormView The view */ public function createView(FormView $parent = null); } diff --git a/src/Symfony/Component/Form/FormTypeExtensionInterface.php b/src/Symfony/Component/Form/FormTypeExtensionInterface.php index 6810f0ae91e12..3c8bc63f18e32 100644 --- a/src/Symfony/Component/Form/FormTypeExtensionInterface.php +++ b/src/Symfony/Component/Form/FormTypeExtensionInterface.php @@ -15,6 +15,8 @@ /** * @author Bernhard Schussek + * + * @template T */ interface FormTypeExtensionInterface { @@ -25,6 +27,8 @@ interface FormTypeExtensionInterface * further modify it. * * @see FormTypeInterface::buildForm() + * + * @param FormBuilderInterface $builder */ public function buildForm(FormBuilderInterface $builder, array $options); @@ -35,6 +39,9 @@ public function buildForm(FormBuilderInterface $builder, array $options); * further modify it. * * @see FormTypeInterface::buildView() + * + * @param FormView $view + * @param FormInterface $form */ public function buildView(FormView $view, FormInterface $form, array $options); @@ -45,6 +52,9 @@ public function buildView(FormView $view, FormInterface $form, array $options); * further modify it. * * @see FormTypeInterface::finishView() + * + * @param FormView $view + * @param FormInterface $form */ public function finishView(FormView $view, FormInterface $form, array $options); diff --git a/src/Symfony/Component/Form/FormTypeInterface.php b/src/Symfony/Component/Form/FormTypeInterface.php index 6850d54968105..00dae6ba99861 100644 --- a/src/Symfony/Component/Form/FormTypeInterface.php +++ b/src/Symfony/Component/Form/FormTypeInterface.php @@ -15,6 +15,8 @@ /** * @author Bernhard Schussek + * + * @template T */ interface FormTypeInterface { @@ -25,6 +27,8 @@ interface FormTypeInterface * top most type. Type extensions can further modify the form. * * @see FormTypeExtensionInterface::buildForm() + * + * @param FormBuilderInterface $builder */ public function buildForm(FormBuilderInterface $builder, array $options); @@ -39,6 +43,9 @@ public function buildForm(FormBuilderInterface $builder, array $options); * to do so, move your logic to {@link finishView()} instead. * * @see FormTypeExtensionInterface::buildView() + * + * @param FormView $view + * @param FormInterface $form */ public function buildView(FormView $view, FormInterface $form, array $options); @@ -54,6 +61,9 @@ public function buildView(FormView $view, FormInterface $form, array $options); * else you are recommended to implement {@link buildView()} instead. * * @see FormTypeExtensionInterface::finishView() + * + * @param FormView $view + * @param FormInterface $form */ public function finishView(FormView $view, FormInterface $form, array $options); diff --git a/src/Symfony/Component/Form/FormView.php b/src/Symfony/Component/Form/FormView.php index 78656b3868211..54b9829999a57 100644 --- a/src/Symfony/Component/Form/FormView.php +++ b/src/Symfony/Component/Form/FormView.php @@ -15,11 +15,17 @@ /** * @author Bernhard Schussek + * + * @template T + * + * @implements \IteratorAggregate */ class FormView implements \ArrayAccess, \IteratorAggregate, \Countable { /** * The variables assigned to this view. + * + * @var array{value: mixed, attr: array}&array */ public $vars = [ 'value' => null, @@ -28,6 +34,8 @@ class FormView implements \ArrayAccess, \IteratorAggregate, \Countable /** * The parent view. + * + * @var self|null */ public $parent; @@ -148,7 +156,7 @@ public function offsetUnset($name) /** * Returns an iterator to iterate over children (implements \IteratorAggregate). * - * @return \ArrayIterator The iterator + * @return \Traversable */ public function getIterator() { diff --git a/src/Symfony/Component/Form/ReversedTransformer.php b/src/Symfony/Component/Form/ReversedTransformer.php index 8089e47bf0554..ed088a331fc00 100644 --- a/src/Symfony/Component/Form/ReversedTransformer.php +++ b/src/Symfony/Component/Form/ReversedTransformer.php @@ -18,11 +18,19 @@ * reverseTransform() method is called and vice versa. * * @author Bernhard Schussek + * + * @template T + * @template R + * + * @implements DataTransformerInterface */ class ReversedTransformer implements DataTransformerInterface { protected $reversedTransformer; + /** + * @param DataTransformerInterface $reversedTransformer + */ public function __construct(DataTransformerInterface $reversedTransformer) { $this->reversedTransformer = $reversedTransformer; diff --git a/src/Symfony/Component/Form/SubmitButton.php b/src/Symfony/Component/Form/SubmitButton.php index 5e38b10987282..3930a6af23805 100644 --- a/src/Symfony/Component/Form/SubmitButton.php +++ b/src/Symfony/Component/Form/SubmitButton.php @@ -15,6 +15,8 @@ * A button that submits the form. * * @author Bernhard Schussek + * + * @extends Button */ class SubmitButton extends Button implements ClickableInterface { diff --git a/src/Symfony/Component/Form/SubmitButtonBuilder.php b/src/Symfony/Component/Form/SubmitButtonBuilder.php index 931f399daf243..ae19bcba3c212 100644 --- a/src/Symfony/Component/Form/SubmitButtonBuilder.php +++ b/src/Symfony/Component/Form/SubmitButtonBuilder.php @@ -15,13 +15,13 @@ * A builder for {@link SubmitButton} instances. * * @author Bernhard Schussek + * + * @extends ButtonBuilder */ class SubmitButtonBuilder extends ButtonBuilder { /** - * Creates the button. - * - * @return SubmitButton The button + * {@inheritdoc} */ public function getForm() { diff --git a/src/Symfony/Component/Form/Tests/Fixtures/FixedDataTransformer.php b/src/Symfony/Component/Form/Tests/Fixtures/FixedDataTransformer.php index 29391160968e2..ff75b80cde177 100644 --- a/src/Symfony/Component/Form/Tests/Fixtures/FixedDataTransformer.php +++ b/src/Symfony/Component/Form/Tests/Fixtures/FixedDataTransformer.php @@ -14,6 +14,9 @@ use Symfony\Component\Form\DataTransformerInterface; use Symfony\Component\Form\Exception\TransformationFailedException; +/** + * @implements DataTransformerInterface + */ class FixedDataTransformer implements DataTransformerInterface { private $mapping; @@ -23,6 +26,9 @@ public function __construct(array $mapping) $this->mapping = $mapping; } + /** + * {@inheritdoc} + */ public function transform($value) { if (!\array_key_exists($value, $this->mapping)) { @@ -32,6 +38,9 @@ public function transform($value) return $this->mapping[$value]; } + /** + * {@inheritdoc} + */ public function reverseTransform($value) { $result = array_search($value, $this->mapping, true); diff --git a/src/Symfony/Component/Form/Util/OrderedHashMap.php b/src/Symfony/Component/Form/Util/OrderedHashMap.php index 6d758ca91c5d4..b3aeb386a823d 100644 --- a/src/Symfony/Component/Form/Util/OrderedHashMap.php +++ b/src/Symfony/Component/Form/Util/OrderedHashMap.php @@ -63,6 +63,12 @@ * } * * @author Bernhard Schussek + * + * @template TKey + * @template TValue + * + * @implements \IteratorAggregate + * @implements \ArrayAccess */ class OrderedHashMap implements \ArrayAccess, \IteratorAggregate, \Countable { diff --git a/src/Symfony/Component/HttpFoundation/Cookie.php b/src/Symfony/Component/HttpFoundation/Cookie.php index fc5e5e756b0d4..cdc568d315e59 100644 --- a/src/Symfony/Component/HttpFoundation/Cookie.php +++ b/src/Symfony/Component/HttpFoundation/Cookie.php @@ -71,6 +71,17 @@ public static function fromString(string $cookie, bool $decode = false) return new static($name, $value, $data['expires'], $data['path'], $data['domain'], $data['secure'], $data['httponly'], $data['raw'], $data['samesite']); } + /** + * @param string $name The name of the cookie + * @param string|null $value The value of the cookie + * @param int|string|\DateTimeInterface $expire The time the cookie expires + * @param string $path The path on the server in which the cookie will be available on + * @param string|null $domain The domain that the cookie is available to + * @param bool|null $secure Whether the client should send back the cookie only over HTTPS or null to auto-enable this when the request is already using HTTPS + * @param bool $httpOnly Whether the cookie will be made accessible only through the HTTP protocol + * @param bool $raw Whether the cookie value should be sent with no url encoding + * @param self::SAMESITE_*|''|null $sameSite Whether the cookie will be available for cross-site requests + */ public static function create(string $name, string $value = null, $expire = 0, ?string $path = '/', string $domain = null, bool $secure = null, bool $httpOnly = true, bool $raw = false, ?string $sameSite = self::SAMESITE_LAX): self { return new self($name, $value, $expire, $path, $domain, $secure, $httpOnly, $raw, $sameSite); @@ -85,11 +96,9 @@ public static function create(string $name, string $value = null, $expire = 0, ? * @param bool|null $secure Whether the client should send back the cookie only over HTTPS or null to auto-enable this when the request is already using HTTPS * @param bool $httpOnly Whether the cookie will be made accessible only through the HTTP protocol * @param bool $raw Whether the cookie value should be sent with no url encoding - * @param string|null $sameSite Whether the cookie will be available for cross-site requests - * - * @throws \InvalidArgumentException + * @param self::SAMESITE_*|''|null $sameSite Whether the cookie will be available for cross-site requests */ - public function __construct(string $name, string $value = null, $expire = 0, ?string $path = '/', string $domain = null, bool $secure = null, bool $httpOnly = true, bool $raw = false, ?string $sameSite = 'lax') + public function __construct(string $name, string $value = null, $expire = 0, ?string $path = '/', string $domain = null, bool $secure = null, bool $httpOnly = true, bool $raw = false, ?string $sameSite = self::SAMESITE_LAX) { // from PHP source code if ($raw && false !== strpbrk($name, self::$reservedCharsList)) { @@ -234,6 +243,8 @@ public function withRaw(bool $raw = true): self /** * Creates a cookie copy with SameSite attribute. * + * @param self::SAMESITE_*|null $sameSite + * * @return static */ public function withSameSite(?string $sameSite): self @@ -407,7 +418,7 @@ public function isRaw() /** * Gets the SameSite attribute. * - * @return string|null + * @return self::SAMESITE_*|null */ public function getSameSite() { diff --git a/src/Symfony/Component/HttpFoundation/HeaderBag.php b/src/Symfony/Component/HttpFoundation/HeaderBag.php index f9c02f2105f25..16e851deab1ce 100644 --- a/src/Symfony/Component/HttpFoundation/HeaderBag.php +++ b/src/Symfony/Component/HttpFoundation/HeaderBag.php @@ -15,6 +15,8 @@ * HeaderBag is a container for HTTP headers. * * @author Fabien Potencier + * + * @implements \IteratorAggregate */ class HeaderBag implements \IteratorAggregate, \Countable { @@ -250,7 +252,7 @@ public function removeCacheControlDirective(string $key) /** * Returns an iterator for headers. * - * @return \ArrayIterator An \ArrayIterator instance + * @return \Traversable */ public function getIterator() { diff --git a/src/Symfony/Component/HttpFoundation/ParameterBag.php b/src/Symfony/Component/HttpFoundation/ParameterBag.php index c6e2dff27e397..d86adbedeb64e 100644 --- a/src/Symfony/Component/HttpFoundation/ParameterBag.php +++ b/src/Symfony/Component/HttpFoundation/ParameterBag.php @@ -17,6 +17,8 @@ * ParameterBag is a container for key/value pairs. * * @author Fabien Potencier + * + * @implements \IteratorAggregate */ class ParameterBag implements \IteratorAggregate, \Countable { @@ -205,7 +207,7 @@ public function filter(string $key, $default = null, int $filter = \FILTER_DEFAU /** * Returns an iterator for parameters. * - * @return \ArrayIterator An \ArrayIterator instance + * @return \Traversable */ public function getIterator() { diff --git a/src/Symfony/Component/HttpFoundation/Session/Attribute/AttributeBag.php b/src/Symfony/Component/HttpFoundation/Session/Attribute/AttributeBag.php index aad6b610e7bb3..9e145fe7887d2 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Attribute/AttributeBag.php +++ b/src/Symfony/Component/HttpFoundation/Session/Attribute/AttributeBag.php @@ -13,6 +13,8 @@ /** * This class relates to session attribute storage. + * + * @implements \IteratorAggregate */ class AttributeBag implements AttributeBagInterface, \IteratorAggregate, \Countable { @@ -129,7 +131,7 @@ public function clear() /** * Returns an iterator for attributes. * - * @return \ArrayIterator An \ArrayIterator instance + * @return \Traversable */ public function getIterator() { diff --git a/src/Symfony/Component/HttpFoundation/Session/Session.php b/src/Symfony/Component/HttpFoundation/Session/Session.php index e4e25356376ed..1a9008b6c97d0 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Session.php +++ b/src/Symfony/Component/HttpFoundation/Session/Session.php @@ -26,6 +26,8 @@ class_exists(SessionBagProxy::class); /** * @author Fabien Potencier * @author Drak + * + * @implements \IteratorAggregate */ class Session implements SessionInterface, \IteratorAggregate, \Countable { @@ -126,7 +128,7 @@ public function isStarted() /** * Returns an iterator for attributes. * - * @return \ArrayIterator An \ArrayIterator instance + * @return \Traversable */ public function getIterator() { diff --git a/src/Symfony/Component/Process/Process.php b/src/Symfony/Component/Process/Process.php index 877f16cd3def3..8fe4b939923f5 100644 --- a/src/Symfony/Component/Process/Process.php +++ b/src/Symfony/Component/Process/Process.php @@ -27,6 +27,8 @@ * * @author Fabien Potencier * @author Romain Neutron + * + * @implements \IteratorAggregate */ class Process implements \IteratorAggregate { @@ -615,7 +617,7 @@ public function getIncrementalOutput() * @throws LogicException in case the output has been disabled * @throws LogicException In case the process is not started * - * @return \Generator + * @return \Generator */ public function getIterator(int $flags = 0) { diff --git a/src/Symfony/Component/PropertyAccess/PropertyPathInterface.php b/src/Symfony/Component/PropertyAccess/PropertyPathInterface.php index e22563fb9bfeb..306fff7115d83 100644 --- a/src/Symfony/Component/PropertyAccess/PropertyPathInterface.php +++ b/src/Symfony/Component/PropertyAccess/PropertyPathInterface.php @@ -15,6 +15,8 @@ * A sequence of property names or array indices. * * @author Bernhard Schussek + * + * @extends \Traversable */ interface PropertyPathInterface extends \Traversable { diff --git a/src/Symfony/Component/Routing/RouteCollection.php b/src/Symfony/Component/Routing/RouteCollection.php index 73b6ac47c7a63..0519216b269ab 100644 --- a/src/Symfony/Component/Routing/RouteCollection.php +++ b/src/Symfony/Component/Routing/RouteCollection.php @@ -22,6 +22,8 @@ * * @author Fabien Potencier * @author Tobias Schultze + * + * @implements \IteratorAggregate */ class RouteCollection implements \IteratorAggregate, \Countable { @@ -54,7 +56,7 @@ public function __clone() * * @see all() * - * @return \ArrayIterator|Route[] An \ArrayIterator object for iterating over routes + * @return \Traversable An \ArrayIterator object for iterating over routes */ public function getIterator() { diff --git a/src/Symfony/Component/Security/Http/Authenticator/Passport/PassportInterface.php b/src/Symfony/Component/Security/Http/Authenticator/Passport/PassportInterface.php index 9d4318a58bdba..65070567e5e2d 100644 --- a/src/Symfony/Component/Security/Http/Authenticator/Passport/PassportInterface.php +++ b/src/Symfony/Component/Security/Http/Authenticator/Passport/PassportInterface.php @@ -39,6 +39,13 @@ public function addBadge(BadgeInterface $badge): self; public function hasBadge(string $badgeFqcn): bool; + /** + * @template T of BadgeInterface + * + * @param class-string $badgeFqcn + * + * @return T|null + */ public function getBadge(string $badgeFqcn): ?BadgeInterface; /** diff --git a/src/Symfony/Component/Validator/ConstraintViolationList.php b/src/Symfony/Component/Validator/ConstraintViolationList.php index e5dd6725a2467..739cd6eed27c3 100644 --- a/src/Symfony/Component/Validator/ConstraintViolationList.php +++ b/src/Symfony/Component/Validator/ConstraintViolationList.php @@ -15,6 +15,8 @@ * Default implementation of {@ConstraintViolationListInterface}. * * @author Bernhard Schussek + * + * @implements \IteratorAggregate */ class ConstraintViolationList implements \IteratorAggregate, ConstraintViolationListInterface { @@ -108,7 +110,7 @@ public function remove(int $offset) /** * {@inheritdoc} * - * @return \ArrayIterator|ConstraintViolationInterface[] + * @return \Traversable */ public function getIterator() { diff --git a/src/Symfony/Component/Validator/ConstraintViolationListInterface.php b/src/Symfony/Component/Validator/ConstraintViolationListInterface.php index 25a1e9909a144..28c21e56ae692 100644 --- a/src/Symfony/Component/Validator/ConstraintViolationListInterface.php +++ b/src/Symfony/Component/Validator/ConstraintViolationListInterface.php @@ -15,6 +15,8 @@ * A list of constraint violations. * * @author Bernhard Schussek + * + * @extends \Traversable */ interface ConstraintViolationListInterface extends \Traversable, \Countable, \ArrayAccess { diff --git a/src/Symfony/Component/Workflow/TransitionBlockerList.php b/src/Symfony/Component/Workflow/TransitionBlockerList.php index f7f4a63ea303a..599a60cd3a343 100644 --- a/src/Symfony/Component/Workflow/TransitionBlockerList.php +++ b/src/Symfony/Component/Workflow/TransitionBlockerList.php @@ -15,6 +15,8 @@ * A list of transition blockers. * * @author Grégoire Pineau + * + * @implements \IteratorAggregate */ final class TransitionBlockerList implements \IteratorAggregate, \Countable { @@ -61,7 +63,7 @@ public function isEmpty(): bool /** * {@inheritdoc} * - * @return \ArrayIterator|TransitionBlocker[] + * @return \Traversable */ public function getIterator(): \Traversable { diff --git a/src/Symfony/Contracts/Cache/CacheInterface.php b/src/Symfony/Contracts/Cache/CacheInterface.php index 4b1686b873bfc..7ec290d43f265 100644 --- a/src/Symfony/Contracts/Cache/CacheInterface.php +++ b/src/Symfony/Contracts/Cache/CacheInterface.php @@ -29,14 +29,16 @@ interface CacheInterface * requested key, that could be used e.g. for expiration control. It could also * be an ItemInterface instance when its additional features are needed. * - * @param string $key The key of the item to retrieve from the cache - * @param callable|CallbackInterface $callback Should return the computed value for the given key/item - * @param float|null $beta A float that, as it grows, controls the likeliness of triggering - * early expiration. 0 disables it, INF forces immediate expiration. - * The default (or providing null) is implementation dependent but should - * typically be 1.0, which should provide optimal stampede protection. - * See https://en.wikipedia.org/wiki/Cache_stampede#Probabilistic_early_expiration - * @param array &$metadata The metadata of the cached item {@see ItemInterface::getMetadata()} + * @template T + * + * @param string $key The key of the item to retrieve from the cache + * @param callable(CacheItemInterface, bool)|CallbackInterface $callback Should return the computed value for the given key/item + * @param float|null $beta A float that, as it grows, controls the likeliness of triggering + * early expiration. 0 disables it, INF forces immediate expiration. + * The default (or providing null) is implementation dependent but should + * typically be 1.0, which should provide optimal stampede protection. + * See https://en.wikipedia.org/wiki/Cache_stampede#Probabilistic_early_expiration + * @param array|null &$metadata The metadata of the cached item {@see ItemInterface::getMetadata()} * * @return mixed The value corresponding to the provided key *