Skip to content

Commit

Permalink
仅仅支持php8.2
Browse files Browse the repository at this point in the history
  • Loading branch information
chengyao committed Jan 14, 2024
1 parent 006af0b commit 7602012
Show file tree
Hide file tree
Showing 20 changed files with 123 additions and 107 deletions.
34 changes: 26 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,24 +56,42 @@
"next/var-dumper": "*"
},
"require": {
"php": "^8.0",
"psr/container": "^1.0|^2.0",
"php": "^8.2",
"next/aop": "*",
"next/cache": "*",
"next/config": "*",
"next/database": "*",
"next/di": "*",
"next/event": "*",
"next/http-message": "*",
"next/http-server": "*",
"next/routing": "*",
"next/session": "*",
"next/var-dumper": "*",
"next/utils": "*",
"psr/container": "^2.0",
"psr/simple-cache": "^1.0",
"psr/event-dispatcher": "^1.0",
"psr/http-message": "^1.0",
"psr/http-message": "^2.0",
"psr/http-server-middleware": "^1.0",
"psr/http-server-handler": "^1.0",
"psr/log": "^1.0"
"psr/log": "^3.0",
"symfony/var-dumper": "^7.0",
"voku/portable-ascii": "^2.0",
"workerman/workerman": "^4.1",
"hyperf/exception-handler": "^3.1",
"league/commonmark": "^2.4",
"ramsey/uuid": "^4.7"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "*",
"phpunit/phpunit": "^9.0",
"phpunit/phpunit": "*",
"phpstan/phpstan": "*",
"doctrine/inflector": "*"
},
"scripts": {
"test": "phpunit --prepend tests/bootstrap.php -c phpunit.xml --colors=always",
"cs-fix": "php-cs-fixer fix $1",
"analyse": "phpstan analyse --memory-limit 300M -l 0 -c phpstan.neon $1"
"test": "@php ./vendor/bin/phpunit --prepend tests/bootstrap.php -c phpunit.xml --colors=always",
"cs-fix": "@php ./vendor/bin/php-cs-fixer fix $1",
"analyse": "@php ./vendor/bin/phpstan analyse --memory-limit 300M -l 0 -c phpstan.neon"
}
}
44 changes: 22 additions & 22 deletions src/aop/composer.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
{
"name": "next/aop",
"description": "An AOP package that is resident in in-memory PHP frameworks, such as nextphp, WebMan.",
"homepage": "https://github.com/next-laboratory/aop",
"license": "Apache-2.0",
"autoload": {
"psr-4": {
"Next\\Aop\\": "src/"
}
},
"authors": [
{
"name": "chengyao",
"email": "987861463@qq.com"
}
],
"require": {
"php": "^8.0",
"ext-pcntl": "*",
"next/utils": "dev-master",
"next/di": "dev-master",
"nikic/php-parser": "^4.13",
"symfony/finder": "*"
"name": "next/aop",
"description": "An AOP package that is resident in in-memory PHP frameworks, such as nextphp, WebMan.",
"homepage": "https://github.com/next-laboratory/aop",
"license": "Apache-2.0",
"autoload": {
"psr-4": {
"Next\\Aop\\": "src/"
}
},
"authors": [
{
"name": "chengyao",
"email": "987861463@qq.com"
}
],
"require": {
"php": "^8.2",
"ext-pcntl": "*",
"next/utils": "dev-master",
"next/di": "dev-master",
"nikic/php-parser": "^5.0",
"symfony/finder": "*"
}
}
5 changes: 3 additions & 2 deletions src/aop/src/AstManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,17 @@
use PhpParser\Node\Stmt\Namespace_;
use PhpParser\Parser;
use PhpParser\ParserFactory;
use PhpParser\PhpVersion;

class AstManager
{
protected Parser $parser;

protected array $container = [];
protected array $container = [];

public function __construct()
{
$this->parser = (new ParserFactory())->create(ParserFactory::ONLY_PHP7);
$this->parser = (new ParserFactory())->createForHostVersion();
}

public function getNodes(string $realpath)
Expand Down
2 changes: 1 addition & 1 deletion src/aop/src/PropertyHandlerVisitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function leaveNode(Node $node)
if ($reflectionConstructor = $reflectionClass->getConstructor()) {
$declaringClass = $reflectionConstructor->getDeclaringClass()->getName();
if ($classPath = Composer::getClassLoader()->findFile($declaringClass)) {
$parser = (new ParserFactory())->create(ParserFactory::PREFER_PHP7);
$parser = (new ParserFactory())->createForHostVersion();
$ast = $parser->parse(file_get_contents($classPath));
foreach ($ast as $stmt) {
if ($stmt instanceof Node\Stmt\Namespace_) {
Expand Down
2 changes: 1 addition & 1 deletion src/cache/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
}
},
"require": {
"php": "^8.0",
"php": "^8.2",
"next/utils": "~0.1",
"psr/simple-cache": "^1.0"
},
Expand Down
2 changes: 1 addition & 1 deletion src/config/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
}
},
"require": {
"php": "^8.0",
"php": "^8.2",
"next/utils": "~0.1"
},
"extra": {
Expand Down
2 changes: 1 addition & 1 deletion src/database/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
}
},
"require": {
"php": "^8.0|^8.1|^8.2",
"php": "^8.2",
"ext-pdo": "*"
}
}
2 changes: 1 addition & 1 deletion src/di/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
}
},
"require": {
"php": "^8.0|^8.1",
"php": "^8.2",
"psr/container": "^1.0|^2.0"
},
"extra": {
Expand Down
2 changes: 1 addition & 1 deletion src/event/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
}
},
"require": {
"php": "^8.0||^8.1||^8.2",
"php": "^8.2",
"psr/event-dispatcher": "^1.0"
},
"extra": {
Expand Down
5 changes: 3 additions & 2 deletions src/http-message/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
}
],
"require": {
"php": "^8.0|^8.1|^8.2",
"psr/http-message": "^1.0"
"php": "^8.2",
"ext-fileinfo": "*",
"psr/http-message": "^2.0"
},
"extra": {
"branch-alias": {
Expand Down
20 changes: 10 additions & 10 deletions src/http-message/src/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Message implements MessageInterface

protected HeaderBag $headers;

protected ?StreamInterface $body = null;
protected StreamInterface $body;

/**
* {@inheritDoc}
Expand All @@ -35,7 +35,7 @@ public function getProtocolVersion(): string
/**
* {@inheritDoc}
*/
public function withProtocolVersion($version)
public function withProtocolVersion($version): MessageInterface
{
if ($this->protocolVersion === $version) {
return $this;
Expand All @@ -61,15 +61,15 @@ public function getHeaders(): array
/**
* {@inheritDoc}
*/
public function hasHeader($name): ?bool
public function hasHeader($name): bool
{
return $this->headers->has($name);
}

/**
* {@inheritDoc}
*/
public function getHeader($name)
public function getHeader($name): array
{
return $this->headers->get($name);
}
Expand All @@ -88,7 +88,7 @@ public function getHeaderLine($name): string
/**
* {@inheritDoc}
*/
public function withHeader($name, $value)
public function withHeader($name, $value): MessageInterface
{
$new = clone $this;
$new->headers = clone $this->headers;
Expand All @@ -104,7 +104,7 @@ public function setHeader($name, $value)
/**
* {@inheritDoc}
*/
public function withAddedHeader($name, $value)
public function withAddedHeader($name, $value): MessageInterface
{
$new = clone $this;
$new->headers = clone $this->headers;
Expand All @@ -120,7 +120,7 @@ public function setAddedHeader($name, $value)
/**
* {@inheritDoc}
*/
public function withoutHeader($name)
public function withoutHeader($name): MessageInterface
{
$new = clone $this;
$new->headers = clone $this->headers;
Expand All @@ -132,15 +132,15 @@ public function withoutHeader($name)
/**
* {@inheritDoc}
*/
public function getBody(): ?StreamInterface
public function getBody(): StreamInterface
{
return $this->body;
}

/**
* {@inheritDoc}
*/
public function withBody(StreamInterface $body)
public function withBody(StreamInterface $body): MessageInterface
{
$new = clone $this;
return $new->setBody($body);
Expand All @@ -154,6 +154,6 @@ public function setBody(StreamInterface $body)

protected function formatBody(string|StreamInterface|null $body)
{
$this->body = $body ? StandardStream::create($body) : null;
$this->body = StandardStream::create($body);
}
}
Loading

0 comments on commit 7602012

Please sign in to comment.