Compare commits

...

8 Commits

9 changed files with 57 additions and 23 deletions

View File

@ -6,9 +6,6 @@
<Configuration>
<option name="path" value="$PROJECT_DIR$/tests" />
</Configuration>
<Configuration>
<option name="path" value="$PROJECT_DIR$/tests" />
</Configuration>
</list>
</option>
</component>

View File

@ -42,6 +42,10 @@
<path value="$PROJECT_DIR$/vendor/sebastian/code-unit" />
<path value="$PROJECT_DIR$/vendor/sebastian/code-unit-reverse-lookup" />
<path value="$PROJECT_DIR$/vendor/theseer/tokenizer" />
<path value="$PROJECT_DIR$/vendor/mur/tests" />
<path value="$PROJECT_DIR$/vendor/symfony/deprecation-contracts" />
<path value="$PROJECT_DIR$/vendor/symfony/yaml" />
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-ctype" />
</include_path>
</component>
<component name="PhpProjectSharedConfiguration" php_language_level="7.4" />

View File

@ -5,9 +5,6 @@
<PhpSpecSuiteConfiguration>
<option name="myPath" value="$PROJECT_DIR$" />
</PhpSpecSuiteConfiguration>
<PhpSpecSuiteConfiguration>
<option name="myPath" value="$PROJECT_DIR$" />
</PhpSpecSuiteConfiguration>
</suites>
</component>
</project>

View File

@ -4,5 +4,5 @@
RUNPHP=
# Si RUNPHP n'est pas défini, les variables suivantes peuvent être définies
DIST=d11
DIST=d12
#REGISTRY=pubdocker.univ-reunion.fr

32
_merge2php82 Executable file
View File

@ -0,0 +1,32 @@
#!/bin/bash
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
mydir="$(cd "$(dirname -- "$0")"; pwd)"
myself="$mydir/$(basename -- "$0")"
cwd="$(pwd)"
if [ "$mydir" == "$cwd" -o "${mydir#$cwd/}" != "$mydir" ]; then
cp "$myself" /tmp/merge2php82.sh
exec /tmp/merge2php82.sh "$mydir" "$mydir"
else
nulibdir="${2:-$mydir}"
source "$nulibdir/load.sh" || exit 1
fi
args=(
"description"
#"usage"
)
parse_args "$@"; set -- "${args[@]}"
projdir="${1:-.}"
cd "$projdir" || die
edebug "mydir=$mydir, nulibdir=$nulibdir, projdir=$projdir"
git checkout php82
git rebase master ||
die "Le rebase automatique a échoué. Après avoir résolu les conflits, faire
git checkout master
pp -af
"
git checkout master
pp -af

View File

@ -15,12 +15,12 @@
}
},
"require": {
"symfony/yaml": "^5.0",
"symfony/yaml": "^7.1",
"ext-json": "*",
"php": "^7.4"
"php": "^8.2"
},
"require-dev": {
"nulib/tests": "7.4",
"nulib/tests": "8.2",
"ext-posix": "*",
"ext-pcntl": "*",
"ext-curl": "*"

View File

@ -17,7 +17,7 @@ class CsvBuilder extends AbstractBuilder {
parent::__construct($output, $params);
}
protected function _write(array $row): void {
protected function _write(array $row, ?array $colsStyle=null, ?array $rowStyle=null): void {
$this->fputcsv($row);
}

View File

@ -33,6 +33,7 @@ abstract class AbstractBuilder extends TempStream implements IBuilder {
$rows = $params["rows"] ?? null;
if (is_callable($rows)) $rows = $rows();
$this->rows = $rows;
$this->index = 0;
$cookFunc = $params["cook_func"] ?? null;
$cookCtx = $cookArgs = null;
if ($cookFunc !== null) {
@ -55,6 +56,8 @@ abstract class AbstractBuilder extends TempStream implements IBuilder {
protected ?iterable $rows;
protected int $index;
protected ?string $output;
protected ?array $cookCtx;
@ -69,7 +72,7 @@ abstract class AbstractBuilder extends TempStream implements IBuilder {
$this->headers = $headers;
}
protected abstract function _write(array $row): void;
protected abstract function _write(array $row, ?array $colsStyle=null, ?array $rowStyle=null): void;
protected bool $wroteHeaders = false;
@ -89,26 +92,27 @@ abstract class AbstractBuilder extends TempStream implements IBuilder {
$row = nur_func::_call($this->cookCtx, $args);
}
if ($row !== null) {
foreach ($row as &$value) {
foreach ($row as &$col) {
# formatter les dates
if ($value instanceof DateTime) {
$value = $value->format();
} elseif ($value instanceof DateTimeInterface) {
$value = DateTime::with($value)->format();
if ($col instanceof DateTime) {
$col = $col->format();
} elseif ($col instanceof DateTimeInterface) {
$col = DateTime::with($col)->format();
}
}; unset($value);
}; unset($col);
}
return $row;
}
function write(?array $row): void {
function write(?array $row, ?array $colsStyle=null, ?array $rowStyle=null): void {
$row = $this->cookRow($row);
if ($row === null) return;
$this->writeHeaders(array_keys($row));
$this->_write($row);
$this->_write($row, $colsStyle, $rowStyle);
$this->index++;
}
function writeAll(?iterable $rows=null): void {
function writeAll(?iterable $rows=null, ?array $rowStyle=null): void {
$unsetRows = false;
if ($rows === null) {
$rows = $this->rows;
@ -116,7 +120,7 @@ abstract class AbstractBuilder extends TempStream implements IBuilder {
}
if ($rows !== null) {
foreach ($rows as $row) {
$this->write(cl::with($row));
$this->write(cl::with($row), null, $rowStyle);
}
}
if ($unsetRows) $this->rows = null;

View File

@ -1,6 +1,6 @@
#!/bin/bash
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
source /etc/nulib.sh || exit 1
source "$(dirname -- "$0")/../../load.sh" || exit 1
declare -A DESTDIRS=(
[template-_bg_launcher.php]=sbin