From b8077846fd67b07b3a9bada8352e254bd5860798 Mon Sep 17 00:00:00 2001 From: Vitalii Shtykhno Date: Wed, 19 Mar 2025 23:25:41 +0100 Subject: [PATCH 1/3] fix: correct php 8.4 notices --- src/qtism/common/ResolutionException.php | 2 +- src/qtism/common/beans/BeanException.php | 2 +- .../datatypes/files/FileManagerException.php | 2 +- src/qtism/common/storage/MemoryStreamException.php | 2 +- src/qtism/common/storage/StreamAccessException.php | 2 +- src/qtism/common/storage/StreamException.php | 2 +- src/qtism/data/AssessmentItem.php | 6 +++--- src/qtism/data/AssessmentItemRef.php | 2 +- src/qtism/data/AssessmentSection.php | 4 ++-- src/qtism/data/AssessmentTest.php | 6 +++--- src/qtism/data/BranchRuleTargetException.php | 2 +- src/qtism/data/ExtendedAssessmentTest.php | 2 +- src/qtism/data/QtiComponentIterator.php | 4 ++-- src/qtism/data/QtiDocument.php | 4 ++-- src/qtism/data/SectionPart.php | 4 ++-- src/qtism/data/TestPart.php | 4 ++-- src/qtism/data/content/ModalFeedback.php | 2 +- .../data/content/interactions/SimpleMatchSet.php | 2 +- .../data/content/xhtml/html5/Html5Element.php | 4 ++-- src/qtism/data/processing/OutcomeProcessing.php | 2 +- src/qtism/data/processing/ResponseProcessing.php | 2 +- src/qtism/data/results/AssessmentResult.php | 2 +- src/qtism/data/results/Context.php | 2 +- src/qtism/data/results/ItemResult.php | 8 ++++---- src/qtism/data/results/ResultOutcomeVariable.php | 14 +++++++------- src/qtism/data/results/ResultResponseVariable.php | 4 ++-- src/qtism/data/results/ResultTemplateVariable.php | 2 +- src/qtism/data/results/TestResult.php | 2 +- src/qtism/data/rules/OutcomeCondition.php | 4 ++-- src/qtism/data/rules/ResponseCondition.php | 2 +- src/qtism/data/rules/TemplateCondition.php | 2 +- src/qtism/data/state/OutcomeDeclaration.php | 2 +- src/qtism/data/state/ResponseDeclaration.php | 2 +- src/qtism/data/state/TemplateDeclaration.php | 2 +- src/qtism/data/state/VariableDeclaration.php | 2 +- src/qtism/data/storage/StorageException.php | 2 +- src/qtism/data/storage/php/PhpStorageException.php | 2 +- src/qtism/data/storage/php/PhpStreamAccess.php | 6 +++--- .../php/marshalling/PhpMarshallingException.php | 2 +- src/qtism/data/storage/xml/XmlCompactDocument.php | 4 ++-- src/qtism/data/storage/xml/XmlDocument.php | 2 +- src/qtism/data/storage/xml/XmlStorageException.php | 2 +- .../xml/marshalling/AssessmentItemMarshaller.php | 2 +- .../marshalling/AssessmentSectionMarshaller.php | 2 +- .../xml/marshalling/AssessmentTestMarshaller.php | 2 +- .../ExtendedAssessmentSectionMarshaller.php | 2 +- .../ExtendedAssessmentTestMarshaller.php | 2 +- .../marshalling/MarshallerNotFoundException.php | 2 +- .../xml/marshalling/RecursiveMarshaller.php | 2 +- .../marshalling/ResponseProcessingMarshaller.php | 2 +- .../xml/marshalling/UnmarshallingException.php | 2 +- src/qtism/runtime/common/AbstractEngine.php | 2 +- src/qtism/runtime/common/OutcomeVariable.php | 2 +- src/qtism/runtime/common/ProcessingException.php | 2 +- src/qtism/runtime/common/ResponseVariable.php | 2 +- src/qtism/runtime/common/Utils.php | 2 +- src/qtism/runtime/common/Variable.php | 2 +- .../operators/OperatorProcessorFactory.php | 2 +- .../runtime/processing/OutcomeProcessingEngine.php | 2 +- .../processing/ResponseProcessingEngine.php | 2 +- .../processing/TemplateProcessingEngine.php | 2 +- src/qtism/runtime/rendering/RenderingException.php | 2 +- src/qtism/runtime/rules/RuleEngine.php | 2 +- .../storage/binary/AbstractQtiBinaryStorage.php | 2 +- .../storage/binary/QtiBinaryStreamAccess.php | 2 +- src/qtism/runtime/tests/AbstractSessionManager.php | 4 ++-- src/qtism/runtime/tests/AssessmentItemSession.php | 6 +++--- .../tests/AssessmentItemSessionException.php | 2 +- src/qtism/runtime/tests/AssessmentTestSession.php | 6 +++--- .../tests/AssessmentTestSessionException.php | 2 +- src/qtism/runtime/tests/OrderingException.php | 2 +- src/qtism/runtime/tests/Route.php | 2 +- src/qtism/runtime/tests/SelectionException.php | 2 +- src/qtism/runtime/tests/Utils.php | 2 +- 74 files changed, 103 insertions(+), 103 deletions(-) diff --git a/src/qtism/common/ResolutionException.php b/src/qtism/common/ResolutionException.php index 8b5586813..1417a3b8f 100644 --- a/src/qtism/common/ResolutionException.php +++ b/src/qtism/common/ResolutionException.php @@ -38,7 +38,7 @@ class ResolutionException extends RuntimeException * @param string $message A human-readable description of the exception. * @param Exception $previous An optional previous Exception that caused the exception to be thrown. */ - public function __construct($message, Exception $previous = null) + public function __construct($message, ?Exception $previous = null) { parent::__construct($message, 0, $previous); } diff --git a/src/qtism/common/beans/BeanException.php b/src/qtism/common/beans/BeanException.php index 85b1163ee..d1c26fc31 100644 --- a/src/qtism/common/beans/BeanException.php +++ b/src/qtism/common/beans/BeanException.php @@ -87,7 +87,7 @@ class BeanException extends Exception * @param int $code An error code from the BeanException class constants. * @param Exception $previous An optional previous exception. */ - public function __construct($message, $code = 0, Exception $previous = null) + public function __construct($message, $code = 0, ?Exception $previous = null) { parent::__construct($message, $code, $previous); } diff --git a/src/qtism/common/datatypes/files/FileManagerException.php b/src/qtism/common/datatypes/files/FileManagerException.php index 25689edac..387c7de0a 100644 --- a/src/qtism/common/datatypes/files/FileManagerException.php +++ b/src/qtism/common/datatypes/files/FileManagerException.php @@ -46,7 +46,7 @@ class FileManagerException extends Exception * @param int $code A machine understandable error code (see class constants). * @param Exception $previous A possible previous Exception object. */ - public function __construct($message, $code = 0, Exception $previous = null) + public function __construct($message, $code = 0, ?Exception $previous = null) { parent::__construct($message, $code, $previous); } diff --git a/src/qtism/common/storage/MemoryStreamException.php b/src/qtism/common/storage/MemoryStreamException.php index 49a63286a..e3849e644 100644 --- a/src/qtism/common/storage/MemoryStreamException.php +++ b/src/qtism/common/storage/MemoryStreamException.php @@ -39,7 +39,7 @@ class MemoryStreamException extends StreamException * @param int $code A code describing the error. * @param Exception $previous An optional previous exception. */ - public function __construct($message, IStream $source, $code = 0, Exception $previous = null) + public function __construct($message, IStream $source, $code = 0, ?Exception $previous = null) { parent::__construct($message, $source, $code, $previous); } diff --git a/src/qtism/common/storage/StreamAccessException.php b/src/qtism/common/storage/StreamAccessException.php index af0b982ca..24c764468 100644 --- a/src/qtism/common/storage/StreamAccessException.php +++ b/src/qtism/common/storage/StreamAccessException.php @@ -61,7 +61,7 @@ class StreamAccessException extends Exception * @param int $code An exception code. See class constants. * @param Exception $previous An optional previously thrown exception. */ - public function __construct($message, AbstractStreamAccess $source, $code = 0, Exception $previous = null) + public function __construct($message, AbstractStreamAccess $source, $code = 0, ?Exception $previous = null) { parent::__construct($message, $code, $previous); $this->setSource($source); diff --git a/src/qtism/common/storage/StreamException.php b/src/qtism/common/storage/StreamException.php index 90825bd4b..432b1a2e4 100644 --- a/src/qtism/common/storage/StreamException.php +++ b/src/qtism/common/storage/StreamException.php @@ -101,7 +101,7 @@ abstract class StreamException extends Exception * @param int $code A code describing the error. * @param Exception $previous An optional previous exception. */ - public function __construct($message, IStream $source, $code = 0, Exception $previous = null) + public function __construct($message, IStream $source, $code = 0, ?Exception $previous = null) { parent::__construct($message, $code, $previous); $this->setSource($source); diff --git a/src/qtism/data/AssessmentItem.php b/src/qtism/data/AssessmentItem.php index 792fc903f..c98a3d1a2 100644 --- a/src/qtism/data/AssessmentItem.php +++ b/src/qtism/data/AssessmentItem.php @@ -538,7 +538,7 @@ public function getTemplateDeclarations(): TemplateDeclarationCollection * * @param TemplateProcessing $templateProcessing A TemplateProcessing object or null. */ - public function setTemplateProcessing(TemplateProcessing $templateProcessing = null): void + public function setTemplateProcessing(?TemplateProcessing $templateProcessing = null): void { $this->templateProcessing = $templateProcessing; } @@ -589,7 +589,7 @@ public function getStylesheets(): StylesheetCollection * * @param ItemBody $itemBody An ItemBody object or the NULL value to state that the item has no content. */ - public function setItemBody(ItemBody $itemBody = null): void + public function setItemBody(?ItemBody $itemBody = null): void { $this->itemBody = $itemBody; } @@ -629,7 +629,7 @@ public function getResponseProcessing(): ?ResponseProcessing * * @param ResponseProcessing $responseProcessing A ResponseProcessing object or null if no associated response processing. */ - public function setResponseProcessing(ResponseProcessing $responseProcessing = null): void + public function setResponseProcessing(?ResponseProcessing $responseProcessing = null): void { $this->responseProcessing = $responseProcessing; } diff --git a/src/qtism/data/AssessmentItemRef.php b/src/qtism/data/AssessmentItemRef.php index 3d0dfe99c..a5ffc3754 100644 --- a/src/qtism/data/AssessmentItemRef.php +++ b/src/qtism/data/AssessmentItemRef.php @@ -89,7 +89,7 @@ class AssessmentItemRef extends SectionPart * @param IdentifierCollection $categories The categories to which the item belongs to. * @throws InvalidArgumentException If $href is not a string. */ - public function __construct($identifier, $href, IdentifierCollection $categories = null) + public function __construct($identifier, $href, ?IdentifierCollection $categories = null) { parent::__construct($identifier); diff --git a/src/qtism/data/AssessmentSection.php b/src/qtism/data/AssessmentSection.php index 698be5585..b2beef602 100644 --- a/src/qtism/data/AssessmentSection.php +++ b/src/qtism/data/AssessmentSection.php @@ -203,7 +203,7 @@ public function getSelection(): ?Selection * * @param Selection $selection A selection rule. */ - public function setSelection(Selection $selection = null): void + public function setSelection(?Selection $selection = null): void { $this->selection = $selection; } @@ -234,7 +234,7 @@ public function getOrdering(): ?Ordering * * @param Ordering $ordering An Ordering object. */ - public function setOrdering(Ordering $ordering = null): void + public function setOrdering(?Ordering $ordering = null): void { $this->ordering = $ordering; } diff --git a/src/qtism/data/AssessmentTest.php b/src/qtism/data/AssessmentTest.php index d701fa9d4..cb52e8be6 100644 --- a/src/qtism/data/AssessmentTest.php +++ b/src/qtism/data/AssessmentTest.php @@ -149,7 +149,7 @@ class AssessmentTest extends QtiComponent implements QtiIdentifiable * @param $title * @param TestPartCollection|null $testParts */ - public function __construct($identifier, $title, TestPartCollection $testParts = null) + public function __construct($identifier, $title, ?TestPartCollection $testParts = null) { $this->setObservers(new SplObjectStorage()); @@ -303,7 +303,7 @@ public function getTimeLimits(): ?TimeLimits * * @param TimeLimits $timeLimits A TimeLimits object. */ - public function setTimeLimits(TimeLimits $timeLimits = null): void + public function setTimeLimits(?TimeLimits $timeLimits = null): void { $this->timeLimits = $timeLimits; } @@ -344,7 +344,7 @@ public function getOutcomeProcessing(): ?OutcomeProcessing * * @param OutcomeProcessing $outcomeProcessing An OutcomeProcessing object. */ - public function setOutcomeProcessing(OutcomeProcessing $outcomeProcessing = null): void + public function setOutcomeProcessing(?OutcomeProcessing $outcomeProcessing = null): void { $this->outcomeProcessing = $outcomeProcessing; } diff --git a/src/qtism/data/BranchRuleTargetException.php b/src/qtism/data/BranchRuleTargetException.php index caa5fb8ef..cb153abc3 100644 --- a/src/qtism/data/BranchRuleTargetException.php +++ b/src/qtism/data/BranchRuleTargetException.php @@ -68,7 +68,7 @@ class BranchRuleTargetException extends Exception implements QtiSdkPackageConten * @param QtiComponent A QtiComponent from where the Exception comes from. * @param Exception $previous An eventual previous Exception object. */ - public function __construct($message, $code = 0, $source = null, Exception $previous = null) + public function __construct($message, $code = 0, $source = null, ?Exception $previous = null) { parent::__construct($message, $code, $previous); } diff --git a/src/qtism/data/ExtendedAssessmentTest.php b/src/qtism/data/ExtendedAssessmentTest.php index d0b5d630b..1533b7112 100644 --- a/src/qtism/data/ExtendedAssessmentTest.php +++ b/src/qtism/data/ExtendedAssessmentTest.php @@ -45,7 +45,7 @@ class ExtendedAssessmentTest extends AssessmentTest * @param string $title A title. * @param TestPartCollection $testParts A collection of ExtendedTestPart objects. */ - public function __construct($identifier, $title, TestPartCollection $testParts = null) + public function __construct($identifier, $title, ?TestPartCollection $testParts = null) { parent::__construct($identifier, $title, $testParts); $this->setTestFeedbackRefs(new TestFeedbackRefCollection()); diff --git a/src/qtism/data/QtiComponentIterator.php b/src/qtism/data/QtiComponentIterator.php index e63fcc92d..cb86d49c4 100644 --- a/src/qtism/data/QtiComponentIterator.php +++ b/src/qtism/data/QtiComponentIterator.php @@ -144,7 +144,7 @@ protected function setRootComponent(QtiComponent $rootComponent): void /** * @param QtiComponent|null $currentContainer */ - protected function setCurrentContainer(QtiComponent $currentContainer = null): void + protected function setCurrentContainer(?QtiComponent $currentContainer = null): void { $this->currentContainer = $currentContainer; } @@ -173,7 +173,7 @@ public function getRootComponent(): QtiComponent * * @param QtiComponent $currentComponent */ - protected function setCurrentComponent(QtiComponent $currentComponent = null): void + protected function setCurrentComponent(?QtiComponent $currentComponent = null): void { $this->currentComponent = $currentComponent; } diff --git a/src/qtism/data/QtiDocument.php b/src/qtism/data/QtiDocument.php index cd1118369..463827312 100644 --- a/src/qtism/data/QtiDocument.php +++ b/src/qtism/data/QtiDocument.php @@ -57,7 +57,7 @@ abstract class QtiDocument * @param string $versionNumber * @param QtiComponent|null $documentComponent */ - public function __construct($versionNumber = '2.1.0', QtiComponent $documentComponent = null) + public function __construct($versionNumber = '2.1.0', ?QtiComponent $documentComponent = null) { $this->setVersion($versionNumber); $this->setDocumentComponent($documentComponent); @@ -89,7 +89,7 @@ public function getVersion(): string * * @param QtiComponent $documentComponent A QTI Component object. */ - public function setDocumentComponent(QtiComponent $documentComponent = null): void + public function setDocumentComponent(?QtiComponent $documentComponent = null): void { $this->documentComponent = $documentComponent; } diff --git a/src/qtism/data/SectionPart.php b/src/qtism/data/SectionPart.php index 298cfecd0..d4563e1b2 100644 --- a/src/qtism/data/SectionPart.php +++ b/src/qtism/data/SectionPart.php @@ -275,7 +275,7 @@ public function getItemSessionControl(): ?ItemSessionControl * * @param ItemSessionControl $itemSessionControl An ItemSessionControl object. */ - public function setItemSessionControl(ItemSessionControl $itemSessionControl = null): void + public function setItemSessionControl(?ItemSessionControl $itemSessionControl = null): void { $this->itemSessionControl = $itemSessionControl; } @@ -317,7 +317,7 @@ public function hasTimeLimits(): bool * * @param TimeLimits $timeLimits A TimeLimits object. */ - public function setTimeLimits(TimeLimits $timeLimits = null): void + public function setTimeLimits(?TimeLimits $timeLimits = null): void { $this->timeLimits = $timeLimits; } diff --git a/src/qtism/data/TestPart.php b/src/qtism/data/TestPart.php index 5453db2d9..3c3fee873 100644 --- a/src/qtism/data/TestPart.php +++ b/src/qtism/data/TestPart.php @@ -283,7 +283,7 @@ public function getItemSessionControl(): ?ItemSessionControl * * @param ItemSessionControl $itemSessionControl An ItemSessionControl object. */ - public function setItemSessionControl(ItemSessionControl $itemSessionControl = null): void + public function setItemSessionControl(?ItemSessionControl $itemSessionControl = null): void { $this->itemSessionControl = $itemSessionControl; } @@ -315,7 +315,7 @@ public function getTimeLimits(): ?TimeLimits * * @param TimeLimits $timeLimits A TimeLimits object. */ - public function setTimeLimits(TimeLimits $timeLimits = null): void + public function setTimeLimits(?TimeLimits $timeLimits = null): void { $this->timeLimits = $timeLimits; } diff --git a/src/qtism/data/content/ModalFeedback.php b/src/qtism/data/content/ModalFeedback.php index ea470aca7..92db78662 100644 --- a/src/qtism/data/content/ModalFeedback.php +++ b/src/qtism/data/content/ModalFeedback.php @@ -112,7 +112,7 @@ class ModalFeedback extends QtiComponent * @param string $title The title of the modal feedback. * @throws InvalidArgumentException If any of the arguments is invalid. */ - public function __construct($outcomeIdentifier, $identifier, FlowStaticCollection $content = null, $title = '') + public function __construct($outcomeIdentifier, $identifier, ?FlowStaticCollection $content = null, $title = '') { $this->setOutcomeIdentifier($outcomeIdentifier); $this->setIdentifier($identifier); diff --git a/src/qtism/data/content/interactions/SimpleMatchSet.php b/src/qtism/data/content/interactions/SimpleMatchSet.php index 03a2d5f68..cefaa8071 100644 --- a/src/qtism/data/content/interactions/SimpleMatchSet.php +++ b/src/qtism/data/content/interactions/SimpleMatchSet.php @@ -46,7 +46,7 @@ class SimpleMatchSet extends QtiComponent * * @param SimpleAssociableChoiceCollection $simpleAssociableChoices The ordered set of choices for the set. */ - public function __construct(SimpleAssociableChoiceCollection $simpleAssociableChoices = null) + public function __construct(?SimpleAssociableChoiceCollection $simpleAssociableChoices = null) { $this->setSimpleAssociableChoices($simpleAssociableChoices ?? new SimpleAssociableChoiceCollection()); } diff --git a/src/qtism/data/content/xhtml/html5/Html5Element.php b/src/qtism/data/content/xhtml/html5/Html5Element.php index 077e06c19..7514b8a3d 100644 --- a/src/qtism/data/content/xhtml/html5/Html5Element.php +++ b/src/qtism/data/content/xhtml/html5/Html5Element.php @@ -157,7 +157,7 @@ public function acceptBooleanOrNull($value, string $argumentName, ?bool $default return $value ?? $default; } - protected function acceptNormalizedStringOrNull($value, string $argumentName, string $default = null): string + protected function acceptNormalizedStringOrNull($value, string $argumentName, ?string $default = null): string { if ($value === null) { return $default; @@ -309,7 +309,7 @@ protected function acceptMimeTypeOrNull(?string $value, string $argumentName, st * @return int * @throws InvalidArgumentException If $value is not null, 0 or a positive integer. */ - public function acceptNonNegativeIntegerOrNull($value, string $argumentName, int $default = null): int + public function acceptNonNegativeIntegerOrNull($value, string $argumentName, ?int $default = null): int { if ($value !== null && (!is_int($value) || $value < 0)) { $given = is_int($value) diff --git a/src/qtism/data/processing/OutcomeProcessing.php b/src/qtism/data/processing/OutcomeProcessing.php index 430f71f4c..30e49c48e 100644 --- a/src/qtism/data/processing/OutcomeProcessing.php +++ b/src/qtism/data/processing/OutcomeProcessing.php @@ -57,7 +57,7 @@ class OutcomeProcessing extends QtiComponent * * @param OutcomeRuleCollection $outcomeRules A collection of OutcomeRule objects. */ - public function __construct(OutcomeRuleCollection $outcomeRules = null) + public function __construct(?OutcomeRuleCollection $outcomeRules = null) { if (empty($outcomeRules)) { $outcomeRules = new OutcomeRuleCollection(); diff --git a/src/qtism/data/processing/ResponseProcessing.php b/src/qtism/data/processing/ResponseProcessing.php index 172ff9cb2..1da1e6d92 100644 --- a/src/qtism/data/processing/ResponseProcessing.php +++ b/src/qtism/data/processing/ResponseProcessing.php @@ -83,7 +83,7 @@ class ResponseProcessing extends QtiComponent * * @param ResponseRuleCollection $responseRules A collection of ResponseRule objects. */ - public function __construct(ResponseRuleCollection $responseRules = null) + public function __construct(?ResponseRuleCollection $responseRules = null) { if (empty($responseRules)) { $responseRules = new ResponseRuleCollection(); diff --git a/src/qtism/data/results/AssessmentResult.php b/src/qtism/data/results/AssessmentResult.php index 0aaf51e2d..97d2e4d3f 100644 --- a/src/qtism/data/results/AssessmentResult.php +++ b/src/qtism/data/results/AssessmentResult.php @@ -75,7 +75,7 @@ class AssessmentResult extends QtiComponent * @param TestResult|null $testResult * @param ItemResultCollection|null $itemResults */ - public function __construct(Context $context, TestResult $testResult = null, ItemResultCollection $itemResults = null) + public function __construct(Context $context, ?TestResult $testResult = null, ?ItemResultCollection $itemResults = null) { $this->setContext($context); $this->setTestResult($testResult); diff --git a/src/qtism/data/results/Context.php b/src/qtism/data/results/Context.php index d97fd89b2..f18386bd1 100644 --- a/src/qtism/data/results/Context.php +++ b/src/qtism/data/results/Context.php @@ -63,7 +63,7 @@ class Context extends QtiComponent * @param QtiIdentifier|null $sourcedId * @param SessionIdentifierCollection|null $sessionIdentifiers */ - public function __construct(QtiIdentifier $sourcedId = null, SessionIdentifierCollection $sessionIdentifiers = null) + public function __construct(?QtiIdentifier $sourcedId = null, ?SessionIdentifierCollection $sessionIdentifiers = null) { $this->setSourcedId($sourcedId); if ($sessionIdentifiers === null) { diff --git a/src/qtism/data/results/ItemResult.php b/src/qtism/data/results/ItemResult.php index 613571391..807e32313 100644 --- a/src/qtism/data/results/ItemResult.php +++ b/src/qtism/data/results/ItemResult.php @@ -128,9 +128,9 @@ public function __construct( QtiIdentifier $identifier, DateTime $datestamp, $sessionStatus, - ItemVariableCollection $itemVariables = null, - QtiString $candidateComment = null, - QtiInteger $sequenceIndex = null + ?ItemVariableCollection $itemVariables = null, + ?QtiString $candidateComment = null, + ?QtiInteger $sequenceIndex = null ) { $this->setIdentifier($identifier); $this->setDatestamp($datestamp); @@ -257,7 +257,7 @@ public function getSequenceIndex(): ?QtiInteger * @param QtiInteger|null $sequenceIndex * @return $this */ - public function setSequenceIndex(QtiInteger $sequenceIndex = null) + public function setSequenceIndex(?QtiInteger $sequenceIndex = null) { $this->sequenceIndex = $sequenceIndex; return $this; diff --git a/src/qtism/data/results/ResultOutcomeVariable.php b/src/qtism/data/results/ResultOutcomeVariable.php index 38e63bb18..5f70772e6 100644 --- a/src/qtism/data/results/ResultOutcomeVariable.php +++ b/src/qtism/data/results/ResultOutcomeVariable.php @@ -125,13 +125,13 @@ public function __construct( QtiIdentifier $identifier, $cardinality, $baseType = null, - ValueCollection $values = null, - $view = null, - QtiString $interpretation = null, - QtiUri $longInterpretation = null, - QtiFloat $normalMaximum = null, - QtiFloat $normalMinimum = null, - QtiFloat $masteryValue = null + ?ValueCollection $values = null, + ?$view = null, + ?QtiString $interpretation = null, + ?QtiUri $longInterpretation = null, + ?QtiFloat $normalMaximum = null, + ?QtiFloat $normalMinimum = null, + ?QtiFloat $masteryValue = null ) { parent::__construct($identifier, $cardinality, $baseType); $this->setValues($values); diff --git a/src/qtism/data/results/ResultResponseVariable.php b/src/qtism/data/results/ResultResponseVariable.php index 5b88127c4..55cb052ee 100644 --- a/src/qtism/data/results/ResultResponseVariable.php +++ b/src/qtism/data/results/ResultResponseVariable.php @@ -81,8 +81,8 @@ public function __construct( $cardinality, CandidateResponse $candidateResponse, $baseType = null, - CorrectResponse $correctResponse = null, - QtiIdentifier $choiceSequence = null + ?CorrectResponse $correctResponse = null, + ?QtiIdentifier $choiceSequence = null ) { parent::__construct($identifier, $cardinality, $baseType); $this->setCandidateResponse($candidateResponse); diff --git a/src/qtism/data/results/ResultTemplateVariable.php b/src/qtism/data/results/ResultTemplateVariable.php index b70d9898b..4d64e080b 100644 --- a/src/qtism/data/results/ResultTemplateVariable.php +++ b/src/qtism/data/results/ResultTemplateVariable.php @@ -52,7 +52,7 @@ class ResultTemplateVariable extends ItemVariable * @param null $baseType * @param ValueCollection|null $values */ - public function __construct(QtiIdentifier $identifier, $cardinality, $baseType = null, ValueCollection $values = null) + public function __construct(QtiIdentifier $identifier, $cardinality, $baseType = null, ?ValueCollection $values = null) { parent::__construct($identifier, $cardinality, $baseType); $this->setValues($values); diff --git a/src/qtism/data/results/TestResult.php b/src/qtism/data/results/TestResult.php index 7c0bd6a23..f3c94216c 100644 --- a/src/qtism/data/results/TestResult.php +++ b/src/qtism/data/results/TestResult.php @@ -75,7 +75,7 @@ class TestResult extends QtiComponent * @param DateTime $datestamp The timestamp when testResult has been registered * @param ItemVariableCollection|null $itemVariables All variables */ - public function __construct(QtiIdentifier $identifier, DateTime $datestamp, ItemVariableCollection $itemVariables = null) + public function __construct(QtiIdentifier $identifier, DateTime $datestamp, ?ItemVariableCollection $itemVariables = null) { $this->setIdentifier($identifier); $this->setDatestamp($datestamp); diff --git a/src/qtism/data/rules/OutcomeCondition.php b/src/qtism/data/rules/OutcomeCondition.php index bedfdd466..2dd8e4501 100644 --- a/src/qtism/data/rules/OutcomeCondition.php +++ b/src/qtism/data/rules/OutcomeCondition.php @@ -71,7 +71,7 @@ class OutcomeCondition extends QtiComponent implements OutcomeRule * @param OutcomeElseIfCollection $outcomeElseIfs A collection of OutcomeElseIf objects. * @param OutcomeElse $outcomeElse An OutcomeElse object. */ - public function __construct(OutcomeIf $outcomeIf, OutcomeElseIfCollection $outcomeElseIfs = null, OutcomeElse $outcomeElse = null) + public function __construct(OutcomeIf $outcomeIf, ?OutcomeElseIfCollection $outcomeElseIfs = null, ?OutcomeElse $outcomeElse = null) { $this->setOutcomeIf($outcomeIf); $this->setOutcomeElse($outcomeElse); @@ -133,7 +133,7 @@ public function getOutcomeElse(): ?OutcomeElse * * @param OutcomeElse $outcomeElse An OutcomeElse object. */ - public function setOutcomeElse(OutcomeElse $outcomeElse = null): void + public function setOutcomeElse(?OutcomeElse $outcomeElse = null): void { $this->outcomeElse = $outcomeElse; } diff --git a/src/qtism/data/rules/ResponseCondition.php b/src/qtism/data/rules/ResponseCondition.php index 4d402ebd6..0455bf550 100644 --- a/src/qtism/data/rules/ResponseCondition.php +++ b/src/qtism/data/rules/ResponseCondition.php @@ -71,7 +71,7 @@ class ResponseCondition extends QtiComponent implements ResponseRule * @param ResponseElseIfCollection $responseElseIfs A collection of ResponseElseIf objects. * @param ResponseElse $responseElse An ResponseElse object. */ - public function __construct(ResponseIf $responseIf, ResponseElseIfCollection $responseElseIfs = null, ResponseElse $responseElse = null) + public function __construct(ResponseIf $responseIf, ?ResponseElseIfCollection $responseElseIfs = null, ?ResponseElse $responseElse = null) { $this->setResponseIf($responseIf); $this->setResponseElse($responseElse); diff --git a/src/qtism/data/rules/TemplateCondition.php b/src/qtism/data/rules/TemplateCondition.php index 7dfecd0f4..444f29494 100644 --- a/src/qtism/data/rules/TemplateCondition.php +++ b/src/qtism/data/rules/TemplateCondition.php @@ -125,7 +125,7 @@ public function getTemplateElseIfs(): TemplateElseIfCollection * * @param TemplateElse $templateElse A TemplateElse object. */ - public function setTemplateElse(TemplateElse $templateElse = null): void + public function setTemplateElse(?TemplateElse $templateElse = null): void { $this->templateElse = $templateElse; } diff --git a/src/qtism/data/state/OutcomeDeclaration.php b/src/qtism/data/state/OutcomeDeclaration.php index c76b6eedc..2cccd888b 100644 --- a/src/qtism/data/state/OutcomeDeclaration.php +++ b/src/qtism/data/state/OutcomeDeclaration.php @@ -167,7 +167,7 @@ class OutcomeDeclaration extends VariableDeclaration * * @throws InvalidArgumentException If one or more of the arguments are invalid. */ - public function __construct($identifier, $baseType = -1, $cardinality = Cardinality::SINGLE, DefaultValue $defaultValue = null, $externalScored = null) + public function __construct($identifier, $baseType = -1, $cardinality = Cardinality::SINGLE, ?DefaultValue $defaultValue = null, $externalScored = null) { parent::__construct($identifier, $baseType, $cardinality, $defaultValue); $this->setViews(new ViewCollection()); diff --git a/src/qtism/data/state/ResponseDeclaration.php b/src/qtism/data/state/ResponseDeclaration.php index 0d9bb6643..24b6e0c59 100644 --- a/src/qtism/data/state/ResponseDeclaration.php +++ b/src/qtism/data/state/ResponseDeclaration.php @@ -115,7 +115,7 @@ class ResponseDeclaration extends VariableDeclaration * @param int $cardinality A value from the Cardinality enumeration. * @param DefaultValue $defaultValue A DefaultValue object. */ - public function __construct($identifier, $baseType = -1, $cardinality = Cardinality::SINGLE, DefaultValue $defaultValue = null) + public function __construct($identifier, $baseType = -1, $cardinality = Cardinality::SINGLE, ?DefaultValue $defaultValue = null) { parent::__construct($identifier, $baseType, $cardinality, $defaultValue); } diff --git a/src/qtism/data/state/TemplateDeclaration.php b/src/qtism/data/state/TemplateDeclaration.php index bc2ed647f..1641cf4c3 100644 --- a/src/qtism/data/state/TemplateDeclaration.php +++ b/src/qtism/data/state/TemplateDeclaration.php @@ -71,7 +71,7 @@ class TemplateDeclaration extends VariableDeclaration * @param int $cardinality * @param DefaultValue|null $defaultValue */ - public function __construct($identifier, $baseType = -1, $cardinality = Cardinality::SINGLE, DefaultValue $defaultValue = null) + public function __construct($identifier, $baseType = -1, $cardinality = Cardinality::SINGLE, ?DefaultValue $defaultValue = null) { parent::__construct($identifier, $baseType, $cardinality, $defaultValue); } diff --git a/src/qtism/data/state/VariableDeclaration.php b/src/qtism/data/state/VariableDeclaration.php index 3f6b64037..d61fa04d0 100644 --- a/src/qtism/data/state/VariableDeclaration.php +++ b/src/qtism/data/state/VariableDeclaration.php @@ -107,7 +107,7 @@ class VariableDeclaration extends QtiComponent implements QtiIdentifiable * @param int $cardinality A value from the Cardinality enumeration. * @param DefaultValue $defaultValue A DefaultValue object. */ - public function __construct($identifier, $baseType = -1, $cardinality = Cardinality::SINGLE, DefaultValue $defaultValue = null) + public function __construct($identifier, $baseType = -1, $cardinality = Cardinality::SINGLE, ?DefaultValue $defaultValue = null) { $this->setObservers(new SplObjectStorage()); diff --git a/src/qtism/data/storage/StorageException.php b/src/qtism/data/storage/StorageException.php index 8b5ebd5bd..06e965a65 100644 --- a/src/qtism/data/storage/StorageException.php +++ b/src/qtism/data/storage/StorageException.php @@ -67,7 +67,7 @@ class StorageException extends Exception implements QtiSdkPackageContentExceptio * @param int $code A exception code (see class constants). * @param Exception $previous An eventual previous Exception object. */ - public function __construct($message, $code = 0, Exception $previous = null) + public function __construct($message, $code = 0, ?Exception $previous = null) { parent::__construct($message, $code, $previous); } diff --git a/src/qtism/data/storage/php/PhpStorageException.php b/src/qtism/data/storage/php/PhpStorageException.php index 26525c504..2420098a3 100644 --- a/src/qtism/data/storage/php/PhpStorageException.php +++ b/src/qtism/data/storage/php/PhpStorageException.php @@ -39,7 +39,7 @@ class PhpStorageException extends StorageException * @param int $code An error code. * @param Exception $previous A previously thrown and caught exception. */ - public function __construct($message, $code = 0, Exception $previous = null) + public function __construct($message, $code = 0, ?Exception $previous = null) { parent::__construct($message, $code, $previous); } diff --git a/src/qtism/data/storage/php/PhpStreamAccess.php b/src/qtism/data/storage/php/PhpStreamAccess.php index ceb8c0b09..633bd7355 100644 --- a/src/qtism/data/storage/php/PhpStreamAccess.php +++ b/src/qtism/data/storage/php/PhpStreamAccess.php @@ -326,7 +326,7 @@ public function writeObjectOperator(): void * @param PhpArgumentCollection $arguments A collection of PhpArgument objects representing the arguments to be given to the function call. * @throws StreamAccessException If an error occurs while writing the function call. */ - public function writeFunctionCall($funcname, PhpArgumentCollection $arguments = null): void + public function writeFunctionCall($funcname, ?PhpArgumentCollection $arguments = null): void { try { $this->getStream()->write($funcname); @@ -355,7 +355,7 @@ public function writeFunctionCall($funcname, PhpArgumentCollection $arguments = public function writeMethodCall( $objectname, $methodname, - PhpArgumentCollection $arguments = null, + ?PhpArgumentCollection $arguments = null, $static = false ): void { try { @@ -407,7 +407,7 @@ public function writeNew($space = true): void * @param PhpArgumentCollection $arguments A collection of PhpArgument objects. * @throws StreamAccessException */ - public function writeInstantiation($classname, PhpArgumentCollection $arguments = null): void + public function writeInstantiation($classname, ?PhpArgumentCollection $arguments = null): void { try { $this->writeNew(); diff --git a/src/qtism/data/storage/php/marshalling/PhpMarshallingException.php b/src/qtism/data/storage/php/marshalling/PhpMarshallingException.php index 25cde5666..b60f40bfd 100644 --- a/src/qtism/data/storage/php/marshalling/PhpMarshallingException.php +++ b/src/qtism/data/storage/php/marshalling/PhpMarshallingException.php @@ -61,7 +61,7 @@ class PhpMarshallingException extends Exception implements QtiSdkPackageContentE * @param int $code An error code. * @param Exception $previous A previously thrown exception. */ - public function __construct($message, $code = 0, Exception $previous = null) + public function __construct($message, $code = 0, ?Exception $previous = null) { parent::__construct($message, $code, $previous); } diff --git a/src/qtism/data/storage/xml/XmlCompactDocument.php b/src/qtism/data/storage/xml/XmlCompactDocument.php index de8c6b7bc..3c4b934d8 100644 --- a/src/qtism/data/storage/xml/XmlCompactDocument.php +++ b/src/qtism/data/storage/xml/XmlCompactDocument.php @@ -85,7 +85,7 @@ class XmlCompactDocument extends XmlDocument * @param string $version * @param QtiComponent|null $documentComponent */ - public function __construct($version = '2.1.0', QtiComponent $documentComponent = null) + public function __construct($version = '2.1.0', ?QtiComponent $documentComponent = null) { // Version 1.0 was used in legacy code, let's keep it BC. if ($version === '1.0') { @@ -172,7 +172,7 @@ public function mustExplodeTestFeedbacks(): bool * @throws XmlStorageException If an error occurs while transforming the XmlAssessmentTestDocument object into an XmlCompactAssessmentTestDocument object. * @throws ReflectionException */ - public static function createFromXmlAssessmentTestDocument(XmlDocument $xmlAssessmentTestDocument, FileResolver $resolver = null, $version = '2.1'): XmlCompactDocument + public static function createFromXmlAssessmentTestDocument(XmlDocument $xmlAssessmentTestDocument, ?FileResolver $resolver = null, $version = '2.1'): XmlCompactDocument { $compactAssessmentTest = new XmlCompactDocument($version); $compactAssessmentTest->setFilesystem($xmlAssessmentTestDocument->getFilesystem()); diff --git a/src/qtism/data/storage/xml/XmlDocument.php b/src/qtism/data/storage/xml/XmlDocument.php index 4436d4985..33f9207be 100644 --- a/src/qtism/data/storage/xml/XmlDocument.php +++ b/src/qtism/data/storage/xml/XmlDocument.php @@ -115,7 +115,7 @@ public function getDomDocument(): DOMDocument * * @param Filesystem|FilesystemInterface|null $filesystem */ - public function setFilesystem(FilesystemInterface $filesystem = null): void + public function setFilesystem(?FilesystemInterface $filesystem = null): void { if (!$filesystem) { $filesystem = FilesystemFactory::local(); diff --git a/src/qtism/data/storage/xml/XmlStorageException.php b/src/qtism/data/storage/xml/XmlStorageException.php index 5355fd98f..7cd6da0cc 100644 --- a/src/qtism/data/storage/xml/XmlStorageException.php +++ b/src/qtism/data/storage/xml/XmlStorageException.php @@ -61,7 +61,7 @@ class XmlStorageException extends StorageException * @param Exception $previous An optional previous exception which is the cause of this one. * @param LibXmlErrorCollection $errors An array of errors (stdClass) as generated by libxml_get_errors(). */ - public function __construct($message, $code = 0, $previous = null, LibXmlErrorCollection $errors = null) + public function __construct($message, $code = 0, $previous = null, ?LibXmlErrorCollection $errors = null) { parent::__construct($message, $code, $previous); diff --git a/src/qtism/data/storage/xml/marshalling/AssessmentItemMarshaller.php b/src/qtism/data/storage/xml/marshalling/AssessmentItemMarshaller.php index d312268c9..5f6ef0ffc 100644 --- a/src/qtism/data/storage/xml/marshalling/AssessmentItemMarshaller.php +++ b/src/qtism/data/storage/xml/marshalling/AssessmentItemMarshaller.php @@ -126,7 +126,7 @@ protected function marshall(QtiComponent $component): DOMElement * @throws MarshallerNotFoundException * @throws UnmarshallingException */ - protected function unmarshall(DOMElement $element, AssessmentItem $assessmentItem = null): AssessmentItem + protected function unmarshall(DOMElement $element, ?AssessmentItem $assessmentItem = null): AssessmentItem { if (($identifier = $this->getDOMElementAttributeAs($element, 'identifier')) !== null) { if (($timeDependent = $this->getDOMElementAttributeAs($element, 'timeDependent', 'boolean')) !== null) { diff --git a/src/qtism/data/storage/xml/marshalling/AssessmentSectionMarshaller.php b/src/qtism/data/storage/xml/marshalling/AssessmentSectionMarshaller.php index 2bddbf140..d48d77a81 100644 --- a/src/qtism/data/storage/xml/marshalling/AssessmentSectionMarshaller.php +++ b/src/qtism/data/storage/xml/marshalling/AssessmentSectionMarshaller.php @@ -48,7 +48,7 @@ class AssessmentSectionMarshaller extends RecursiveMarshaller protected function unmarshallChildrenKnown( DOMElement $element, QtiComponentCollection $children, - AssessmentSection $assessmentSection = null + ?AssessmentSection $assessmentSection = null ): QtiComponent { $baseMarshaller = new SectionPartMarshaller($this->getVersion()); $baseComponent = $baseMarshaller->unmarshall($element); diff --git a/src/qtism/data/storage/xml/marshalling/AssessmentTestMarshaller.php b/src/qtism/data/storage/xml/marshalling/AssessmentTestMarshaller.php index 848190271..447e1fd7b 100644 --- a/src/qtism/data/storage/xml/marshalling/AssessmentTestMarshaller.php +++ b/src/qtism/data/storage/xml/marshalling/AssessmentTestMarshaller.php @@ -101,7 +101,7 @@ protected function marshall(QtiComponent $component): DOMElement * @throws MarshallerNotFoundException * @throws UnmarshallingException */ - protected function unmarshall(DOMElement $element, AssessmentTest $assessmentTest = null): AssessmentTest + protected function unmarshall(DOMElement $element, ?AssessmentTest $assessmentTest = null): AssessmentTest { if (($identifier = $this->getDOMElementAttributeAs($element, 'identifier')) !== null) { if (($title = $this->getDOMElementAttributeAs($element, 'title')) !== null) { diff --git a/src/qtism/data/storage/xml/marshalling/ExtendedAssessmentSectionMarshaller.php b/src/qtism/data/storage/xml/marshalling/ExtendedAssessmentSectionMarshaller.php index 9341b989a..9171fae69 100644 --- a/src/qtism/data/storage/xml/marshalling/ExtendedAssessmentSectionMarshaller.php +++ b/src/qtism/data/storage/xml/marshalling/ExtendedAssessmentSectionMarshaller.php @@ -69,7 +69,7 @@ protected function marshallChildrenKnown(QtiComponent $component, array $element protected function unmarshallChildrenKnown( DOMElement $element, QtiComponentCollection $children, - AssessmentSection $assessmentSection = null + ?AssessmentSection $assessmentSection = null ): QtiComponent { $baseComponent = parent::unmarshallChildrenKnown($element, $children); $component = ExtendedAssessmentSection::createFromAssessmentSection($baseComponent); diff --git a/src/qtism/data/storage/xml/marshalling/ExtendedAssessmentTestMarshaller.php b/src/qtism/data/storage/xml/marshalling/ExtendedAssessmentTestMarshaller.php index 20a17aa5f..ced66c3be 100644 --- a/src/qtism/data/storage/xml/marshalling/ExtendedAssessmentTestMarshaller.php +++ b/src/qtism/data/storage/xml/marshalling/ExtendedAssessmentTestMarshaller.php @@ -60,7 +60,7 @@ protected function marshall(QtiComponent $component): DOMElement * @throws MarshallerNotFoundException * @throws UnmarshallingException */ - protected function unmarshall(DOMElement $element, AssessmentTest $assessmentTest = null): ExtendedAssessmentTest + protected function unmarshall(DOMElement $element, ?AssessmentTest $assessmentTest = null): ExtendedAssessmentTest { $baseComponent = parent::unmarshall($element); $component = ExtendedAssessmentTest::createFromAssessmentTest($baseComponent); diff --git a/src/qtism/data/storage/xml/marshalling/MarshallerNotFoundException.php b/src/qtism/data/storage/xml/marshalling/MarshallerNotFoundException.php index 407663da7..62bb7bf48 100644 --- a/src/qtism/data/storage/xml/marshalling/MarshallerNotFoundException.php +++ b/src/qtism/data/storage/xml/marshalling/MarshallerNotFoundException.php @@ -44,7 +44,7 @@ class MarshallerNotFoundException extends Exception * @param string $qtiClassName The QTI class name for which no Marshaller implementation could be find. * @param Exception $previous An optional previous caught Exception object. */ - public function __construct($message, $qtiClassName, Exception $previous = null) + public function __construct($message, $qtiClassName, ?Exception $previous = null) { parent::__construct($message, 0, $previous); $this->setQtiClassName($qtiClassName); diff --git a/src/qtism/data/storage/xml/marshalling/RecursiveMarshaller.php b/src/qtism/data/storage/xml/marshalling/RecursiveMarshaller.php index 312a2f77d..faa4a0147 100644 --- a/src/qtism/data/storage/xml/marshalling/RecursiveMarshaller.php +++ b/src/qtism/data/storage/xml/marshalling/RecursiveMarshaller.php @@ -259,7 +259,7 @@ protected function marshall(QtiComponent $component): DOMElement * @return QtiComponent A QtiComponent object corresponding to the DOMElement to unmarshall. * @throws MarshallerNotFoundException */ - protected function unmarshall(DOMElement $element, QtiComponent $rootComponent = null): QtiComponent + protected function unmarshall(DOMElement $element, ?QtiComponent $rootComponent = null): QtiComponent { // Reset. $this->resetTrail(); diff --git a/src/qtism/data/storage/xml/marshalling/ResponseProcessingMarshaller.php b/src/qtism/data/storage/xml/marshalling/ResponseProcessingMarshaller.php index 88378236e..221dcc325 100644 --- a/src/qtism/data/storage/xml/marshalling/ResponseProcessingMarshaller.php +++ b/src/qtism/data/storage/xml/marshalling/ResponseProcessingMarshaller.php @@ -71,7 +71,7 @@ protected function marshall(QtiComponent $component): DOMElement */ protected function unmarshall( DOMElement $element, - ResponseProcessing $responseProcessing = null + ?ResponseProcessing $responseProcessing = null ): ResponseProcessing { $responseRuleElts = self::getChildElements($element); diff --git a/src/qtism/data/storage/xml/marshalling/UnmarshallingException.php b/src/qtism/data/storage/xml/marshalling/UnmarshallingException.php index 21113e246..632513bc8 100644 --- a/src/qtism/data/storage/xml/marshalling/UnmarshallingException.php +++ b/src/qtism/data/storage/xml/marshalling/UnmarshallingException.php @@ -47,7 +47,7 @@ class UnmarshallingException extends Exception * @param DOMElement $element The DOMElement object that caused the exception to be thrown. * @param Exception $previous A previous Exception that caused the exception to be thrown. */ - public function __construct($message, DOMElement $element, Exception $previous = null) + public function __construct($message, DOMElement $element, ?Exception $previous = null) { parent::__construct($message, 0, $previous); $this->setDOMElement($element); diff --git a/src/qtism/runtime/common/AbstractEngine.php b/src/qtism/runtime/common/AbstractEngine.php index 7ed29f9ca..984a94b99 100644 --- a/src/qtism/runtime/common/AbstractEngine.php +++ b/src/qtism/runtime/common/AbstractEngine.php @@ -59,7 +59,7 @@ abstract class AbstractEngine implements Processable * @param QtiComponent $component A QtiComponent object to process. * @param State $context (optional) The execution context. If no execution context is given, a virgin one will be set up. */ - public function __construct(QtiComponent $component, State $context = null) + public function __construct(QtiComponent $component, ?State $context = null) { $this->setComponent($component); $this->setContext($context ?? new State()); diff --git a/src/qtism/runtime/common/OutcomeVariable.php b/src/qtism/runtime/common/OutcomeVariable.php index d8d4840c8..d103d8fb9 100644 --- a/src/qtism/runtime/common/OutcomeVariable.php +++ b/src/qtism/runtime/common/OutcomeVariable.php @@ -84,7 +84,7 @@ class OutcomeVariable extends Variable * @param QtiDatatype|null $value A QtiDatatype object or null. * @throws InvalidArgumentException If $identifier is not a string, if $baseType is not a value from the BaseType enumeration, if $cardinality is not a value from the Cardinality enumeration, if $value is not compliant with the QTI Runtime Model. */ - public function __construct($identifier, $cardinality, $baseType = -1, QtiDatatype $value = null) + public function __construct($identifier, $cardinality, $baseType = -1, ?QtiDatatype $value = null) { parent::__construct($identifier, $cardinality, $baseType, $value); } diff --git a/src/qtism/runtime/common/ProcessingException.php b/src/qtism/runtime/common/ProcessingException.php index e73430708..a73eff63c 100644 --- a/src/qtism/runtime/common/ProcessingException.php +++ b/src/qtism/runtime/common/ProcessingException.php @@ -111,7 +111,7 @@ class ProcessingException extends RuntimeException * @param int A code to characterize the error. * @param Exception $previous An optional Exception object that caused the error. */ - public function __construct($msg, Processable $source, $code = 0, Exception $previous = null) + public function __construct($msg, Processable $source, $code = 0, ?Exception $previous = null) { parent::__construct($msg, $code, $previous); $this->setSource($source); diff --git a/src/qtism/runtime/common/ResponseVariable.php b/src/qtism/runtime/common/ResponseVariable.php index 6b9ca7be7..91d461d56 100644 --- a/src/qtism/runtime/common/ResponseVariable.php +++ b/src/qtism/runtime/common/ResponseVariable.php @@ -79,7 +79,7 @@ class ResponseVariable extends Variable * @param QtiDatatype|null $value A QtiDatatype object or null. * @throws InvalidArgumentException If $identifier is not a string, if $baseType is not a value from the BaseType enumeration, if $cardinality is not a value from the Cardinality enumeration, if $value is not compliant with the QTI Runtime Model. */ - public function __construct($identifier, $cardinality, $baseType = -1, QtiDatatype $value = null) + public function __construct($identifier, $cardinality, $baseType = -1, ?QtiDatatype $value = null) { parent::__construct($identifier, $cardinality, $baseType, $value); } diff --git a/src/qtism/runtime/common/Utils.php b/src/qtism/runtime/common/Utils.php index d3488ecf9..0a7c0b257 100644 --- a/src/qtism/runtime/common/Utils.php +++ b/src/qtism/runtime/common/Utils.php @@ -288,7 +288,7 @@ public static function isNull(QtiDatatype $value = null): bool * @param QtiDatatype $b * @return bool */ - public static function equals(QtiDatatype $a = null, QtiDatatype $b = null): bool + public static function equals(?QtiDatatype $a = null, ?QtiDatatype $b = null): bool { return ($a === null ? $b === null : $a->equals($b)); } diff --git a/src/qtism/runtime/common/Variable.php b/src/qtism/runtime/common/Variable.php index 8923259ff..b67ccd291 100644 --- a/src/qtism/runtime/common/Variable.php +++ b/src/qtism/runtime/common/Variable.php @@ -87,7 +87,7 @@ abstract class Variable * @param QtiDatatype|null $value A QtiDatatype object or null. * @throws InvalidArgumentException If the cardinality is record but -1 is not given as a $baseType (Records have no baseType) or If the given $value is not compliant with the given $baseType. */ - public function __construct($identifier, $cardinality, $baseType = -1, QtiDatatype $value = null) + public function __construct($identifier, $cardinality, $baseType = -1, ?QtiDatatype $value = null) { $this->setIdentifier($identifier); $this->setCardinality($cardinality); diff --git a/src/qtism/runtime/expressions/operators/OperatorProcessorFactory.php b/src/qtism/runtime/expressions/operators/OperatorProcessorFactory.php index 5da2408c8..46d2b1b26 100644 --- a/src/qtism/runtime/expressions/operators/OperatorProcessorFactory.php +++ b/src/qtism/runtime/expressions/operators/OperatorProcessorFactory.php @@ -54,7 +54,7 @@ public function __construct() * @throws InvalidArgumentException If $expression is not an Operator object. * @throws RuntimeException If no relevant OperatorProcessor is found for the given $expression. */ - public function createProcessor(QtiComponent $expression, OperandsCollection $operands = null): OperatorProcessor + public function createProcessor(QtiComponent $expression, ?OperandsCollection $operands = null): OperatorProcessor { if (!($expression instanceof Operator)) { $msg = 'The OperatorProcessorFactory only accepts to create processors for Operator objects.'; diff --git a/src/qtism/runtime/processing/OutcomeProcessingEngine.php b/src/qtism/runtime/processing/OutcomeProcessingEngine.php index 4e615d9f9..3f27a33c4 100644 --- a/src/qtism/runtime/processing/OutcomeProcessingEngine.php +++ b/src/qtism/runtime/processing/OutcomeProcessingEngine.php @@ -70,7 +70,7 @@ class OutcomeProcessingEngine extends AbstractEngine * @param QtiComponent $outcomeProcessing A QTI Data Model OutcomeProcessing object. * @param State $context A State object as the execution context. */ - public function __construct(QtiComponent $outcomeProcessing, State $context = null) + public function __construct(QtiComponent $outcomeProcessing, ?State $context = null) { parent::__construct($outcomeProcessing, $context); $this->setRuleProcessorFactory(new RuleProcessorFactory()); diff --git a/src/qtism/runtime/processing/ResponseProcessingEngine.php b/src/qtism/runtime/processing/ResponseProcessingEngine.php index f546dd923..8089b450d 100644 --- a/src/qtism/runtime/processing/ResponseProcessingEngine.php +++ b/src/qtism/runtime/processing/ResponseProcessingEngine.php @@ -57,7 +57,7 @@ class ResponseProcessingEngine extends AbstractEngine * @param State $context * @throws InvalidArgumentException If $responseProcessing is not a ResponseProcessing object. */ - public function __construct(QtiComponent $responseProcessing, State $context = null) + public function __construct(QtiComponent $responseProcessing, ?State $context = null) { parent::__construct($responseProcessing, $context); diff --git a/src/qtism/runtime/processing/TemplateProcessingEngine.php b/src/qtism/runtime/processing/TemplateProcessingEngine.php index 9e2ac892d..6d82d1aaa 100644 --- a/src/qtism/runtime/processing/TemplateProcessingEngine.php +++ b/src/qtism/runtime/processing/TemplateProcessingEngine.php @@ -53,7 +53,7 @@ class TemplateProcessingEngine extends AbstractEngine * @param QtiComponent $templateProcessing A QTI Data Model TemplateProcessing object. * @param State $context A State object as the execution context. */ - public function __construct(QtiComponent $templateProcessing, State $context = null) + public function __construct(QtiComponent $templateProcessing, ?State $context = null) { parent::__construct($templateProcessing, $context); $this->setRuleProcessorFactory(new RuleProcessorFactory()); diff --git a/src/qtism/runtime/rendering/RenderingException.php b/src/qtism/runtime/rendering/RenderingException.php index 8e85616af..da9b19718 100644 --- a/src/qtism/runtime/rendering/RenderingException.php +++ b/src/qtism/runtime/rendering/RenderingException.php @@ -64,7 +64,7 @@ class RenderingException extends Exception implements QtiSdkPackageContentExcept * @param int $code A code for the client-code. * @param Exception $previous An optional previous exception. */ - public function __construct($message, $code, Exception $previous = null) + public function __construct($message, $code, ?Exception $previous = null) { parent::__construct($message, $code, $previous); } diff --git a/src/qtism/runtime/rules/RuleEngine.php b/src/qtism/runtime/rules/RuleEngine.php index 9aa4a84ae..2a125592b 100644 --- a/src/qtism/runtime/rules/RuleEngine.php +++ b/src/qtism/runtime/rules/RuleEngine.php @@ -50,7 +50,7 @@ class RuleEngine extends AbstractEngine * @param QtiComponent $rule A rule object to be executed. * @param State $context An execution context if needed. */ - public function __construct(QtiComponent $rule, State $context = null) + public function __construct(QtiComponent $rule, ?State $context = null) { parent::__construct($rule, $context); $this->setRuleProcessorFactory(new RuleProcessorFactory()); diff --git a/src/qtism/runtime/storage/binary/AbstractQtiBinaryStorage.php b/src/qtism/runtime/storage/binary/AbstractQtiBinaryStorage.php index b7d6cc19d..bcbb082c6 100644 --- a/src/qtism/runtime/storage/binary/AbstractQtiBinaryStorage.php +++ b/src/qtism/runtime/storage/binary/AbstractQtiBinaryStorage.php @@ -70,7 +70,7 @@ abstract class AbstractQtiBinaryStorage extends AbstractStorage public function __construct( AbstractSessionManager $manager, AssessmentTest $test, - QtiBinaryVersion $version = null + ?QtiBinaryVersion $version = null ) { parent::__construct($manager, $test); $seeker = new BinaryAssessmentTestSeeker($test); diff --git a/src/qtism/runtime/storage/binary/QtiBinaryStreamAccess.php b/src/qtism/runtime/storage/binary/QtiBinaryStreamAccess.php index 138d60dfc..5007821ce 100644 --- a/src/qtism/runtime/storage/binary/QtiBinaryStreamAccess.php +++ b/src/qtism/runtime/storage/binary/QtiBinaryStreamAccess.php @@ -114,7 +114,7 @@ class QtiBinaryStreamAccess extends BinaryStreamAccess public function __construct( IStream $stream, FileManager $fileManager, - VariableFactoryInterface $variableFactory = null + ?VariableFactoryInterface $variableFactory = null ) { parent::__construct($stream); $this->setFileManager($fileManager); diff --git a/src/qtism/runtime/tests/AbstractSessionManager.php b/src/qtism/runtime/tests/AbstractSessionManager.php index 1c0012431..2b0e23dd9 100644 --- a/src/qtism/runtime/tests/AbstractSessionManager.php +++ b/src/qtism/runtime/tests/AbstractSessionManager.php @@ -86,7 +86,7 @@ public function getFileManager(): FileManager * * @return AssessmentTestSession An AssessmentTestSession object. */ - public function createAssessmentTestSession(AssessmentTest $test, Route $route = null, $config = 0): AssessmentTestSession + public function createAssessmentTestSession(AssessmentTest $test, ?Route $route = null, $config = 0): AssessmentTestSession { return $this->instantiateAssessmentTestSession($test, $this->getRoute($test, $route), $config); } @@ -133,7 +133,7 @@ abstract protected function instantiateAssessmentItemSession(IAssessmentItem $as * @param Route $route * @return Route */ - protected function getRoute(AssessmentTest $test, Route $route = null): Route + protected function getRoute(AssessmentTest $test, ?Route $route = null): Route { return $route ?? $this->createRoute($test); } diff --git a/src/qtism/runtime/tests/AssessmentItemSession.php b/src/qtism/runtime/tests/AssessmentItemSession.php index 41e85bb31..157bde010 100644 --- a/src/qtism/runtime/tests/AssessmentItemSession.php +++ b/src/qtism/runtime/tests/AssessmentItemSession.php @@ -349,7 +349,7 @@ public function getItemSessionControl(): ItemSessionControl * * @param TimeLimits $timeLimits A TimeLimits object or null if no time limits must be applied. */ - public function setTimeLimits(TimeLimits $timeLimits = null): void + public function setTimeLimits(?TimeLimits $timeLimits = null): void { $this->timeLimits = $timeLimits; } @@ -767,7 +767,7 @@ public function beginAttempt(): void * @throws AssessmentItemSessionException If the time limits in force are not respected, an error occurs during response processing, a state violation occurs. * @throws PhpStorageException */ - public function endAttempt(State $responses = null, $responseProcessing = true, $forceLateSubmission = false): void + public function endAttempt(?State $responses = null, $responseProcessing = true, $forceLateSubmission = false): void { // Flag to indicate if time is exceed or not. $maxTimeExceeded = false; @@ -891,7 +891,7 @@ protected function mergeResponses(State $responses): void * @param State $responses (optional) A State object containing the responses to be stored in the item session at suspend time. * @throws AssessmentItemSessionException With code STATE_VIOLATION if the state of the session is not INTERACTING nor MODAL_FEEDBACK prior to suspension. */ - public function suspend(State $responses = null): void + public function suspend(?State $responses = null): void { $state = $this->getState(); diff --git a/src/qtism/runtime/tests/AssessmentItemSessionException.php b/src/qtism/runtime/tests/AssessmentItemSessionException.php index 28c9365c8..8660b12e2 100644 --- a/src/qtism/runtime/tests/AssessmentItemSessionException.php +++ b/src/qtism/runtime/tests/AssessmentItemSessionException.php @@ -111,7 +111,7 @@ class AssessmentItemSessionException extends Exception * @param int $code A numeric error code. The accepted error codes are described in the constants of this class. * @param Exception $previous An optional previous Exception object that was previously thrown and led to this Exception. */ - public function __construct($message, AssessmentItemSession $source, $code = AssessmentItemSessionException::UNKNOWN, Exception $previous = null) + public function __construct($message, AssessmentItemSession $source, $code = AssessmentItemSessionException::UNKNOWN, ?Exception $previous = null) { parent::__construct($message, $code, $previous); $this->setSource($source); diff --git a/src/qtism/runtime/tests/AssessmentTestSession.php b/src/qtism/runtime/tests/AssessmentTestSession.php index ea2d43af8..fc7724b6b 100644 --- a/src/qtism/runtime/tests/AssessmentTestSession.php +++ b/src/qtism/runtime/tests/AssessmentTestSession.php @@ -350,7 +350,7 @@ public function getTimeReference(): ?DateTime * * @param DateTime $timeReference */ - public function setTimeReference(DateTime $timeReference = null): void + public function setTimeReference(?DateTime $timeReference = null): void { $this->timeReference = $timeReference; } @@ -1255,7 +1255,7 @@ public function isCurrentAssessmentItemInteracting() * @param IdentifierCollection $excludeCategories The optional item categories to be excluded from the subset. * @return AssessmentItemRefCollection A collection of AssessmentItemRef objects that match all the given criteria. */ - public function getItemSubset($sectionIdentifier = '', IdentifierCollection $includeCategories = null, IdentifierCollection $excludeCategories = null): AssessmentItemRefCollection + public function getItemSubset($sectionIdentifier = '', ?IdentifierCollection $includeCategories = null, ?IdentifierCollection $excludeCategories = null): AssessmentItemRefCollection { return $this->getRoute()->getAssessmentItemRefsSubset($sectionIdentifier, $includeCategories, $excludeCategories); } @@ -2460,7 +2460,7 @@ protected function nextRouteItem($ignoreBranchings = false, $ignorePreConditions } } - public function routeMatchesPreconditions(Route $route = null): bool + public function routeMatchesPreconditions(?Route $route = null): bool { $route = $route ?? $this->getRoute(); diff --git a/src/qtism/runtime/tests/AssessmentTestSessionException.php b/src/qtism/runtime/tests/AssessmentTestSessionException.php index 2cb3c4a3e..b4ec86463 100644 --- a/src/qtism/runtime/tests/AssessmentTestSessionException.php +++ b/src/qtism/runtime/tests/AssessmentTestSessionException.php @@ -183,7 +183,7 @@ class AssessmentTestSessionException extends Exception * @param int $code A code to enable client-code to identify the error programatically. * @param Exception $previous An optional previous exception. */ - public function __construct($message, $code = 0, Exception $previous = null) + public function __construct($message, $code = 0, ?Exception $previous = null) { parent::__construct($message, $code, $previous); } diff --git a/src/qtism/runtime/tests/OrderingException.php b/src/qtism/runtime/tests/OrderingException.php index 17136a4d1..dbc8c829b 100644 --- a/src/qtism/runtime/tests/OrderingException.php +++ b/src/qtism/runtime/tests/OrderingException.php @@ -54,7 +54,7 @@ class OrderingException extends Exception * @param int $code The code that enables client-code to identify the nature of the error efficiently. * @param Exception $previous An optional previous Exception object. */ - public function __construct($message, $code = 0, Exception $previous = null) + public function __construct($message, $code = 0, ?Exception $previous = null) { parent::__construct($message, $code, $previous); } diff --git a/src/qtism/runtime/tests/Route.php b/src/qtism/runtime/tests/Route.php index e2f36f71b..280f51499 100644 --- a/src/qtism/runtime/tests/Route.php +++ b/src/qtism/runtime/tests/Route.php @@ -762,7 +762,7 @@ public function getAssessmentItemRefsBySection($sectionIdentifier): AssessmentIt * @param IdentifierCollection $excludeCategories A collection of category identifiers to be excluded from the selection. * @return AssessmentItemRefCollection A collection of filtered AssessmentItemRef objects. */ - public function getAssessmentItemRefsSubset($sectionIdentifier = '', IdentifierCollection $includeCategories = null, IdentifierCollection $excludeCategories = null): AssessmentItemRefCollection + public function getAssessmentItemRefsSubset($sectionIdentifier = '', ?IdentifierCollection $includeCategories = null, ?IdentifierCollection $excludeCategories = null): AssessmentItemRefCollection { $bySection = (empty($sectionIdentifier)) ? $this->getAssessmentItemRefs() : $this->getAssessmentItemRefsBySection($sectionIdentifier); diff --git a/src/qtism/runtime/tests/SelectionException.php b/src/qtism/runtime/tests/SelectionException.php index 9ec564b05..6c042b8c1 100644 --- a/src/qtism/runtime/tests/SelectionException.php +++ b/src/qtism/runtime/tests/SelectionException.php @@ -54,7 +54,7 @@ class SelectionException extends Exception * @param int $code The code that enables client-code to quickly identify the nature of the error. * @param Exception $previous An optional previous Exception object. */ - public function __construct($message, $code = 0, Exception $previous = null) + public function __construct($message, $code = 0, ?Exception $previous = null) { parent::__construct($message, $code, $previous); } diff --git a/src/qtism/runtime/tests/Utils.php b/src/qtism/runtime/tests/Utils.php index 28895ab82..d3b3fd59e 100644 --- a/src/qtism/runtime/tests/Utils.php +++ b/src/qtism/runtime/tests/Utils.php @@ -60,7 +60,7 @@ class Utils * @param ResponseValidityConstraint $constraint * @return bool */ - public static function isResponseValid(QtiDatatype $response = null, ResponseValidityConstraint $constraint): bool + public static function isResponseValid(?QtiDatatype $response = null, ResponseValidityConstraint $constraint): bool { $min = $constraint->getMinConstraint(); $max = $constraint->getMaxConstraint(); From c0c535e2f00799b5aa3a53da0ab710e59a88ef2d Mon Sep 17 00:00:00 2001 From: Vitalii Shtykhno Date: Thu, 20 Mar 2025 00:14:56 +0100 Subject: [PATCH 2/3] fix: deprecate notice for php 8.4 --- src/qtism/data/TimeLimits.php | 4 ++-- .../interactions/PositionObjectInteraction.php | 2 +- src/qtism/data/content/xhtml/tables/Table.php | 4 ++-- src/qtism/data/results/AssessmentResult.php | 4 ++-- src/qtism/data/results/CandidateResponse.php | 4 ++-- src/qtism/data/results/Context.php | 4 ++-- src/qtism/data/results/ItemResult.php | 4 ++-- src/qtism/data/results/ResultOutcomeVariable.php | 14 +++++++------- src/qtism/data/results/ResultResponseVariable.php | 4 ++-- src/qtism/data/results/ResultTemplateVariable.php | 2 +- src/qtism/data/results/TestResult.php | 2 +- src/qtism/data/rules/ResponseCondition.php | 2 +- src/qtism/data/state/OutcomeDeclaration.php | 2 +- src/qtism/data/state/ResponseDeclaration.php | 6 +++--- src/qtism/data/state/VariableDeclaration.php | 2 +- src/qtism/data/storage/xml/XmlStorageException.php | 2 +- src/qtism/runtime/common/OutcomeVariable.php | 2 +- src/qtism/runtime/common/ResponseVariable.php | 6 +++--- src/qtism/runtime/common/Utils.php | 2 +- src/qtism/runtime/common/Variable.php | 4 ++-- .../markup/xhtml/AssessmentItemRenderer.php | 2 +- .../markup/xhtml/AssociableHotspotRenderer.php | 2 +- .../markup/xhtml/AssociateInteractionRenderer.php | 2 +- .../markup/xhtml/ChoiceInteractionRenderer.php | 2 +- .../rendering/markup/xhtml/ChoiceRenderer.php | 2 +- .../markup/xhtml/DrawingInteractionRenderer.php | 2 +- .../markup/xhtml/EndAttemptInteractionRenderer.php | 2 +- .../xhtml/ExtendedTextInteractionRenderer.php | 2 +- .../markup/xhtml/FeedbackInlineRenderer.php | 2 +- .../markup/xhtml/GapMatchInteractionRenderer.php | 2 +- .../runtime/rendering/markup/xhtml/GapRenderer.php | 2 +- .../markup/xhtml/GraphicInteractionRenderer.php | 2 +- .../markup/xhtml/HotspotChoiceRenderer.php | 2 +- .../rendering/markup/xhtml/HottextRenderer.php | 2 +- .../xhtml/InlineChoiceInteractionRenderer.php | 2 +- .../markup/xhtml/InlineChoiceRenderer.php | 2 +- .../rendering/markup/xhtml/InteractionRenderer.php | 2 +- .../rendering/markup/xhtml/ItemBodyRenderer.php | 2 +- .../markup/xhtml/MatchInteractionRenderer.php | 2 +- .../rendering/markup/xhtml/MathRenderer.php | 2 +- .../markup/xhtml/MediaInteractionRenderer.php | 2 +- .../markup/xhtml/ModalFeedbackRenderer.php | 2 +- .../markup/xhtml/OrderInteractionRenderer.php | 2 +- .../xhtml/PositionObjectInteractionRenderer.php | 2 +- .../markup/xhtml/PositionObjectStageRenderer.php | 2 +- .../markup/xhtml/PrintedVariableRenderer.php | 2 +- .../rendering/markup/xhtml/PromptRenderer.php | 2 +- .../rendering/markup/xhtml/RubricBlockRenderer.php | 2 +- .../xhtml/SimpleAssociableChoiceRenderer.php | 2 +- .../markup/xhtml/SimpleChoiceRenderer.php | 2 +- .../markup/xhtml/SimpleMatchSetRenderer.php | 2 +- .../markup/xhtml/SliderInteractionRenderer.php | 2 +- .../rendering/markup/xhtml/SsmlSubRenderer.php | 2 +- .../rendering/markup/xhtml/StylesheetRenderer.php | 2 +- .../markup/xhtml/TextEntryInteractionRenderer.php | 2 +- .../rendering/markup/xhtml/TextRunRenderer.php | 2 +- .../markup/xhtml/UploadInteractionRenderer.php | 2 +- 57 files changed, 75 insertions(+), 75 deletions(-) diff --git a/src/qtism/data/TimeLimits.php b/src/qtism/data/TimeLimits.php index bf64db0a9..168630ca8 100644 --- a/src/qtism/data/TimeLimits.php +++ b/src/qtism/data/TimeLimits.php @@ -114,7 +114,7 @@ public function hasMinTime(): bool * * @param QtiDuration $minTime A Duration object or null if unlimited. */ - public function setMinTime(QtiDuration $minTime = null): void + public function setMinTime(?QtiDuration $minTime = null): void { // Prevent to get 0s durations stored. if ($minTime !== null && $minTime->getSeconds(true) === 0) { @@ -149,7 +149,7 @@ public function hasMaxTime(): bool * * @param QtiDuration $maxTime A duration object or null if unlimited. */ - public function setMaxTime(QtiDuration $maxTime = null): void + public function setMaxTime(?QtiDuration $maxTime = null): void { // Prevent to get 0s durations stored. if ($maxTime !== null && $maxTime->getSeconds(true) === 0) { diff --git a/src/qtism/data/content/interactions/PositionObjectInteraction.php b/src/qtism/data/content/interactions/PositionObjectInteraction.php index 52f1f1ef6..d7361f57b 100644 --- a/src/qtism/data/content/interactions/PositionObjectInteraction.php +++ b/src/qtism/data/content/interactions/PositionObjectInteraction.php @@ -119,7 +119,7 @@ public function __construct($responseIdentifier, ObjectElement $object, $id = '' * * @param QtiPoint $centerPoint A Point object or null. */ - public function setCenterPoint(QtiPoint $centerPoint = null): void + public function setCenterPoint(?QtiPoint $centerPoint = null): void { $this->centerPoint = $centerPoint; } diff --git a/src/qtism/data/content/xhtml/tables/Table.php b/src/qtism/data/content/xhtml/tables/Table.php index 31d60fc2d..99bff5333 100644 --- a/src/qtism/data/content/xhtml/tables/Table.php +++ b/src/qtism/data/content/xhtml/tables/Table.php @@ -159,7 +159,7 @@ public function hasSummary(): bool * * @param Caption $caption A Caption object or null. */ - public function setCaption(Caption $caption = null): void + public function setCaption(?Caption $caption = null): void { $this->caption = $caption; } @@ -231,7 +231,7 @@ public function getColgroups(): ColgroupCollection * * @param Thead $thead A Thead object or null. */ - public function setThead(Thead $thead = null): void + public function setThead(?Thead $thead = null): void { $this->thead = $thead; } diff --git a/src/qtism/data/results/AssessmentResult.php b/src/qtism/data/results/AssessmentResult.php index 97d2e4d3f..260bdce79 100644 --- a/src/qtism/data/results/AssessmentResult.php +++ b/src/qtism/data/results/AssessmentResult.php @@ -154,7 +154,7 @@ public function getTestResult(): ?TestResult * @param TestResult $testResult * @return $this */ - public function setTestResult(TestResult $testResult = null) + public function setTestResult(?TestResult $testResult = null) { $this->testResult = $testResult; return $this; @@ -186,7 +186,7 @@ public function getItemResults(): ?ItemResultCollection * @param ItemResultCollection|null $itemResults * @return $this */ - public function setItemResults(ItemResultCollection $itemResults = null) + public function setItemResults(?ItemResultCollection $itemResults = null) { $this->itemResults = $itemResults; return $this; diff --git a/src/qtism/data/results/CandidateResponse.php b/src/qtism/data/results/CandidateResponse.php index 48427a9e5..053422e62 100644 --- a/src/qtism/data/results/CandidateResponse.php +++ b/src/qtism/data/results/CandidateResponse.php @@ -49,7 +49,7 @@ class CandidateResponse extends QtiComponent * * @param ValueCollection|null $values */ - public function __construct(ValueCollection $values = null) + public function __construct(?ValueCollection $values = null) { $this->setValues($values); } @@ -94,7 +94,7 @@ public function getValues(): ?ValueCollection * @param ValueCollection|null $values * @return $this */ - public function setValues(ValueCollection $values = null) + public function setValues(?ValueCollection $values = null) { $this->values = $values; return $this; diff --git a/src/qtism/data/results/Context.php b/src/qtism/data/results/Context.php index f18386bd1..e6a856190 100644 --- a/src/qtism/data/results/Context.php +++ b/src/qtism/data/results/Context.php @@ -113,7 +113,7 @@ public function getSourcedId(): ?QtiIdentifier * @param QtiIdentifier $sourcedId * @return $this */ - public function setSourcedId(QtiIdentifier $sourcedId = null) + public function setSourcedId(?QtiIdentifier $sourcedId = null) { $this->sourcedId = $sourcedId; return $this; @@ -145,7 +145,7 @@ public function getSessionIdentifiers(): SessionIdentifierCollection * @param SessionIdentifierCollection $sessionIdentifiers * @return $this */ - public function setSessionIdentifiers(SessionIdentifierCollection $sessionIdentifiers = null) + public function setSessionIdentifiers(?SessionIdentifierCollection $sessionIdentifiers = null) { $this->sessionIdentifiers = $sessionIdentifiers; return $this; diff --git a/src/qtism/data/results/ItemResult.php b/src/qtism/data/results/ItemResult.php index 807e32313..04444246a 100644 --- a/src/qtism/data/results/ItemResult.php +++ b/src/qtism/data/results/ItemResult.php @@ -225,7 +225,7 @@ public function getItemVariables(): ?ItemVariableCollection * @param ItemVariableCollection $itemVariables * @return $this */ - public function setItemVariables(ItemVariableCollection $itemVariables = null): self + public function setItemVariables(?ItemVariableCollection $itemVariables = null): self { $this->itemVariables = $itemVariables; return $this; @@ -318,7 +318,7 @@ public function getCandidateComment(): ?QtiString * @param QtiString $candidateComment * @return $this */ - public function setCandidateComment(QtiString $candidateComment = null): self + public function setCandidateComment(?QtiString $candidateComment = null): self { $this->candidateComment = $candidateComment; return $this; diff --git a/src/qtism/data/results/ResultOutcomeVariable.php b/src/qtism/data/results/ResultOutcomeVariable.php index 5f70772e6..a1070cc76 100644 --- a/src/qtism/data/results/ResultOutcomeVariable.php +++ b/src/qtism/data/results/ResultOutcomeVariable.php @@ -126,7 +126,7 @@ public function __construct( $cardinality, $baseType = null, ?ValueCollection $values = null, - ?$view = null, + $view = null, ?QtiString $interpretation = null, ?QtiUri $longInterpretation = null, ?QtiFloat $normalMaximum = null, @@ -183,7 +183,7 @@ public function getValues(): ?ValueCollection * @param ValueCollection $values * @return $this */ - public function setValues(ValueCollection $values = null): self + public function setValues(?ValueCollection $values = null): self { $this->values = $values; return $this; @@ -252,7 +252,7 @@ public function getInterpretation(): ?QtiString * @param QtiString $interpretation * @return $this */ - public function setInterpretation(QtiString $interpretation = null): self + public function setInterpretation(?QtiString $interpretation = null): self { $this->interpretation = $interpretation; return $this; @@ -284,7 +284,7 @@ public function getLongInterpretation(): ?QtiUri * @param QtiUri $longInterpretation * @return $this */ - public function setLongInterpretation(QtiUri $longInterpretation = null): self + public function setLongInterpretation(?QtiUri $longInterpretation = null): self { $this->longInterpretation = $longInterpretation; return $this; @@ -316,7 +316,7 @@ public function getNormalMaximum(): ?QtiFloat * @param QtiFloat $normalMaximum * @return $this */ - public function setNormalMaximum(QtiFloat $normalMaximum = null): self + public function setNormalMaximum(?QtiFloat $normalMaximum = null): self { $this->normalMaximum = $normalMaximum; return $this; @@ -348,7 +348,7 @@ public function getNormalMinimum(): ?QtiFloat * @param QtiFloat $normalMinimum * @return $this */ - public function setNormalMinimum(QtiFloat $normalMinimum = null): self + public function setNormalMinimum(?QtiFloat $normalMinimum = null): self { $this->normalMinimum = $normalMinimum; return $this; @@ -380,7 +380,7 @@ public function getMasteryValue(): ?QtiFloat * @param QtiFloat $masteryValue * @return $this */ - public function setMasteryValue(QtiFloat $masteryValue = null): self + public function setMasteryValue(?QtiFloat $masteryValue = null): self { $this->masteryValue = $masteryValue; return $this; diff --git a/src/qtism/data/results/ResultResponseVariable.php b/src/qtism/data/results/ResultResponseVariable.php index 55cb052ee..e8817def4 100644 --- a/src/qtism/data/results/ResultResponseVariable.php +++ b/src/qtism/data/results/ResultResponseVariable.php @@ -152,7 +152,7 @@ public function getCorrectResponse(): ?CorrectResponse * @param CorrectResponse $correctResponse * @return $this */ - public function setCorrectResponse(CorrectResponse $correctResponse = null) + public function setCorrectResponse(?CorrectResponse $correctResponse = null) { $this->correctResponse = $correctResponse; return $this; @@ -184,7 +184,7 @@ public function getChoiceSequence(): ?QtiIdentifier * @param QtiIdentifier $choiceSequence * @return $this */ - public function setChoiceSequence(QtiIdentifier $choiceSequence = null) + public function setChoiceSequence(?QtiIdentifier $choiceSequence = null) { $this->choiceSequence = $choiceSequence; return $this; diff --git a/src/qtism/data/results/ResultTemplateVariable.php b/src/qtism/data/results/ResultTemplateVariable.php index 4d64e080b..24a897104 100644 --- a/src/qtism/data/results/ResultTemplateVariable.php +++ b/src/qtism/data/results/ResultTemplateVariable.php @@ -98,7 +98,7 @@ public function getValues(): ?ValueCollection * @param ValueCollection $values * @return $this */ - public function setValues(ValueCollection $values = null): self + public function setValues(?ValueCollection $values = null): self { $this->values = $values; return $this; diff --git a/src/qtism/data/results/TestResult.php b/src/qtism/data/results/TestResult.php index f3c94216c..5cb295a41 100644 --- a/src/qtism/data/results/TestResult.php +++ b/src/qtism/data/results/TestResult.php @@ -167,7 +167,7 @@ public function getItemVariables(): ?ItemVariableCollection * @param ItemVariableCollection $itemVariables * @return $this */ - public function setItemVariables(ItemVariableCollection $itemVariables = null) + public function setItemVariables(?ItemVariableCollection $itemVariables = null) { $this->itemVariables = $itemVariables; return $this; diff --git a/src/qtism/data/rules/ResponseCondition.php b/src/qtism/data/rules/ResponseCondition.php index 0455bf550..f228ac9d2 100644 --- a/src/qtism/data/rules/ResponseCondition.php +++ b/src/qtism/data/rules/ResponseCondition.php @@ -133,7 +133,7 @@ public function getResponseElse(): ?ResponseElse * * @param ResponseElse $responseElse A ResponseElse object. */ - public function setResponseElse(ResponseElse $responseElse = null): void + public function setResponseElse(?ResponseElse $responseElse = null): void { $this->responseElse = $responseElse; } diff --git a/src/qtism/data/state/OutcomeDeclaration.php b/src/qtism/data/state/OutcomeDeclaration.php index 2cccd888b..53d0bad30 100644 --- a/src/qtism/data/state/OutcomeDeclaration.php +++ b/src/qtism/data/state/OutcomeDeclaration.php @@ -343,7 +343,7 @@ public function getLookupTable(): ?LookupTable * * @param LookupTable $lookupTable A LookupTable object. */ - public function setLookupTable(LookupTable $lookupTable = null): void + public function setLookupTable(?LookupTable $lookupTable = null): void { $this->lookupTable = $lookupTable; } diff --git a/src/qtism/data/state/ResponseDeclaration.php b/src/qtism/data/state/ResponseDeclaration.php index 24b6e0c59..9a9f1be62 100644 --- a/src/qtism/data/state/ResponseDeclaration.php +++ b/src/qtism/data/state/ResponseDeclaration.php @@ -125,7 +125,7 @@ public function __construct($identifier, $baseType = -1, $cardinality = Cardinal * * @param CorrectResponse $correctResponse A CorrectResponse object or null. */ - public function setCorrectResponse(CorrectResponse $correctResponse = null): void + public function setCorrectResponse(?CorrectResponse $correctResponse = null): void { $this->correctResponse = $correctResponse; } @@ -145,7 +145,7 @@ public function getCorrectResponse(): ?CorrectResponse * * @param Mapping $mapping A Mapping object or null if no mapping is specified. */ - public function setMapping(Mapping $mapping = null): void + public function setMapping(?Mapping $mapping = null): void { $this->mapping = $mapping; } @@ -165,7 +165,7 @@ public function getMapping(): ?Mapping * * @param AreaMapping $areaMapping An AreaMapping object or null if no area mapping was specified. */ - public function setAreaMapping(AreaMapping $areaMapping = null): void + public function setAreaMapping(?AreaMapping $areaMapping = null): void { $this->areaMapping = $areaMapping; } diff --git a/src/qtism/data/state/VariableDeclaration.php b/src/qtism/data/state/VariableDeclaration.php index d61fa04d0..e590ced53 100644 --- a/src/qtism/data/state/VariableDeclaration.php +++ b/src/qtism/data/state/VariableDeclaration.php @@ -198,7 +198,7 @@ public function getDefaultValue(): ?DefaultValue * * @param DefaultValue $defaultValue A DefaultValue object. */ - public function setDefaultValue(DefaultValue $defaultValue = null): void + public function setDefaultValue(?DefaultValue $defaultValue = null): void { $this->defaultValue = $defaultValue; } diff --git a/src/qtism/data/storage/xml/XmlStorageException.php b/src/qtism/data/storage/xml/XmlStorageException.php index 7cd6da0cc..f6d5326d8 100644 --- a/src/qtism/data/storage/xml/XmlStorageException.php +++ b/src/qtism/data/storage/xml/XmlStorageException.php @@ -105,7 +105,7 @@ public static function unsupportedComponentInVersion( * * @param LibXmlErrorCollection $errors A collection of LibXMLError objects. */ - protected function setErrors(LibXmlErrorCollection $errors = null): void + protected function setErrors(?LibXmlErrorCollection $errors = null): void { $this->errors = $errors; } diff --git a/src/qtism/runtime/common/OutcomeVariable.php b/src/qtism/runtime/common/OutcomeVariable.php index d103d8fb9..666ed968b 100644 --- a/src/qtism/runtime/common/OutcomeVariable.php +++ b/src/qtism/runtime/common/OutcomeVariable.php @@ -194,7 +194,7 @@ public function getMasteryValue() * * @param LookupTable $lookupTable A QTI Data Model LookupTable object or null if not specified. */ - public function setLookupTable(LookupTable $lookupTable = null): void + public function setLookupTable(?LookupTable $lookupTable = null): void { $this->lookupTable = $lookupTable; } diff --git a/src/qtism/runtime/common/ResponseVariable.php b/src/qtism/runtime/common/ResponseVariable.php index 91d461d56..fae9f59e8 100644 --- a/src/qtism/runtime/common/ResponseVariable.php +++ b/src/qtism/runtime/common/ResponseVariable.php @@ -90,7 +90,7 @@ public function __construct($identifier, $cardinality, $baseType = -1, ?QtiDatat * @param QtiDatatype|null $correctResponse A QtiDatatype object or null. * @throws InvalidArgumentException If $correctResponse does not match baseType and/or cardinality of the variable. */ - public function setCorrectResponse(QtiDatatype $correctResponse = null): void + public function setCorrectResponse(?QtiDatatype $correctResponse = null): void { if ($correctResponse !== null && (!Utils::isBaseTypeCompliant($this->getBaseType(), $correctResponse) @@ -129,7 +129,7 @@ public function hasCorrectResponse(): bool * * @param Mapping $mapping A Mapping object from the QTI Data Model. */ - public function setMapping(Mapping $mapping = null): void + public function setMapping(?Mapping $mapping = null): void { $this->mapping = $mapping; } @@ -149,7 +149,7 @@ public function getMapping(): ?Mapping * * @param AreaMapping $areaMapping An AreaMapping object from the QTI Data Model. */ - public function setAreaMapping(AreaMapping $areaMapping = null): void + public function setAreaMapping(?AreaMapping $areaMapping = null): void { $this->areaMapping = $areaMapping; } diff --git a/src/qtism/runtime/common/Utils.php b/src/qtism/runtime/common/Utils.php index 0a7c0b257..a81983e84 100644 --- a/src/qtism/runtime/common/Utils.php +++ b/src/qtism/runtime/common/Utils.php @@ -269,7 +269,7 @@ public static function valueToRuntime($v, $baseType) * @param QtiDatatype $value * @return bool */ - public static function isNull(QtiDatatype $value = null): bool + public static function isNull(?QtiDatatype $value = null): bool { return $value === null || ($value instanceof QtiString && $value->getValue() === '') diff --git a/src/qtism/runtime/common/Variable.php b/src/qtism/runtime/common/Variable.php index b67ccd291..766991be4 100644 --- a/src/qtism/runtime/common/Variable.php +++ b/src/qtism/runtime/common/Variable.php @@ -205,7 +205,7 @@ public function getValue(): ?QtiDatatype * @param QtiDatatype|null $value A QtiDatatype object or null. * @throws InvalidArgumentException If the baseType and cardinality of $value are not compliant with the Variable. */ - public function setValue(QtiDatatype $value = null): void + public function setValue(?QtiDatatype $value = null): void { if ( !Utils::isBaseTypeCompliant($this->getBaseType(), $value) @@ -235,7 +235,7 @@ public function getDefaultValue(): ?QtiDatatype * @throws InvalidArgumentException If $defaultValue's type is not * compliant with the qti:baseType of the Variable. */ - public function setDefaultValue(QtiDatatype $defaultValue = null): void + public function setDefaultValue(?QtiDatatype $defaultValue = null): void { if (!Utils::isBaseTypeCompliant($this->getBaseType(), $defaultValue) || !Utils::isCardinalityCompliant($this->getCardinality(), $defaultValue)) { Utils::throwBaseTypeTypingError($this->getBaseType(), $defaultValue); diff --git a/src/qtism/runtime/rendering/markup/xhtml/AssessmentItemRenderer.php b/src/qtism/runtime/rendering/markup/xhtml/AssessmentItemRenderer.php index 25a94d587..8359abc1d 100644 --- a/src/qtism/runtime/rendering/markup/xhtml/AssessmentItemRenderer.php +++ b/src/qtism/runtime/rendering/markup/xhtml/AssessmentItemRenderer.php @@ -48,7 +48,7 @@ class AssessmentItemRenderer extends AbstractXhtmlRenderer * * @param AbstractMarkupRenderingEngine $renderingEngine */ - public function __construct(AbstractMarkupRenderingEngine $renderingEngine = null) + public function __construct(?AbstractMarkupRenderingEngine $renderingEngine = null) { parent::__construct($renderingEngine); $this->transform('div'); diff --git a/src/qtism/runtime/rendering/markup/xhtml/AssociableHotspotRenderer.php b/src/qtism/runtime/rendering/markup/xhtml/AssociableHotspotRenderer.php index 0d1d9a9d1..39df9ddc4 100644 --- a/src/qtism/runtime/rendering/markup/xhtml/AssociableHotspotRenderer.php +++ b/src/qtism/runtime/rendering/markup/xhtml/AssociableHotspotRenderer.php @@ -56,7 +56,7 @@ class AssociableHotspotRenderer extends HotspotRenderer * * @param AbstractMarkupRenderingEngine $renderingEngine */ - public function __construct(AbstractMarkupRenderingEngine $renderingEngine = null) + public function __construct(?AbstractMarkupRenderingEngine $renderingEngine = null) { parent::__construct($renderingEngine); $this->transform('div'); diff --git a/src/qtism/runtime/rendering/markup/xhtml/AssociateInteractionRenderer.php b/src/qtism/runtime/rendering/markup/xhtml/AssociateInteractionRenderer.php index e9d69ab83..f490a6742 100644 --- a/src/qtism/runtime/rendering/markup/xhtml/AssociateInteractionRenderer.php +++ b/src/qtism/runtime/rendering/markup/xhtml/AssociateInteractionRenderer.php @@ -46,7 +46,7 @@ class AssociateInteractionRenderer extends InteractionRenderer * * @param AbstractMarkupRenderingEngine $renderingEngine */ - public function __construct(AbstractMarkupRenderingEngine $renderingEngine = null) + public function __construct(?AbstractMarkupRenderingEngine $renderingEngine = null) { parent::__construct($renderingEngine); $this->transform('div'); diff --git a/src/qtism/runtime/rendering/markup/xhtml/ChoiceInteractionRenderer.php b/src/qtism/runtime/rendering/markup/xhtml/ChoiceInteractionRenderer.php index dfc74e219..9e163ce77 100644 --- a/src/qtism/runtime/rendering/markup/xhtml/ChoiceInteractionRenderer.php +++ b/src/qtism/runtime/rendering/markup/xhtml/ChoiceInteractionRenderer.php @@ -48,7 +48,7 @@ class ChoiceInteractionRenderer extends InteractionRenderer * * @param AbstractMarkupRenderingEngine $renderingEngine */ - public function __construct(AbstractMarkupRenderingEngine $renderingEngine = null) + public function __construct(?AbstractMarkupRenderingEngine $renderingEngine = null) { parent::__construct($renderingEngine); $this->transform('div'); diff --git a/src/qtism/runtime/rendering/markup/xhtml/ChoiceRenderer.php b/src/qtism/runtime/rendering/markup/xhtml/ChoiceRenderer.php index 8f45eb757..69a431c04 100644 --- a/src/qtism/runtime/rendering/markup/xhtml/ChoiceRenderer.php +++ b/src/qtism/runtime/rendering/markup/xhtml/ChoiceRenderer.php @@ -53,7 +53,7 @@ abstract class ChoiceRenderer extends BodyElementRenderer * * @param AbstractMarkupRenderingEngine $renderingEngine */ - public function __construct(AbstractMarkupRenderingEngine $renderingEngine = null) + public function __construct(?AbstractMarkupRenderingEngine $renderingEngine = null) { parent::__construct($renderingEngine); $this->transform('div'); diff --git a/src/qtism/runtime/rendering/markup/xhtml/DrawingInteractionRenderer.php b/src/qtism/runtime/rendering/markup/xhtml/DrawingInteractionRenderer.php index 6dd5915e0..59575ef7b 100644 --- a/src/qtism/runtime/rendering/markup/xhtml/DrawingInteractionRenderer.php +++ b/src/qtism/runtime/rendering/markup/xhtml/DrawingInteractionRenderer.php @@ -53,7 +53,7 @@ class DrawingInteractionRenderer extends InteractionRenderer * * @param AbstractMarkupRenderingEngine $renderingEngine */ - public function __construct(AbstractMarkupRenderingEngine $renderingEngine = null) + public function __construct(?AbstractMarkupRenderingEngine $renderingEngine = null) { parent::__construct($renderingEngine); $this->transform('div'); diff --git a/src/qtism/runtime/rendering/markup/xhtml/EndAttemptInteractionRenderer.php b/src/qtism/runtime/rendering/markup/xhtml/EndAttemptInteractionRenderer.php index 45abb6d70..66acf84b5 100644 --- a/src/qtism/runtime/rendering/markup/xhtml/EndAttemptInteractionRenderer.php +++ b/src/qtism/runtime/rendering/markup/xhtml/EndAttemptInteractionRenderer.php @@ -47,7 +47,7 @@ class EndAttemptInteractionRenderer extends InteractionRenderer * * @param AbstractMarkupRenderingEngine $renderingEngine */ - public function __construct(AbstractMarkupRenderingEngine $renderingEngine = null) + public function __construct(?AbstractMarkupRenderingEngine $renderingEngine = null) { parent::__construct($renderingEngine); $this->transform('button'); diff --git a/src/qtism/runtime/rendering/markup/xhtml/ExtendedTextInteractionRenderer.php b/src/qtism/runtime/rendering/markup/xhtml/ExtendedTextInteractionRenderer.php index 49250b8e6..51aaa114a 100644 --- a/src/qtism/runtime/rendering/markup/xhtml/ExtendedTextInteractionRenderer.php +++ b/src/qtism/runtime/rendering/markup/xhtml/ExtendedTextInteractionRenderer.php @@ -57,7 +57,7 @@ class ExtendedTextInteractionRenderer extends StringInteractionRenderer * * @param AbstractMarkupRenderingEngine $renderingEngine */ - public function __construct(AbstractMarkupRenderingEngine $renderingEngine = null) + public function __construct(?AbstractMarkupRenderingEngine $renderingEngine = null) { parent::__construct($renderingEngine); $this->transform('div'); diff --git a/src/qtism/runtime/rendering/markup/xhtml/FeedbackInlineRenderer.php b/src/qtism/runtime/rendering/markup/xhtml/FeedbackInlineRenderer.php index bbde73afa..965f8025b 100644 --- a/src/qtism/runtime/rendering/markup/xhtml/FeedbackInlineRenderer.php +++ b/src/qtism/runtime/rendering/markup/xhtml/FeedbackInlineRenderer.php @@ -45,7 +45,7 @@ class FeedbackInlineRenderer extends FeedbackElementRenderer * * @param AbstractMarkupRenderingEngine $renderingEngine */ - public function __construct(AbstractMarkupRenderingEngine $renderingEngine = null) + public function __construct(?AbstractMarkupRenderingEngine $renderingEngine = null) { parent::__construct($renderingEngine); $this->transform('span'); diff --git a/src/qtism/runtime/rendering/markup/xhtml/GapMatchInteractionRenderer.php b/src/qtism/runtime/rendering/markup/xhtml/GapMatchInteractionRenderer.php index f584b4100..c7e350529 100644 --- a/src/qtism/runtime/rendering/markup/xhtml/GapMatchInteractionRenderer.php +++ b/src/qtism/runtime/rendering/markup/xhtml/GapMatchInteractionRenderer.php @@ -44,7 +44,7 @@ class GapMatchInteractionRenderer extends InteractionRenderer * * @param AbstractMarkupRenderingEngine $renderingEngine */ - public function __construct(AbstractMarkupRenderingEngine $renderingEngine = null) + public function __construct(?AbstractMarkupRenderingEngine $renderingEngine = null) { parent::__construct($renderingEngine); $this->transform('div'); diff --git a/src/qtism/runtime/rendering/markup/xhtml/GapRenderer.php b/src/qtism/runtime/rendering/markup/xhtml/GapRenderer.php index f737253b2..cb6811cdc 100644 --- a/src/qtism/runtime/rendering/markup/xhtml/GapRenderer.php +++ b/src/qtism/runtime/rendering/markup/xhtml/GapRenderer.php @@ -52,7 +52,7 @@ class GapRenderer extends ChoiceRenderer * * @param AbstractMarkupRenderingEngine $renderingEngine */ - public function __construct(AbstractMarkupRenderingEngine $renderingEngine = null) + public function __construct(?AbstractMarkupRenderingEngine $renderingEngine = null) { parent::__construct($renderingEngine); $this->transform('span'); diff --git a/src/qtism/runtime/rendering/markup/xhtml/GraphicInteractionRenderer.php b/src/qtism/runtime/rendering/markup/xhtml/GraphicInteractionRenderer.php index fc8aef1c9..b99b2b61f 100644 --- a/src/qtism/runtime/rendering/markup/xhtml/GraphicInteractionRenderer.php +++ b/src/qtism/runtime/rendering/markup/xhtml/GraphicInteractionRenderer.php @@ -39,7 +39,7 @@ abstract class GraphicInteractionRenderer extends InteractionRenderer * * @param AbstractMarkupRenderingEngine $renderingEngine */ - public function __construct(AbstractMarkupRenderingEngine $renderingEngine = null) + public function __construct(?AbstractMarkupRenderingEngine $renderingEngine = null) { parent::__construct($renderingEngine); $this->transform('div'); diff --git a/src/qtism/runtime/rendering/markup/xhtml/HotspotChoiceRenderer.php b/src/qtism/runtime/rendering/markup/xhtml/HotspotChoiceRenderer.php index abc62ab6e..5483d1dac 100644 --- a/src/qtism/runtime/rendering/markup/xhtml/HotspotChoiceRenderer.php +++ b/src/qtism/runtime/rendering/markup/xhtml/HotspotChoiceRenderer.php @@ -52,7 +52,7 @@ class HotspotChoiceRenderer extends HotspotRenderer * * @param AbstractMarkupRenderingEngine $renderingEngine */ - public function __construct(AbstractMarkupRenderingEngine $renderingEngine = null) + public function __construct(?AbstractMarkupRenderingEngine $renderingEngine = null) { parent::__construct($renderingEngine); $this->transform('div'); diff --git a/src/qtism/runtime/rendering/markup/xhtml/HottextRenderer.php b/src/qtism/runtime/rendering/markup/xhtml/HottextRenderer.php index 596d0cb46..ceaac0ab2 100644 --- a/src/qtism/runtime/rendering/markup/xhtml/HottextRenderer.php +++ b/src/qtism/runtime/rendering/markup/xhtml/HottextRenderer.php @@ -50,7 +50,7 @@ class HottextRenderer extends ChoiceRenderer * * @param AbstractMarkupRenderingEngine $renderingEngine */ - public function __construct(AbstractMarkupRenderingEngine $renderingEngine = null) + public function __construct(?AbstractMarkupRenderingEngine $renderingEngine = null) { parent::__construct($renderingEngine); $this->transform('span'); diff --git a/src/qtism/runtime/rendering/markup/xhtml/InlineChoiceInteractionRenderer.php b/src/qtism/runtime/rendering/markup/xhtml/InlineChoiceInteractionRenderer.php index ca51ba098..3da2b59aa 100644 --- a/src/qtism/runtime/rendering/markup/xhtml/InlineChoiceInteractionRenderer.php +++ b/src/qtism/runtime/rendering/markup/xhtml/InlineChoiceInteractionRenderer.php @@ -46,7 +46,7 @@ class InlineChoiceInteractionRenderer extends InteractionRenderer * * @param AbstractMarkupRenderingEngine $renderingEngine */ - public function __construct(AbstractMarkupRenderingEngine $renderingEngine = null) + public function __construct(?AbstractMarkupRenderingEngine $renderingEngine = null) { parent::__construct($renderingEngine); $this->transform('select'); diff --git a/src/qtism/runtime/rendering/markup/xhtml/InlineChoiceRenderer.php b/src/qtism/runtime/rendering/markup/xhtml/InlineChoiceRenderer.php index 6957e4888..7038d2cd2 100644 --- a/src/qtism/runtime/rendering/markup/xhtml/InlineChoiceRenderer.php +++ b/src/qtism/runtime/rendering/markup/xhtml/InlineChoiceRenderer.php @@ -50,7 +50,7 @@ class InlineChoiceRenderer extends ChoiceRenderer * * @param AbstractMarkupRenderingEngine $renderingEngine */ - public function __construct(AbstractMarkupRenderingEngine $renderingEngine = null) + public function __construct(?AbstractMarkupRenderingEngine $renderingEngine = null) { parent::__construct($renderingEngine); // override 'div' transformation with a 'option' transformation. diff --git a/src/qtism/runtime/rendering/markup/xhtml/InteractionRenderer.php b/src/qtism/runtime/rendering/markup/xhtml/InteractionRenderer.php index 5d0beb3f6..da68becbc 100644 --- a/src/qtism/runtime/rendering/markup/xhtml/InteractionRenderer.php +++ b/src/qtism/runtime/rendering/markup/xhtml/InteractionRenderer.php @@ -43,7 +43,7 @@ abstract class InteractionRenderer extends BodyElementRenderer * * @param AbstractMarkupRenderingEngine $renderingEngine */ - public function __construct(AbstractMarkupRenderingEngine $renderingEngine = null) + public function __construct(?AbstractMarkupRenderingEngine $renderingEngine = null) { parent::__construct($renderingEngine); $this->transform('div'); diff --git a/src/qtism/runtime/rendering/markup/xhtml/ItemBodyRenderer.php b/src/qtism/runtime/rendering/markup/xhtml/ItemBodyRenderer.php index 8ae8b323c..9715513d3 100644 --- a/src/qtism/runtime/rendering/markup/xhtml/ItemBodyRenderer.php +++ b/src/qtism/runtime/rendering/markup/xhtml/ItemBodyRenderer.php @@ -39,7 +39,7 @@ class ItemBodyRenderer extends BodyElementRenderer * * @param AbstractMarkupRenderingEngine $renderingEngine */ - public function __construct(AbstractMarkupRenderingEngine $renderingEngine = null) + public function __construct(?AbstractMarkupRenderingEngine $renderingEngine = null) { parent::__construct($renderingEngine); $this->transform('div'); diff --git a/src/qtism/runtime/rendering/markup/xhtml/MatchInteractionRenderer.php b/src/qtism/runtime/rendering/markup/xhtml/MatchInteractionRenderer.php index eb3687067..fc5cc9187 100644 --- a/src/qtism/runtime/rendering/markup/xhtml/MatchInteractionRenderer.php +++ b/src/qtism/runtime/rendering/markup/xhtml/MatchInteractionRenderer.php @@ -48,7 +48,7 @@ class MatchInteractionRenderer extends InteractionRenderer * * @param AbstractMarkupRenderingEngine $renderingEngine */ - public function __construct(AbstractMarkupRenderingEngine $renderingEngine = null) + public function __construct(?AbstractMarkupRenderingEngine $renderingEngine = null) { parent::__construct($renderingEngine); $this->transform('div'); diff --git a/src/qtism/runtime/rendering/markup/xhtml/MathRenderer.php b/src/qtism/runtime/rendering/markup/xhtml/MathRenderer.php index 3afc8ab00..c712e1a81 100644 --- a/src/qtism/runtime/rendering/markup/xhtml/MathRenderer.php +++ b/src/qtism/runtime/rendering/markup/xhtml/MathRenderer.php @@ -46,7 +46,7 @@ class MathRenderer extends ExternalQtiComponentRenderer * @param AbstractMarkupRenderingEngine $renderingEngine * @param bool $namespaceOutput Whether to embed the resulting output into the MathML namespace. */ - public function __construct(AbstractMarkupRenderingEngine $renderingEngine = null, $namespaceOutput = true) + public function __construct(?AbstractMarkupRenderingEngine $renderingEngine = null, $namespaceOutput = true) { parent::__construct($renderingEngine); $this->setNamespaceOutput($namespaceOutput); diff --git a/src/qtism/runtime/rendering/markup/xhtml/MediaInteractionRenderer.php b/src/qtism/runtime/rendering/markup/xhtml/MediaInteractionRenderer.php index cdff11135..3a8130d95 100644 --- a/src/qtism/runtime/rendering/markup/xhtml/MediaInteractionRenderer.php +++ b/src/qtism/runtime/rendering/markup/xhtml/MediaInteractionRenderer.php @@ -131,7 +131,7 @@ protected function getImageTypes(): array * * @param AbstractMarkupRenderingEngine $renderingEngine */ - public function __construct(AbstractMarkupRenderingEngine $renderingEngine = null) + public function __construct(?AbstractMarkupRenderingEngine $renderingEngine = null) { parent::__construct($renderingEngine); $this->setVideoTypes(['video/mp4', 'video/webm', 'video/ogg']); diff --git a/src/qtism/runtime/rendering/markup/xhtml/ModalFeedbackRenderer.php b/src/qtism/runtime/rendering/markup/xhtml/ModalFeedbackRenderer.php index 824bcdc11..faf1f3bcb 100644 --- a/src/qtism/runtime/rendering/markup/xhtml/ModalFeedbackRenderer.php +++ b/src/qtism/runtime/rendering/markup/xhtml/ModalFeedbackRenderer.php @@ -46,7 +46,7 @@ class ModalFeedbackRenderer extends AbstractXhtmlRenderer * * @param AbstractMarkupRenderingEngine $renderingEngine */ - public function __construct(AbstractMarkupRenderingEngine $renderingEngine = null) + public function __construct(?AbstractMarkupRenderingEngine $renderingEngine = null) { parent::__construct($renderingEngine); $this->transform('div'); diff --git a/src/qtism/runtime/rendering/markup/xhtml/OrderInteractionRenderer.php b/src/qtism/runtime/rendering/markup/xhtml/OrderInteractionRenderer.php index 7d8479520..49055fd67 100644 --- a/src/qtism/runtime/rendering/markup/xhtml/OrderInteractionRenderer.php +++ b/src/qtism/runtime/rendering/markup/xhtml/OrderInteractionRenderer.php @@ -47,7 +47,7 @@ class OrderInteractionRenderer extends InteractionRenderer * * @param AbstractMarkupRenderingEngine $renderingEngine */ - public function __construct(AbstractMarkupRenderingEngine $renderingEngine = null) + public function __construct(?AbstractMarkupRenderingEngine $renderingEngine = null) { parent::__construct($renderingEngine); $this->transform('div'); diff --git a/src/qtism/runtime/rendering/markup/xhtml/PositionObjectInteractionRenderer.php b/src/qtism/runtime/rendering/markup/xhtml/PositionObjectInteractionRenderer.php index 0f0de3c30..7cb81fdec 100644 --- a/src/qtism/runtime/rendering/markup/xhtml/PositionObjectInteractionRenderer.php +++ b/src/qtism/runtime/rendering/markup/xhtml/PositionObjectInteractionRenderer.php @@ -45,7 +45,7 @@ class PositionObjectInteractionRenderer extends InteractionRenderer * * @param AbstractMarkupRenderingEngine $renderingEngine */ - public function __construct(AbstractMarkupRenderingEngine $renderingEngine = null) + public function __construct(?AbstractMarkupRenderingEngine $renderingEngine = null) { parent::__construct($renderingEngine); $this->transform('div'); diff --git a/src/qtism/runtime/rendering/markup/xhtml/PositionObjectStageRenderer.php b/src/qtism/runtime/rendering/markup/xhtml/PositionObjectStageRenderer.php index 7d71cd51d..41556f315 100644 --- a/src/qtism/runtime/rendering/markup/xhtml/PositionObjectStageRenderer.php +++ b/src/qtism/runtime/rendering/markup/xhtml/PositionObjectStageRenderer.php @@ -38,7 +38,7 @@ class PositionObjectStageRenderer extends AbstractXhtmlRenderer * * @param AbstractMarkupRenderingEngine $renderingEngine */ - public function __construct(AbstractMarkupRenderingEngine $renderingEngine = null) + public function __construct(?AbstractMarkupRenderingEngine $renderingEngine = null) { parent::__construct($renderingEngine); $this->transform('div'); diff --git a/src/qtism/runtime/rendering/markup/xhtml/PrintedVariableRenderer.php b/src/qtism/runtime/rendering/markup/xhtml/PrintedVariableRenderer.php index 2d0867d6e..7912acc38 100644 --- a/src/qtism/runtime/rendering/markup/xhtml/PrintedVariableRenderer.php +++ b/src/qtism/runtime/rendering/markup/xhtml/PrintedVariableRenderer.php @@ -50,7 +50,7 @@ class PrintedVariableRenderer extends BodyElementRenderer * * @param AbstractMarkupRenderingEngine $renderingEngine */ - public function __construct(AbstractMarkupRenderingEngine $renderingEngine = null) + public function __construct(?AbstractMarkupRenderingEngine $renderingEngine = null) { parent::__construct($renderingEngine); $this->transform('span'); diff --git a/src/qtism/runtime/rendering/markup/xhtml/PromptRenderer.php b/src/qtism/runtime/rendering/markup/xhtml/PromptRenderer.php index 86c617646..1cb4c4b47 100644 --- a/src/qtism/runtime/rendering/markup/xhtml/PromptRenderer.php +++ b/src/qtism/runtime/rendering/markup/xhtml/PromptRenderer.php @@ -39,7 +39,7 @@ class PromptRenderer extends BodyElementRenderer * * @param AbstractMarkupRenderingEngine $renderingEngine */ - public function __construct(AbstractMarkupRenderingEngine $renderingEngine = null) + public function __construct(?AbstractMarkupRenderingEngine $renderingEngine = null) { parent::__construct($renderingEngine); $this->transform('p'); diff --git a/src/qtism/runtime/rendering/markup/xhtml/RubricBlockRenderer.php b/src/qtism/runtime/rendering/markup/xhtml/RubricBlockRenderer.php index b97f3e9f5..cf0171731 100644 --- a/src/qtism/runtime/rendering/markup/xhtml/RubricBlockRenderer.php +++ b/src/qtism/runtime/rendering/markup/xhtml/RubricBlockRenderer.php @@ -47,7 +47,7 @@ class RubricBlockRenderer extends BodyElementRenderer * * @param AbstractMarkupRenderingEngine $renderingEngine */ - public function __construct(AbstractMarkupRenderingEngine $renderingEngine = null) + public function __construct(?AbstractMarkupRenderingEngine $renderingEngine = null) { parent::__construct($renderingEngine); $this->transform('div'); diff --git a/src/qtism/runtime/rendering/markup/xhtml/SimpleAssociableChoiceRenderer.php b/src/qtism/runtime/rendering/markup/xhtml/SimpleAssociableChoiceRenderer.php index 76e035948..2d6281b8c 100644 --- a/src/qtism/runtime/rendering/markup/xhtml/SimpleAssociableChoiceRenderer.php +++ b/src/qtism/runtime/rendering/markup/xhtml/SimpleAssociableChoiceRenderer.php @@ -53,7 +53,7 @@ class SimpleAssociableChoiceRenderer extends ChoiceRenderer * * @param AbstractMarkupRenderingEngine|null $renderingEngine */ - public function __construct(AbstractMarkupRenderingEngine $renderingEngine = null) + public function __construct(?AbstractMarkupRenderingEngine $renderingEngine = null) { parent::__construct($renderingEngine); $this->transform('li'); diff --git a/src/qtism/runtime/rendering/markup/xhtml/SimpleChoiceRenderer.php b/src/qtism/runtime/rendering/markup/xhtml/SimpleChoiceRenderer.php index c4f4a09d7..17764e10d 100644 --- a/src/qtism/runtime/rendering/markup/xhtml/SimpleChoiceRenderer.php +++ b/src/qtism/runtime/rendering/markup/xhtml/SimpleChoiceRenderer.php @@ -50,7 +50,7 @@ class SimpleChoiceRenderer extends ChoiceRenderer * * @param AbstractMarkupRenderingEngine|null $renderingEngine */ - public function __construct(AbstractMarkupRenderingEngine $renderingEngine = null) + public function __construct(?AbstractMarkupRenderingEngine $renderingEngine = null) { parent::__construct($renderingEngine); $this->transform('li'); diff --git a/src/qtism/runtime/rendering/markup/xhtml/SimpleMatchSetRenderer.php b/src/qtism/runtime/rendering/markup/xhtml/SimpleMatchSetRenderer.php index 31f24a524..a9bbbbf08 100644 --- a/src/qtism/runtime/rendering/markup/xhtml/SimpleMatchSetRenderer.php +++ b/src/qtism/runtime/rendering/markup/xhtml/SimpleMatchSetRenderer.php @@ -38,7 +38,7 @@ class SimpleMatchSetRenderer extends AbstractXhtmlRenderer * * @param AbstractMarkupRenderingEngine $renderingEngine */ - public function __construct(AbstractMarkupRenderingEngine $renderingEngine = null) + public function __construct(?AbstractMarkupRenderingEngine $renderingEngine = null) { parent::__construct($renderingEngine); $this->transform('div'); diff --git a/src/qtism/runtime/rendering/markup/xhtml/SliderInteractionRenderer.php b/src/qtism/runtime/rendering/markup/xhtml/SliderInteractionRenderer.php index ddf46a09b..5387e4185 100644 --- a/src/qtism/runtime/rendering/markup/xhtml/SliderInteractionRenderer.php +++ b/src/qtism/runtime/rendering/markup/xhtml/SliderInteractionRenderer.php @@ -56,7 +56,7 @@ class SliderInteractionRenderer extends InteractionRenderer * * @param AbstractMarkupRenderingEngine $renderingEngine */ - public function __construct(AbstractMarkupRenderingEngine $renderingEngine = null) + public function __construct(?AbstractMarkupRenderingEngine $renderingEngine = null) { parent::__construct($renderingEngine); $this->transform('div'); diff --git a/src/qtism/runtime/rendering/markup/xhtml/SsmlSubRenderer.php b/src/qtism/runtime/rendering/markup/xhtml/SsmlSubRenderer.php index 2b3ad9d7c..84c9d8e3f 100644 --- a/src/qtism/runtime/rendering/markup/xhtml/SsmlSubRenderer.php +++ b/src/qtism/runtime/rendering/markup/xhtml/SsmlSubRenderer.php @@ -40,7 +40,7 @@ class SsmlSubRenderer extends ExternalQtiComponentRenderer * * @param AbstractMarkupRenderingEngine $renderingEngine */ - public function __construct(AbstractMarkupRenderingEngine $renderingEngine = null) + public function __construct(?AbstractMarkupRenderingEngine $renderingEngine = null) { parent::__construct($renderingEngine); } diff --git a/src/qtism/runtime/rendering/markup/xhtml/StylesheetRenderer.php b/src/qtism/runtime/rendering/markup/xhtml/StylesheetRenderer.php index 6c25029dc..78d3b843d 100644 --- a/src/qtism/runtime/rendering/markup/xhtml/StylesheetRenderer.php +++ b/src/qtism/runtime/rendering/markup/xhtml/StylesheetRenderer.php @@ -37,7 +37,7 @@ class StylesheetRenderer extends AbstractXhtmlRenderer * * @param AbstractMarkupRenderingEngine $renderingEngine */ - public function __construct(AbstractMarkupRenderingEngine $renderingEngine = null) + public function __construct(?AbstractMarkupRenderingEngine $renderingEngine = null) { parent::__construct($renderingEngine); $this->transform('link'); diff --git a/src/qtism/runtime/rendering/markup/xhtml/TextEntryInteractionRenderer.php b/src/qtism/runtime/rendering/markup/xhtml/TextEntryInteractionRenderer.php index 40e3f1f03..0dab2410e 100644 --- a/src/qtism/runtime/rendering/markup/xhtml/TextEntryInteractionRenderer.php +++ b/src/qtism/runtime/rendering/markup/xhtml/TextEntryInteractionRenderer.php @@ -48,7 +48,7 @@ class TextEntryInteractionRenderer extends StringInteractionRenderer * * @param AbstractMarkupRenderingEngine $renderingEngine */ - public function __construct(AbstractMarkupRenderingEngine $renderingEngine = null) + public function __construct(?AbstractMarkupRenderingEngine $renderingEngine = null) { parent::__construct($renderingEngine); $this->transform('input'); diff --git a/src/qtism/runtime/rendering/markup/xhtml/TextRunRenderer.php b/src/qtism/runtime/rendering/markup/xhtml/TextRunRenderer.php index 2e5813476..40bc65b5f 100644 --- a/src/qtism/runtime/rendering/markup/xhtml/TextRunRenderer.php +++ b/src/qtism/runtime/rendering/markup/xhtml/TextRunRenderer.php @@ -37,7 +37,7 @@ class TextRunRenderer extends AbstractXhtmlRenderer * * @param AbstractMarkupRenderingEngine $renderingEngine */ - public function __construct(AbstractMarkupRenderingEngine $renderingEngine = null) + public function __construct(?AbstractMarkupRenderingEngine $renderingEngine = null) { parent::__construct($renderingEngine); } diff --git a/src/qtism/runtime/rendering/markup/xhtml/UploadInteractionRenderer.php b/src/qtism/runtime/rendering/markup/xhtml/UploadInteractionRenderer.php index 5b5b3e6ce..2712d2171 100644 --- a/src/qtism/runtime/rendering/markup/xhtml/UploadInteractionRenderer.php +++ b/src/qtism/runtime/rendering/markup/xhtml/UploadInteractionRenderer.php @@ -46,7 +46,7 @@ class UploadInteractionRenderer extends InteractionRenderer * * @param AbstractMarkupRenderingEngine $renderingEngine */ - public function __construct(AbstractMarkupRenderingEngine $renderingEngine = null) + public function __construct(?AbstractMarkupRenderingEngine $renderingEngine = null) { parent::__construct($renderingEngine); $this->transform('div'); From 32a8870b1d9c1b670f68565c519c6ceefb141c96 Mon Sep 17 00:00:00 2001 From: Vitalii Shtykhno Date: Thu, 20 Mar 2025 00:15:13 +0100 Subject: [PATCH 3/3] fix: deprecate notice for php 8.4 --- .../storage/xml/XmlAssessmentSectionDocumentTest.php | 2 +- .../storage/xml/XmlCompactAssessmentDocumentTest.php | 2 +- test/qtismtest/runtime/common/RuntimeUtilsTest.php | 4 ++-- .../operators/StatsOperatorProcessorTest.php | 10 +++++----- .../runtime/pci/json/JsonUnmarshallerTest.php | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/test/qtismtest/data/storage/xml/XmlAssessmentSectionDocumentTest.php b/test/qtismtest/data/storage/xml/XmlAssessmentSectionDocumentTest.php index a4594759f..1ccba1dd6 100644 --- a/test/qtismtest/data/storage/xml/XmlAssessmentSectionDocumentTest.php +++ b/test/qtismtest/data/storage/xml/XmlAssessmentSectionDocumentTest.php @@ -20,7 +20,7 @@ class XmlAssessmentSectionDocumentTest extends QtiSmTestCase * @param AssessmentSection|null $assessmentSection * @throws XmlStorageException */ - public function testLoad(AssessmentSection $assessmentSection = null): void + public function testLoad(?AssessmentSection $assessmentSection = null): void { if (empty($assessmentSection)) { $uri = self::samplesDir() . 'custom/standalone_assessmentsection.xml'; diff --git a/test/qtismtest/data/storage/xml/XmlCompactAssessmentDocumentTest.php b/test/qtismtest/data/storage/xml/XmlCompactAssessmentDocumentTest.php index e7d47aeb6..fc56104ac 100644 --- a/test/qtismtest/data/storage/xml/XmlCompactAssessmentDocumentTest.php +++ b/test/qtismtest/data/storage/xml/XmlCompactAssessmentDocumentTest.php @@ -28,7 +28,7 @@ class XmlCompactAssessmentDocumentTest extends QtiSmTestCase * @param XmlCompactDocument|null $doc * @throws XmlStorageException */ - public function testLoad(XmlCompactDocument $doc = null): void + public function testLoad(?XmlCompactDocument $doc = null): void { if ($doc === null) { $doc = new XmlCompactDocument('2.1'); diff --git a/test/qtismtest/runtime/common/RuntimeUtilsTest.php b/test/qtismtest/runtime/common/RuntimeUtilsTest.php index 0081aa5dc..c6b003088 100644 --- a/test/qtismtest/runtime/common/RuntimeUtilsTest.php +++ b/test/qtismtest/runtime/common/RuntimeUtilsTest.php @@ -64,7 +64,7 @@ public function testIsValidVariableIdentifier($string, $expected): void * @param QtiDatatype $value * @param bool $expected */ - public function testIsNull(QtiDatatype $value = null, $expected): void + public function testIsNull(?QtiDatatype $value = null, $expected): void { $this::assertSame($expected, Utils::isNull($value)); } @@ -76,7 +76,7 @@ public function testIsNull(QtiDatatype $value = null, $expected): void * @param QtiDatatype $b * @param bool $expected */ - public function testEquals(QtiDatatype $a = null, QtiDatatype $b = null, $expected): void + public function testEquals(?QtiDatatype $a = null, ?QtiDatatype $b = null, $expected): void { $this::assertSame($expected, Utils::equals($a, $b)); } diff --git a/test/qtismtest/runtime/expressions/operators/StatsOperatorProcessorTest.php b/test/qtismtest/runtime/expressions/operators/StatsOperatorProcessorTest.php index 12e917f29..19905122a 100644 --- a/test/qtismtest/runtime/expressions/operators/StatsOperatorProcessorTest.php +++ b/test/qtismtest/runtime/expressions/operators/StatsOperatorProcessorTest.php @@ -31,7 +31,7 @@ class StatsOperatorProcessorTest extends QtiSmTestCase * @param float|null $expected * @throws MarshallerNotFoundException */ - public function testMean(Container $container = null, $expected): void + public function testMean(?Container $container = null, $expected): void { $expression = $this->createFakeExpression(Statistics::MEAN); $operands = new OperandsCollection([$container]); @@ -46,7 +46,7 @@ public function testMean(Container $container = null, $expected): void * @param float|null $expected * @throws MarshallerNotFoundException */ - public function testSampleVariance(Container $container = null, $expected): void + public function testSampleVariance(?Container $container = null, $expected): void { $expression = $this->createFakeExpression(Statistics::SAMPLE_VARIANCE); $operands = new OperandsCollection([$container]); @@ -61,7 +61,7 @@ public function testSampleVariance(Container $container = null, $expected): void * @param float|null $expected * @throws MarshallerNotFoundException */ - public function testSampleSD(Container $container = null, $expected): void + public function testSampleSD(?Container $container = null, $expected): void { $expression = $this->createFakeExpression(Statistics::SAMPLE_SD); $operands = new OperandsCollection([$container]); @@ -76,7 +76,7 @@ public function testSampleSD(Container $container = null, $expected): void * @param float|null $expected * @throws MarshallerNotFoundException */ - public function testPopVariance(Container $container = null, $expected): void + public function testPopVariance(?Container $container = null, $expected): void { $expression = $this->createFakeExpression(Statistics::POP_VARIANCE); $operands = new OperandsCollection([$container]); @@ -91,7 +91,7 @@ public function testPopVariance(Container $container = null, $expected): void * @param float|null $expected * @throws MarshallerNotFoundException */ - public function testPopSD(Container $container = null, $expected): void + public function testPopSD(?Container $container = null, $expected): void { $expression = $this->createFakeExpression(Statistics::POP_SD); $operands = new OperandsCollection([$container]); diff --git a/test/qtismtest/runtime/pci/json/JsonUnmarshallerTest.php b/test/qtismtest/runtime/pci/json/JsonUnmarshallerTest.php index aa812810d..ba782b3db 100644 --- a/test/qtismtest/runtime/pci/json/JsonUnmarshallerTest.php +++ b/test/qtismtest/runtime/pci/json/JsonUnmarshallerTest.php @@ -48,7 +48,7 @@ protected static function createUnmarshaller(): Unmarshaller * @throws UnmarshallingException * @throws FileManagerException */ - public function testUnmarshallScalar(QtiScalar $expectedScalar = null, $json): void + public function testUnmarshallScalar(?QtiScalar $expectedScalar = null, $json): void { $unmarshaller = self::createUnmarshaller(); if ($expectedScalar !== null) {