Skip to content

Commit

Permalink
Resolve PHP8.4 implicity marked nullable parameter deprecation
Browse files Browse the repository at this point in the history
  • Loading branch information
bobvandevijver committed Jan 17, 2025
1 parent 61d842d commit a28f5a4
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions src/Exception/LatexParseException.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function getExtendedMessage(): string
* Try to find useful information on the error that has occurred
* This is stored in the object properties $filteredLogSource and $filteredTexSource
*/
protected function findErrors(array $errorOutput, ?string $texLocation = NULL): void
protected function findErrors(array $errorOutput, ?string $texLocation = null): void
{
$refWarning = strtolower('LaTeX Warning: Reference');
$filteredErrors = [];
Expand Down Expand Up @@ -103,7 +103,7 @@ protected function findErrors(array $errorOutput, ?string $texLocation = NULL):
// Try to find matching tex lines
// Check if a line number can be found in the errors
$this->filteredTexSource[] = '---';
if ($texLocation !== NULL) {
if ($texLocation !== null) {
$lineNumber = [];
$texFile = new \SplFileObject($texLocation);
foreach ($this->filteredLogSource as $logLine) {
Expand Down
6 changes: 3 additions & 3 deletions src/Generator/LatexGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,13 @@ public function generate(LatexBaseInterface $latex): string {
* @throws RuntimeError
* @throws SyntaxError
*/
public function generateLatex(LatexBaseInterface $latex = NULL): string {
public function generateLatex(?LatexBaseInterface $latex = null): string {

if ($this->latex === NULL && $latex === NULL) {
if ($this->latex === null && $latex === null) {
throw new LatexException("No latex file given");
}

if ($latex === NULL) {
if ($latex === null) {
$latex = $this->latex;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Generator/LatexGeneratorInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function generate(LatexBaseInterface $latex): string;
*
* @return string Location of the generated LaTeX file
*/
public function generateLatex(LatexBaseInterface $latex = null): string;
public function generateLatex(?LatexBaseInterface $latex = null): string;

/**
* Generates a PDF from a given LaTeX location
Expand Down
4 changes: 2 additions & 2 deletions src/Generator/LockedLatexGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function __construct(private readonly LatexGeneratorInterface $generator)
* Acquires a generation lock for PDF generation. This is required before using any method.
*/
public function acquireLock(): LatexGeneratorInterface {
if ($this->lock === NULL) {
if ($this->lock === null) {
$this->lock = $this->lockFactory->createLock(self::class, $this->timeout);
}
$this->lock->acquire(true);
Expand Down Expand Up @@ -69,7 +69,7 @@ public function generate(LatexBaseInterface $latex): string {
return $this->generator->generate($latex);
}

public function generateLatex(LatexBaseInterface $latex = null): string {
public function generateLatex(?LatexBaseInterface $latex = null): string {
$this->ensureLock();

return $this->generator->generateLatex($latex);
Expand Down
4 changes: 2 additions & 2 deletions src/Helper/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function __construct() {
* @param bool $removeGreek If set, any greek character will be replaced by their LaTeX math equivalent (default false)
*/
public function parseText(?string $text, bool $checkTable = true, bool $removeLatex = false, bool $parseNewLines = false, bool $removeGreek = false): string {
if ($text === NULL || $text === '') {
if ($text === null || $text === '') {
return '';
}

Expand Down Expand Up @@ -231,7 +231,7 @@ public function parseText(?string $text, bool $checkTable = true, bool $removeLa
* Parse the html input and create latex code of it
*/
public static function parseHtml(?string $text): ?string {
if ($text === NULL || $text === '') {
if ($text === null || $text === '') {
// BC compatible return value
return "\n\n";
}
Expand Down
10 changes: 5 additions & 5 deletions src/Latex/Element/LongTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ public function __construct(array $rows = [])
// Define defaults
$this->template = '@BobvLatex/Element/longtable.tex.twig';
$this->params = [
'caption' => NULL,
'firsthead' => NULL,
'head' => NULL,
'foot' => NULL,
'lastfoot' => NULL,
'caption' => null,
'firsthead' => null,
'head' => null,
'foot' => null,
'lastfoot' => null,
'rows' => $rows,
'data' => [],
'extra_commands' => [],
Expand Down
10 changes: 5 additions & 5 deletions src/Resources/doc/element/longtable.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ new LongTable($rows)
### Params

```
'caption' => NULL,
'firsthead' => NULL,
'head' => NULL,
'foot' => NULL,
'lastfoot' => NULL,
'caption' => null,
'firsthead' => null,
'head' => null,
'foot' => null,
'lastfoot' => null,
'rows' => $rows,
'data' => array(),
'extra_commands' => array(),
Expand Down

0 comments on commit a28f5a4

Please sign in to comment.