このサイトには広告が含まれています

PHP|phpQuery-onefile.phpをPHP8.3に対応させてみた

出力エラーを見ながらちまちまと修正後、GitHubにて対応済みバージョンを発見。。

GitHubで見つけたものがこちら

これから修正予定の方はぜひこちらをご利用ください。

修正したこと

public function count(){
↓
public function count(): int {
public function rewind(){
↓
public function rewind(): void {
public function current(){
↓
public function current(): mixed {
public function key(){
↓
public function key(): mixed {
public function next($cssSelector = null){
↓
public function next($cssSelector = null): void {
public function valid(){
↓
public function valid(): bool {
public function offsetExists($offset){
↓
public function offsetExists($offset): bool {
public function offsetGet($offset){
↓
public function offsetGet($offset): mixed {
public function offsetSet($offset, $value){
↓
public function offsetSet($offset, $value): void {
public function offsetUnset($offset){
↓
public function offsetUnset($offset): void {
$this->contentType = strtolower($contentType);
↓
if ($contentType !== null) {
  $this->contentType = strtolower($contentType);
}
$requestedCharset = strtoupper($requestedCharset);
↓
if ($requestedCharset !== null) {
  $requestedCharset = strtoupper($requestedCharset);
}
if (! $this->valid && $this->elementsInterator) {
  $this->elementsInterator = null;
} else if ($this->valid) {
  $this->current++;
} else {
  return $this->_next($cssSelector);
}
↓
if (! $this->valid && $this->elementsInterator) {
  $this->elementsInterator = null;
} else if ($this->valid) {
  $this->current++;
}

※public function next内にあります。最後のelse以降を削除します。

コメント欄

タイトルとURLをコピーしました