Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/CodePatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class CodePatcher
* @param LoggerInterface $logger
* @param Patch|null $defaultPatch
*/
public function __construct(Parser $parser, Standard $printer, LoggerInterface $logger, Patch $defaultPatch = null)
public function __construct(Parser $parser, Standard $printer, LoggerInterface $logger, ?Patch $defaultPatch = null)
{
$this->parser = $parser;
$this->printer = $printer;
Expand Down
2 changes: 1 addition & 1 deletion src/CommandRouter.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public function addCommand(CommandDefinition $c): void
* @return int
* @throws CliRouteNotExistsException
*/
public function route(array $args = null): int
public function route(?array $args = null): int
{
if (null === $args) {
$args = $_SERVER['argv'] ?? [];
Expand Down
6 changes: 3 additions & 3 deletions src/ExerciseRunner/Context/TestContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ class TestContext extends ExecutionContext
private bool $referenceSolutionDirWasCreated = false;

public function __construct(
ExerciseInterface $exercise = null,
Input $input = null,
string $studentDirectory = null,
?ExerciseInterface $exercise = null,
?Input $input = null,
?string $studentDirectory = null,
) {
$this->exercise = $exercise ?? new MockExercise();

Expand Down
2 changes: 1 addition & 1 deletion src/Factory/ResultRendererFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class ResultRendererFactory
* @param class-string $rendererClass
* @param callable|null $factory
*/
public function registerRenderer(string $resultClass, string $rendererClass, callable $factory = null): void
public function registerRenderer(string $resultClass, string $rendererClass, ?callable $factory = null): void
{
if (!$this->isImplementationNameOfClass($resultClass, ResultInterface::class)) {
throw new InvalidArgumentException();
Expand Down
2 changes: 1 addition & 1 deletion src/Patch/WrapInTryCatch.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class WrapInTryCatch implements Transformer
* @param string $exceptionClass
* @param array<Stmt>|null $statements
*/
public function __construct(string $exceptionClass = \Exception::class, array $statements = null)
public function __construct(string $exceptionClass = \Exception::class, ?array $statements = null)
{
$this->exceptionClass = $exceptionClass;
$this->statements = $statements ?: [
Expand Down
2 changes: 1 addition & 1 deletion src/Process/DockerProcessFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public function __construct(
string $basePath,
string $projectName,
string $composerCacheDir,
ExecutableFinder $executableFinder = null,
?ExecutableFinder $executableFinder = null,
) {
$this->executableFinder = $executableFinder ?? new ExecutableFinder();
$this->basePath = $basePath;
Expand Down
2 changes: 1 addition & 1 deletion src/Process/HostProcessFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ final class HostProcessFactory implements ProcessFactory
{
private ExecutableFinder $executableFinder;

public function __construct(ExecutableFinder $executableFinder = null)
public function __construct(?ExecutableFinder $executableFinder = null)
{
$this->executableFinder = $executableFinder ?? new ExecutableFinder();
}
Expand Down
4 changes: 2 additions & 2 deletions src/Result/Cgi/GenericFailure.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class GenericFailure extends Failure implements FailureInterface
* @param RequestInterface $request The request that caused the failure.
* @param string|null $reason
*/
public function __construct(RequestInterface $request, string $reason = null)
public function __construct(RequestInterface $request, ?string $reason = null)
{
$this->request = $request;
parent::__construct(self::$name, $reason);
Expand All @@ -40,7 +40,7 @@ public function __construct(RequestInterface $request, string $reason = null)
* @param string|null $reason The reason (if any) of the failure.
* @return self The result.
*/
public static function fromRequestAndReason(RequestInterface $request, string $reason = null): self
public static function fromRequestAndReason(RequestInterface $request, ?string $reason = null): self
{
return new self($request, $reason);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Result/Cli/GenericFailure.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class GenericFailure extends Failure implements FailureInterface
* @param ArrayObject<int, string> $args The arguments that caused the failure.
* @param string|null $reason The reason (if any) of the failure.
*/
public function __construct(ArrayObject $args, string $reason = null)
public function __construct(ArrayObject $args, ?string $reason = null)
{
$this->args = $args;
parent::__construct(self::$name, $reason);
Expand All @@ -40,7 +40,7 @@ public function __construct(ArrayObject $args, string $reason = null)
* @param string|null $reason The reason (if any) of the failure.
* @return self The result.
*/
public static function fromArgsAndReason(ArrayObject $args, string $reason = null): self
public static function fromArgsAndReason(ArrayObject $args, ?string $reason = null): self
{
return new self($args, $reason);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Result/ComposerFailure.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class ComposerFailure implements FailureInterface
* @param CheckInterface $check The check that produced this result.
* @param array<string> $missingPackages
*/
public function __construct(CheckInterface $check, string $missingComponent = null, array $missingPackages = [])
public function __construct(CheckInterface $check, ?string $missingComponent = null, array $missingPackages = [])
{
$this->check = $check;
$this->missingPackages = $missingPackages;
Expand Down
6 changes: 3 additions & 3 deletions src/Result/Failure.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Failure implements FailureInterface
* @param string $name The name of the check that produced this result.
* @param string|null $reason The reason (if any) of the failure.
*/
public function __construct(string $name, string $reason = null)
public function __construct(string $name, ?string $reason = null)
{
$this->name = $name;
$this->reason = $reason;
Expand All @@ -43,7 +43,7 @@ public function __construct(string $name, string $reason = null)
* @param string|null $reason The reason (if any) of the failure.
* @return self The result.
*/
public static function fromNameAndReason(string $name, string $reason = null): self
public static function fromNameAndReason(string $name, ?string $reason = null): self
{
return new self($name, $reason);
}
Expand All @@ -55,7 +55,7 @@ public static function fromNameAndReason(string $name, string $reason = null): s
* @param string|null $reason The reason (if any) of the failure.
* @return self The result.
*/
public static function fromCheckAndReason(CheckInterface $check, string $reason = null): self
public static function fromCheckAndReason(CheckInterface $check, ?string $reason = null): self
{
return new self($check->getName(), $reason);
}
Expand Down
2 changes: 1 addition & 1 deletion src/UserState/UserState.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class UserState
* @param array<string> $completedExercises An array of exercise names.
* @param string|null $currentExercise Can be null in-case the student did not start an exercise yet.
*/
public function __construct(array $completedExercises = [], string $currentExercise = null)
public function __construct(array $completedExercises = [], ?string $currentExercise = null)
{
$this->currentExercise = $currentExercise;
$this->completedExercises = $completedExercises;
Expand Down
2 changes: 0 additions & 2 deletions test/ApplicationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,8 @@ public function testEventListenersFromLocalAndWorkshopConfigAreMerged(): void
$app = new Application('Test App', $localFile);

$rm = new \ReflectionMethod($app, 'getContainer');
$rm->setAccessible(true);

$rp = new \ReflectionProperty(Application::class, 'frameworkConfigLocation');
$rp->setAccessible(true);
$rp->setValue($app, $frameworkFile);

$container = $rm->invoke($app, false);
Expand Down
2 changes: 1 addition & 1 deletion test/BaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function getTemporaryDirectory(): string
return $this->tempDirectory;
}

public function getTemporaryFile(string $filename, string $content = null): string
public function getTemporaryFile(string $filename, ?string $content = null): string
{
$file = Path::join($this->getTemporaryDirectory(), $filename);

Expand Down
1 change: 0 additions & 1 deletion test/Check/DatabaseCheckTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ public function testIfPDOThrowsExceptionItCleansUp(): void
$eventDispatcher = new EventDispatcher(new ResultAggregator());

$refProp = new ReflectionProperty(DatabaseCheck::class, 'userDsn');
$refProp->setAccessible(true);
$refProp->setValue($this->check, 'notvaliddsn');

try {
Expand Down
1 change: 0 additions & 1 deletion test/Exception/InvalidArgumentExceptionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ public function testExceptionFromMissingImplements(): void
public function testStringify($value, string $expected): void
{
$rM = new \ReflectionMethod(InvalidArgumentException::class, 'stringify');
$rM->setAccessible(true);

$this->assertEquals($rM->invoke(null, $value), $expected);
}
Expand Down
Loading