Skip to content

Commit

Permalink
Update packages, mostly adding PHP 8.2 support (#48)
Browse files Browse the repository at this point in the history
 - contributte/translation updated from v2.0.1 to v2.0.2 patch
See changes:
contributte/translation@v2.0.1...v2.0.2
Release notes:
https://github.com/contributte/translation/releases/tag/v2.0.2

 - phpstan/phpdoc-parser updated from 1.13.0 to 1.13.1 patch
See changes:
phpstan/phpdoc-parser@1.13.0...1.13.1
Release notes:
https://github.com/phpstan/phpdoc-parser/releases/tag/1.13.1

- roave/security-advisories updated from dev-latest@ed33734 to
dev-latest@0399700
See changes:
Roave/SecurityAdvisories@ed33734...0399700

 - spaze/encryption updated from v1.0.0 to v1.0.1 patch
See changes: spaze/encryption@v1.0.0...v1.0.1
Release notes: https://github.com/spaze/encryption/releases/tag/v1.0.1

 - spaze/feed-exports updated from v0.2.2 to v1.0.0 major
See changes:
spaze/feed-exports@v0.2.2...v1.0.0
Release notes: https://github.com/spaze/feed-exports/releases/tag/v1.0.0

 - spaze/mysql-session-handler updated from v2.3.0 to v2.3.1 patch
See changes:
spaze/mysql-session-handler@v2.3.0...v2.3.1
Release notes:
https://github.com/spaze/mysql-session-handler/releases/tag/v2.3.1

 - spaze/nonce-generator updated from v3.0.2 to v3.1.0 minor
See changes:
spaze/nonce-generator@v3.0.2...v3.1.0
Release notes:
https://github.com/spaze/nonce-generator/releases/tag/v3.1.0

 - spaze/phpinfo updated from v0.1.1 to v1.0.0 major
   See changes: spaze/phpinfo@v0.1.1...v1.0.0
   Release notes: https://github.com/spaze/phpinfo/releases/tag/v1.0.0

 - spaze/phpstan-disallowed-calls updated from v2.9.0 to v2.10.0 minor
See changes:
spaze/phpstan-disallowed-calls@v2.9.0...v2.10.0
Release notes:
https://github.com/spaze/phpstan-disallowed-calls/releases/tag/v2.10.0
  • Loading branch information
spaze committed Nov 27, 2022
2 parents ab75b2c + 9e3d534 commit cc2e4d9
Show file tree
Hide file tree
Showing 26 changed files with 461 additions and 489 deletions.
4 changes: 2 additions & 2 deletions site/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@
"php-parallel-lint/php-console-color": "^1.0.1",
"spaze/csp-config": "^2.2",
"spaze/encryption": "^1.0",
"spaze/feed-exports": "^0.2.2",
"spaze/feed-exports": "^1.0",
"spaze/mysql-session-handler": "^2.3",
"spaze/nonce-generator": "^3.0.2",
"spaze/phpinfo": "^0.1.1",
"spaze/phpinfo": "^1.0",
"spaze/sri-macros": "^2.0",
"spaze/svg-icons-latte": "^1.0",
"symfony/cache": "^6.1.5",
Expand Down
176 changes: 90 additions & 86 deletions site/composer.lock

Large diffs are not rendered by default.

196 changes: 106 additions & 90 deletions site/vendor/composer/installed.json

Large diffs are not rendered by default.

54 changes: 27 additions & 27 deletions site/vendor/composer/installed.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
'name' => 'spaze/michalspacek.cz',
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => '5016f80f9a482eace33b7d88a803622d66d305fb',
'reference' => 'ab75b2ce90bdf62b88ef57188ab5e99eae216fd4',
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'dev' => true,
),
'versions' => array(
'contributte/translation' => array(
'pretty_version' => 'v2.0.1',
'version' => '2.0.1.0',
'reference' => 'bc8461e2bbaa0961af78c3018e2dc39abbf239fb',
'pretty_version' => 'v2.0.2',
'version' => '2.0.2.0',
'reference' => '2ab10a7c6bb64cfb9e069f45a23b1a3ca5fc3125',
'type' => 'library',
'install_path' => __DIR__ . '/../contributte/translation',
'aliases' => array(),
Expand Down Expand Up @@ -296,9 +296,9 @@
'dev_requirement' => true,
),
'phpstan/phpdoc-parser' => array(
'pretty_version' => '1.13.0',
'version' => '1.13.0.0',
'reference' => '33aefcdab42900e36366d0feab6206e2dd68f947',
'pretty_version' => '1.13.1',
'version' => '1.13.1.0',
'reference' => 'aac44118344d197e6d5f7c6cee91885f0a89acdd',
'type' => 'library',
'install_path' => __DIR__ . '/../phpstan/phpdoc-parser',
'aliases' => array(),
Expand Down Expand Up @@ -373,7 +373,7 @@
'roave/security-advisories' => array(
'pretty_version' => 'dev-latest',
'version' => 'dev-latest',
'reference' => 'ed33734832e5a87eaa4341be7ce580de54157460',
'reference' => '0399700d159e09b16645945758b65b921d3491fe',
'type' => 'metapackage',
'install_path' => NULL,
'aliases' => array(
Expand Down Expand Up @@ -409,18 +409,18 @@
'dev_requirement' => false,
),
'spaze/encryption' => array(
'pretty_version' => 'v1.0.0',
'version' => '1.0.0.0',
'reference' => 'e3455328a0d534612219a01cf61388bee6906c33',
'pretty_version' => 'v1.0.1',
'version' => '1.0.1.0',
'reference' => 'a7634082951fdd6e9124204e2129ba956d879e96',
'type' => 'library',
'install_path' => __DIR__ . '/../spaze/encryption',
'aliases' => array(),
'dev_requirement' => false,
),
'spaze/feed-exports' => array(
'pretty_version' => 'v0.2.2',
'version' => '0.2.2.0',
'reference' => '68aee874527eca4c300f2681e3878e182c3eeeb4',
'pretty_version' => 'v1.0.0',
'version' => '1.0.0.0',
'reference' => 'df3a16e56822ae7f2bf32a590f2cdda7d6ab6c84',
'type' => 'library',
'install_path' => __DIR__ . '/../spaze/feed-exports',
'aliases' => array(),
Expand All @@ -429,43 +429,43 @@
'spaze/michalspacek.cz' => array(
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => '5016f80f9a482eace33b7d88a803622d66d305fb',
'reference' => 'ab75b2ce90bdf62b88ef57188ab5e99eae216fd4',
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'dev_requirement' => false,
),
'spaze/mysql-session-handler' => array(
'pretty_version' => 'v2.3.0',
'version' => '2.3.0.0',
'reference' => 'f9237bb722b603eb8438cd8be530276bf650a9f1',
'pretty_version' => 'v2.3.1',
'version' => '2.3.1.0',
'reference' => '75c419a6d96245328eecdb65002bd34090dd8e5c',
'type' => 'library',
'install_path' => __DIR__ . '/../spaze/mysql-session-handler',
'aliases' => array(),
'dev_requirement' => false,
),
'spaze/nonce-generator' => array(
'pretty_version' => 'v3.0.2',
'version' => '3.0.2.0',
'reference' => '68a63070fc7c6e628ba372c0ed0363c7e12ed785',
'pretty_version' => 'v3.1.0',
'version' => '3.1.0.0',
'reference' => '2e32150405a77cba67933a78f16f5b1a0d5499dc',
'type' => 'library',
'install_path' => __DIR__ . '/../spaze/nonce-generator',
'aliases' => array(),
'dev_requirement' => false,
),
'spaze/phpinfo' => array(
'pretty_version' => 'v0.1.1',
'version' => '0.1.1.0',
'reference' => '28f5ede5669615ae809e849cb24fbdd5027df1cf',
'pretty_version' => 'v1.0.0',
'version' => '1.0.0.0',
'reference' => '85cb39b71ec564408810ebc69b8b7da1c1022277',
'type' => 'library',
'install_path' => __DIR__ . '/../spaze/phpinfo',
'aliases' => array(),
'dev_requirement' => false,
),
'spaze/phpstan-disallowed-calls' => array(
'pretty_version' => 'v2.9.0',
'version' => '2.9.0.0',
'reference' => '885582f4f2a5dbf1824c25bac4ca14c846e00813',
'pretty_version' => 'v2.10.0',
'version' => '2.10.0.0',
'reference' => '332969d0aa67ddb8597c2f1248268d69ebf5f9c7',
'type' => 'phpstan-extension',
'install_path' => __DIR__ . '/../spaze/phpstan-disallowed-calls',
'aliases' => array(),
Expand Down
37 changes: 29 additions & 8 deletions site/vendor/contributte/translation/src/Translator.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Contributte\Translation\Tracy\Panel;
use Contributte\Translation\Wrappers\Message;
use Contributte\Translation\Wrappers\NotTranslate;
use Generator;
use Nette\Localization\ITranslator;
use Nette\Utils\Strings;
use Nette\Utils\Validators;
Expand Down Expand Up @@ -45,6 +46,9 @@ class Translator extends SymfonyTranslator implements ITranslator

private string $initLang;

/** @var callable(mixed[] $params): Generator|null */
private $translateKeyGenerator = null;

/**
* @param array<string> $cacheVary
*/
Expand Down Expand Up @@ -154,6 +158,27 @@ public function addPrefix(
return $this;
}

public function getTranslateKeyGenerator(): callable
{
if ($this->translateKeyGenerator === null) {
$this->translateKeyGenerator = function (array $params): Generator {
foreach ($params as $k1 => $v1) {
yield '%' . $k1 . '%' => $v1;
}
};
}

return $this->translateKeyGenerator;
}

public function setTranslateKeyGenerator(
callable $generator
): self
{
$this->translateKeyGenerator = $generator;
return $this;
}

/**
* @throws \Contributte\Translation\Exceptions\InvalidArgument
*/
Expand Down Expand Up @@ -316,13 +341,9 @@ public function translate(
[$domain, $message] = Helpers::extractMessage($message);
}

$tmp = [];

foreach ($params as $k1 => $v1) {
$tmp['%' . $k1 . '%'] = $v1;
}
$generator = $this->getTranslateKeyGenerator();

$params = $tmp;
$params = iterator_to_array($generator($params));

if (Validators::isNumeric($count)) {
$params += ['%count%' => $count];
Expand Down Expand Up @@ -355,7 +376,7 @@ public function trans(

if ($id !== null) {
if ($this->psrLogger !== null) {
if (!$this->getCatalogue()->has($id, $domain)) {
if (!$this->getCatalogue($locale)->has($id, $domain)) {
$this->psrLogger
->notice(
'Missing translation',
Expand All @@ -369,7 +390,7 @@ public function trans(
}

if ($this->tracyPanel !== null) {
if (!$this->getCatalogue()->has($id, $domain)) {
if (!$this->getCatalogue($locale)->has($id, $domain)) {
$this->tracyPanel
->addMissingTranslation($id, $domain);
}
Expand Down
2 changes: 1 addition & 1 deletion site/vendor/phpstan/phpdoc-parser/src/Lexer/Lexer.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ private function generateRegexp(): string

self::TOKEN_OPEN_PHPDOC => '/\\*\\*(?=\\s)\\x20?+',
self::TOKEN_CLOSE_PHPDOC => '\\*/',
self::TOKEN_PHPDOC_TAG => '@[a-z][a-z0-9-\\\\]*+',
self::TOKEN_PHPDOC_TAG => '@(?:[a-z][a-z0-9-\\\\]+:)?[a-z][a-z0-9-\\\\]*+',
self::TOKEN_PHPDOC_EOL => '\\r?+\\n[\\x09\\x20]*+(?:\\*(?!/)\\x20?+)?',

self::TOKEN_FLOAT => '(?:-?[0-9]++\\.[0-9]*+(?:e-?[0-9]++)?)|(?:-?[0-9]*+\\.[0-9]++(?:e-?[0-9]++)?)|(?:-?[0-9]++e-?[0-9]++)',
Expand Down
2 changes: 2 additions & 0 deletions site/vendor/spaze/encryption/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

Various encryption helpers, uses [`paragonie/halite`](https://github.com/paragonie/halite) (which uses [Sodium](https://php.net/sodium)) for cryptography. Support key rotation.

[![PHP Tests](https://github.com/spaze/encryption/actions/workflows/php.yml/badge.svg)](https://github.com/spaze/encryption/actions/workflows/php.yml)

## Usage in Nette framework

### Define encryption keys
Expand Down
59 changes: 34 additions & 25 deletions site/vendor/spaze/encryption/src/Symmetric/StaticKey.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,19 @@

namespace Spaze\Encryption\Symmetric;

use OutOfBoundsException;
use OutOfRangeException;
use ParagonIE\ConstantTime\Hex;
use ParagonIE\Halite\Alerts\CannotPerformOperation;
use ParagonIE\Halite\Alerts\InvalidDigestLength;
use ParagonIE\Halite\Alerts\InvalidKey;
use ParagonIE\Halite\Alerts\InvalidMessage;
use ParagonIE\Halite\Alerts\InvalidSignature;
use ParagonIE\Halite\Alerts\InvalidType;
use ParagonIE\Halite\Symmetric;
use ParagonIE\HiddenString\HiddenString;
use SodiumException;
use TypeError;

/**
* StaticKey encryption service.
Expand All @@ -18,18 +28,15 @@ class StaticKey
private const KEY_CIPHERTEXT_SEPARATOR = '$';

/** @var string[][] */
private $keys;
private array $keys;

/** @var string[] */
private $activeKeyIds;
private array $activeKeyIds;

/** @var string */
private $keyGroup;
private string $keyGroup;


/**
* StaticKey constructor.
*
* @param string $keyGroup The group from which to read the key
* @param string[][] $keys
* @param string[] $activeKeyIds
Expand All @@ -50,12 +57,13 @@ public function __construct(string $keyGroup, array $keys, array $activeKeyIds)
*
* @param string $data The plaintext
* @return string
* @throws \ParagonIE\Halite\Alerts\CannotPerformOperation
* @throws \ParagonIE\Halite\Alerts\InvalidDigestLength
* @throws \ParagonIE\Halite\Alerts\InvalidKey
* @throws \ParagonIE\Halite\Alerts\InvalidMessage
* @throws \ParagonIE\Halite\Alerts\InvalidType
* @throws \TypeError
* @throws CannotPerformOperation
* @throws InvalidDigestLength
* @throws InvalidKey
* @throws InvalidMessage
* @throws InvalidType
* @throws SodiumException
* @throws TypeError
*/
public function encrypt(string $data): string
{
Expand All @@ -71,17 +79,18 @@ public function encrypt(string $data): string
*
* @param string $data
* @return string
* @throws \ParagonIE\Halite\Alerts\CannotPerformOperation
* @throws \ParagonIE\Halite\Alerts\InvalidDigestLength
* @throws \ParagonIE\Halite\Alerts\InvalidKey
* @throws \ParagonIE\Halite\Alerts\InvalidMessage
* @throws \ParagonIE\Halite\Alerts\InvalidSignature
* @throws \ParagonIE\Halite\Alerts\InvalidType
* @throws \TypeError
* @throws CannotPerformOperation
* @throws InvalidDigestLength
* @throws InvalidKey
* @throws InvalidMessage
* @throws InvalidSignature
* @throws InvalidType
* @throws SodiumException
* @throws TypeError
*/
public function decrypt(string $data): string
{
list($keyId, $cipherText) = $this->parseKeyCipherText($data);
[$keyId, $cipherText] = $this->parseKeyCipherText($data);
$key = $this->getKey($keyId);
return Symmetric\Crypto::decrypt($cipherText, $key)->getString();
}
Expand All @@ -95,7 +104,7 @@ public function decrypt(string $data): string
*/
public function needsReEncrypt(string $data): bool
{
list($keyId) = $this->parseKeyCipherText($data);
[$keyId] = $this->parseKeyCipherText($data);
return $keyId !== $this->getActiveKeyId();
}

Expand All @@ -105,15 +114,15 @@ public function needsReEncrypt(string $data): bool
*
* @param string $keyId
* @return Symmetric\EncryptionKey
* @throws \ParagonIE\Halite\Alerts\InvalidKey
* @throws \TypeError
* @throws InvalidKey
* @throws TypeError
*/
private function getKey(string $keyId): Symmetric\EncryptionKey
{
if (isset($this->keys[$this->keyGroup][$keyId])) {
return new Symmetric\EncryptionKey(new HiddenString(Hex::decode($this->keys[$this->keyGroup][$keyId])));
} else {
throw new \OutOfRangeException('Unknown encryption key id: ' . $keyId);
throw new OutOfRangeException('Unknown encryption key id: ' . $keyId);
}
}

Expand Down Expand Up @@ -141,7 +150,7 @@ private function parseKeyCipherText(string $data): array
{
$data = \explode(self::KEY_CIPHERTEXT_SEPARATOR, $data);
if (\count($data) !== 3) {
throw new \OutOfBoundsException('Data must have cipher, key, iv, and ciphertext. Now look at the Oxford comma!');
throw new OutOfBoundsException('Data must have cipher, key, iv, and ciphertext. Now look at the Oxford comma!');
}
return [$data[1], $data[2]];
}
Expand Down

0 comments on commit cc2e4d9

Please sign in to comment.