From 36563c6404a546adc08d63d042a45544020b2be5 Mon Sep 17 00:00:00 2001 From: Demian Katz Date: Mon, 2 Oct 2023 09:51:34 -0400 Subject: [PATCH] Align tools and settings with main project release 9.1 (#10) --- .github/workflows/ci.yaml | 6 +-- CHANGELOG.md | 22 ++++++++ build.xml | 12 ----- composer.json | 12 ++--- src/Lint/CodeData.php | 20 +++---- src/MarcLint.php | 53 ++++++++++--------- src/MarcReader.php | 5 ++ .../AbstractSerializationFile.php | 2 + src/Serialization/Iso2709.php | 4 ++ src/Serialization/MarcInJson.php | 3 ++ src/Serialization/MarcXml.php | 9 +++- tests/MarcReaderTest.php | 4 +- tests/vufind.php-cs-fixer.php | 24 +++++++-- 13 files changed, 113 insertions(+), 63 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 45aeef0..7382012 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -11,13 +11,13 @@ jobs: VUFIND_LOCAL_DIR: $GITHUB_WORKSPACE/local strategy: matrix: - php-version: ['7.4', '8.0', '8.1'] + php-version: ['8.0', '8.1', '8.2'] include: - - php-version: 7.4 - phing_tasks: "phpunitfast" - php-version: 8.0 phing_tasks: "phpunitfast" - php-version: 8.1 + phing_tasks: "phpunitfast" + - php-version: 8.2 phing_tasks: "phpunitfast phpcs-console php-cs-fixer-dryrun phpstan-console" steps: diff --git a/CHANGELOG.md b/CHANGELOG.md index fd82540..cdec2e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,28 @@ All notable changes to this project will be documented in this file, in reverse chronological order by release. +## Next Release - TBD + +### Added + +- Nothing. + +### Changed + +- The minimum PHP version requirement has been raised to 8.0. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +## Fixed + +- Nothing. + ## 1.0.2 - 2022-11-25 ### Added diff --git a/build.xml b/build.xml index f67454b..1c168e3 100644 --- a/build.xml +++ b/build.xml @@ -34,10 +34,8 @@ - - @@ -46,21 +44,11 @@ - - - - - - - - - - diff --git a/composer.json b/composer.json index 28d78ec..cddb66d 100644 --- a/composer.json +++ b/composer.json @@ -23,24 +23,22 @@ }, "config": { "platform": { - "php": "7.4.1" + "php": "8.0" } }, "require": { - "php": ">=7.4.1", + "php": ">=8.0", "opis/json-schema": "^2.3.0", "pcrov/jsonreader": "^1.0.2", "vufind-org/vufindcode": "^1.2" }, "require-dev": { - "friendsofphp/php-cs-fixer": "3.14.4", + "friendsofphp/php-cs-fixer": "3.26.1", "pear/http_request2": "2.5.1", - "phploc/phploc": "7.0.2", "phpmd/phpmd": "2.13.0", - "phpstan/phpstan": "1.10.3", - "phpunit/phpunit": "9.6.4", + "phpstan/phpstan": "1.10.34", + "phpunit/phpunit": "9.6.12", "phing/phing": "2.17.4", - "sebastian/phpcpd": "6.0.3", "squizlabs/php_codesniffer": "3.7.2" } } diff --git a/src/Lint/CodeData.php b/src/Lint/CodeData.php index 503044c..047085b 100644 --- a/src/Lint/CodeData.php +++ b/src/Lint/CodeData.php @@ -139,30 +139,30 @@ public function __construct() { // @codingStandardsIgnoreStart // fill the valid Geographic Area Codes array - $this->geogAreaCodes = explode("\t", "a------ a-af--- a-ai--- a-aj--- a-ba--- a-bg--- a-bn--- a-br--- a-bt--- a-bx--- a-cb--- a-cc--- a-cc-an a-cc-ch a-cc-cq a-cc-fu a-cc-ha a-cc-he a-cc-hh a-cc-hk a-cc-ho a-cc-hp a-cc-hu a-cc-im a-cc-ka a-cc-kc a-cc-ki a-cc-kn a-cc-kr a-cc-ku a-cc-kw a-cc-lp a-cc-mh a-cc-nn a-cc-pe a-cc-sh a-cc-sm a-cc-sp a-cc-ss a-cc-su a-cc-sz a-cc-ti a-cc-tn a-cc-ts a-cc-yu a-ccg-- a-cck-- a-ccp-- a-ccs-- a-ccy-- a-ce--- a-ch--- a-cy--- a-em--- a-gs--- a-ii--- a-io--- a-iq--- a-ir--- a-is--- a-ja--- a-jo--- a-kg--- a-kn--- a-ko--- a-kr--- a-ku--- a-kz--- a-le--- a-ls--- a-mk--- a-mp--- a-my--- a-np--- a-nw--- a-ph--- a-pk--- a-pp--- a-qa--- a-si--- a-su--- a-sy--- a-ta--- a-th--- a-tk--- a-ts--- a-tu--- a-uz--- a-vt--- a-ye--- aa----- ab----- ac----- ae----- af----- ag----- ah----- ai----- ak----- am----- an----- ao----- aopf--- aoxp--- ap----- ar----- as----- at----- au----- aw----- awba--- awgz--- ay----- az----- b------ c------ cc----- cl----- d------ dd----- e------ e-aa--- e-an--- e-au--- e-be--- e-bn--- e-bu--- e-bw--- e-ci--- e-cs--- e-dk--- e-er--- e-fi--- e-fr--- e-ge--- e-gi--- e-gr--- e-gw--- e-gx--- e-hu--- e-ic--- e-ie--- e-it--- e-kv--- e-lh--- e-li--- e-lu--- e-lv--- e-mc--- e-mm--- e-mo--- e-mv--- e-ne--- e-no--- e-pl--- e-po--- e-rb--- e-rm--- e-ru--- e-sm--- e-sp--- e-sw--- e-sz--- e-uk--- e-uk-en e-uk-ni e-uk-st e-uk-ui e-uk-wl e-un--- e-ur--- e-urc-- e-ure-- e-urf-- e-urk-- e-urn-- e-urp-- e-urr-- e-urs-- e-uru-- e-urw-- e-vc--- e-xn--- e-xo--- e-xr--- e-xv--- e-yu--- ea----- eb----- ec----- ed----- ee----- el----- en----- eo----- ep----- er----- es----- ev----- ew----- f------ f-ae--- f-ao--- f-bd--- f-bs--- f-cd--- f-cf--- f-cg--- f-cm--- f-cx--- f-dm--- f-ea--- f-eg--- f-et--- f-ft--- f-gh--- f-gm--- f-go--- f-gv--- f-iv--- f-ke--- f-lb--- f-lo--- f-ly--- f-mg--- f-ml--- f-mr--- f-mu--- f-mw--- f-mz--- f-ng--- f-nr--- f-pg--- f-rh--- f-rw--- f-sa--- f-sd--- f-sf--- f-sg--- f-sh--- f-sj--- f-sl--- f-so--- f-sq--- f-ss--- f-sx--- f-tg--- f-ti--- f-tz--- f-ua--- f-ug--- f-uv--- f-za--- fa----- fb----- fc----- fd----- fe----- ff----- fg----- fh----- fi----- fl----- fn----- fq----- fr----- fs----- fu----- fv----- fw----- fz----- h------ i------ i-bi--- i-cq--- i-fs--- i-hm--- i-mf--- i-my--- i-re--- i-se--- i-xa--- i-xb--- i-xc--- i-xo--- l------ ln----- lnaz--- lnbm--- lnca--- lncv--- lnfa--- lnjn--- lnma--- lnsb--- ls----- lsai--- lsbv--- lsfk--- lstd--- lsxj--- lsxs--- m------ ma----- mb----- me----- mm----- mr----- n------ n-cn--- n-cn-ab n-cn-bc n-cn-mb n-cn-nf n-cn-nk n-cn-ns n-cn-nt n-cn-nu n-cn-on n-cn-pi n-cn-qu n-cn-sn n-cn-yk n-cnh-- n-cnm-- n-cnp-- n-gl--- n-mx--- n-us--- n-us-ak n-us-al n-us-ar n-us-az n-us-ca n-us-co n-us-ct n-us-dc n-us-de n-us-fl n-us-ga n-us-hi n-us-ia n-us-id n-us-il n-us-in n-us-ks n-us-ky n-us-la n-us-ma n-us-md n-us-me n-us-mi n-us-mn n-us-mo n-us-ms n-us-mt n-us-nb n-us-nc n-us-nd n-us-nh n-us-nj n-us-nm n-us-nv n-us-ny n-us-oh n-us-ok n-us-or n-us-pa n-us-ri n-us-sc n-us-sd n-us-tn n-us-tx n-us-ut n-us-va n-us-vt n-us-wa n-us-wi n-us-wv n-us-wy n-usa-- n-usc-- n-use-- n-usl-- n-usm-- n-usn-- n-uso-- n-usp-- n-usr-- n-uss-- n-ust-- n-usu-- n-xl--- nc----- ncbh--- nccr--- nccz--- nces--- ncgt--- ncho--- ncnq--- ncpn--- nl----- nm----- np----- nr----- nw----- nwaq--- nwaw--- nwbb--- nwbf--- nwbn--- nwcj--- nwco--- nwcu--- nwdq--- nwdr--- nweu--- nwgd--- nwgp--- nwhi--- nwht--- nwjm--- nwla--- nwli--- nwmj--- nwmq--- nwna--- nwpr--- nwsc--- nwsd--- nwsn--- nwst--- nwsv--- nwtc--- nwtr--- nwuc--- nwvb--- nwvi--- nwwi--- nwxa--- nwxi--- nwxk--- nwxm--- p------ pn----- po----- poas--- pobp--- poci--- pocw--- poea--- pofj--- pofp--- pogg--- pogu--- poji--- pokb--- poki--- poln--- pome--- pomi--- ponl--- ponn--- ponu--- popc--- popl--- pops--- posh--- potl--- poto--- pott--- potv--- poup--- powf--- powk--- pows--- poxd--- poxe--- poxf--- poxh--- ps----- q------ r------ s------ s-ag--- s-bl--- s-bo--- s-ck--- s-cl--- s-ec--- s-fg--- s-gy--- s-pe--- s-py--- s-sr--- s-uy--- s-ve--- sa----- sn----- sp----- t------ u------ u-ac--- u-at--- u-at-ac u-at-ne u-at-no u-at-qn u-at-sa u-at-tm u-at-vi u-at-we u-atc-- u-ate-- u-atn-- u-cs--- u-nz--- w------ x------ xa----- xb----- xc----- xd----- zd----- zju---- zma---- zme---- zmo---- zne---- zo----- zpl---- zs----- zsa---- zsu---- zur---- zve----"); + $this->geogAreaCodes = explode("\t", 'a------ a-af--- a-ai--- a-aj--- a-ba--- a-bg--- a-bn--- a-br--- a-bt--- a-bx--- a-cb--- a-cc--- a-cc-an a-cc-ch a-cc-cq a-cc-fu a-cc-ha a-cc-he a-cc-hh a-cc-hk a-cc-ho a-cc-hp a-cc-hu a-cc-im a-cc-ka a-cc-kc a-cc-ki a-cc-kn a-cc-kr a-cc-ku a-cc-kw a-cc-lp a-cc-mh a-cc-nn a-cc-pe a-cc-sh a-cc-sm a-cc-sp a-cc-ss a-cc-su a-cc-sz a-cc-ti a-cc-tn a-cc-ts a-cc-yu a-ccg-- a-cck-- a-ccp-- a-ccs-- a-ccy-- a-ce--- a-ch--- a-cy--- a-em--- a-gs--- a-ii--- a-io--- a-iq--- a-ir--- a-is--- a-ja--- a-jo--- a-kg--- a-kn--- a-ko--- a-kr--- a-ku--- a-kz--- a-le--- a-ls--- a-mk--- a-mp--- a-my--- a-np--- a-nw--- a-ph--- a-pk--- a-pp--- a-qa--- a-si--- a-su--- a-sy--- a-ta--- a-th--- a-tk--- a-ts--- a-tu--- a-uz--- a-vt--- a-ye--- aa----- ab----- ac----- ae----- af----- ag----- ah----- ai----- ak----- am----- an----- ao----- aopf--- aoxp--- ap----- ar----- as----- at----- au----- aw----- awba--- awgz--- ay----- az----- b------ c------ cc----- cl----- d------ dd----- e------ e-aa--- e-an--- e-au--- e-be--- e-bn--- e-bu--- e-bw--- e-ci--- e-cs--- e-dk--- e-er--- e-fi--- e-fr--- e-ge--- e-gi--- e-gr--- e-gw--- e-gx--- e-hu--- e-ic--- e-ie--- e-it--- e-kv--- e-lh--- e-li--- e-lu--- e-lv--- e-mc--- e-mm--- e-mo--- e-mv--- e-ne--- e-no--- e-pl--- e-po--- e-rb--- e-rm--- e-ru--- e-sm--- e-sp--- e-sw--- e-sz--- e-uk--- e-uk-en e-uk-ni e-uk-st e-uk-ui e-uk-wl e-un--- e-ur--- e-urc-- e-ure-- e-urf-- e-urk-- e-urn-- e-urp-- e-urr-- e-urs-- e-uru-- e-urw-- e-vc--- e-xn--- e-xo--- e-xr--- e-xv--- e-yu--- ea----- eb----- ec----- ed----- ee----- el----- en----- eo----- ep----- er----- es----- ev----- ew----- f------ f-ae--- f-ao--- f-bd--- f-bs--- f-cd--- f-cf--- f-cg--- f-cm--- f-cx--- f-dm--- f-ea--- f-eg--- f-et--- f-ft--- f-gh--- f-gm--- f-go--- f-gv--- f-iv--- f-ke--- f-lb--- f-lo--- f-ly--- f-mg--- f-ml--- f-mr--- f-mu--- f-mw--- f-mz--- f-ng--- f-nr--- f-pg--- f-rh--- f-rw--- f-sa--- f-sd--- f-sf--- f-sg--- f-sh--- f-sj--- f-sl--- f-so--- f-sq--- f-ss--- f-sx--- f-tg--- f-ti--- f-tz--- f-ua--- f-ug--- f-uv--- f-za--- fa----- fb----- fc----- fd----- fe----- ff----- fg----- fh----- fi----- fl----- fn----- fq----- fr----- fs----- fu----- fv----- fw----- fz----- h------ i------ i-bi--- i-cq--- i-fs--- i-hm--- i-mf--- i-my--- i-re--- i-se--- i-xa--- i-xb--- i-xc--- i-xo--- l------ ln----- lnaz--- lnbm--- lnca--- lncv--- lnfa--- lnjn--- lnma--- lnsb--- ls----- lsai--- lsbv--- lsfk--- lstd--- lsxj--- lsxs--- m------ ma----- mb----- me----- mm----- mr----- n------ n-cn--- n-cn-ab n-cn-bc n-cn-mb n-cn-nf n-cn-nk n-cn-ns n-cn-nt n-cn-nu n-cn-on n-cn-pi n-cn-qu n-cn-sn n-cn-yk n-cnh-- n-cnm-- n-cnp-- n-gl--- n-mx--- n-us--- n-us-ak n-us-al n-us-ar n-us-az n-us-ca n-us-co n-us-ct n-us-dc n-us-de n-us-fl n-us-ga n-us-hi n-us-ia n-us-id n-us-il n-us-in n-us-ks n-us-ky n-us-la n-us-ma n-us-md n-us-me n-us-mi n-us-mn n-us-mo n-us-ms n-us-mt n-us-nb n-us-nc n-us-nd n-us-nh n-us-nj n-us-nm n-us-nv n-us-ny n-us-oh n-us-ok n-us-or n-us-pa n-us-ri n-us-sc n-us-sd n-us-tn n-us-tx n-us-ut n-us-va n-us-vt n-us-wa n-us-wi n-us-wv n-us-wy n-usa-- n-usc-- n-use-- n-usl-- n-usm-- n-usn-- n-uso-- n-usp-- n-usr-- n-uss-- n-ust-- n-usu-- n-xl--- nc----- ncbh--- nccr--- nccz--- nces--- ncgt--- ncho--- ncnq--- ncpn--- nl----- nm----- np----- nr----- nw----- nwaq--- nwaw--- nwbb--- nwbf--- nwbn--- nwcj--- nwco--- nwcu--- nwdq--- nwdr--- nweu--- nwgd--- nwgp--- nwhi--- nwht--- nwjm--- nwla--- nwli--- nwmj--- nwmq--- nwna--- nwpr--- nwsc--- nwsd--- nwsn--- nwst--- nwsv--- nwtc--- nwtr--- nwuc--- nwvb--- nwvi--- nwwi--- nwxa--- nwxi--- nwxk--- nwxm--- p------ pn----- po----- poas--- pobp--- poci--- pocw--- poea--- pofj--- pofp--- pogg--- pogu--- poji--- pokb--- poki--- poln--- pome--- pomi--- ponl--- ponn--- ponu--- popc--- popl--- pops--- posh--- potl--- poto--- pott--- potv--- poup--- powf--- powk--- pows--- poxd--- poxe--- poxf--- poxh--- ps----- q------ r------ s------ s-ag--- s-bl--- s-bo--- s-ck--- s-cl--- s-ec--- s-fg--- s-gy--- s-pe--- s-py--- s-sr--- s-uy--- s-ve--- sa----- sn----- sp----- t------ u------ u-ac--- u-at--- u-at-ac u-at-ne u-at-no u-at-qn u-at-sa u-at-tm u-at-vi u-at-we u-atc-- u-ate-- u-atn-- u-cs--- u-nz--- w------ x------ xa----- xb----- xc----- xd----- zd----- zju---- zma---- zme---- zmo---- zne---- zo----- zpl---- zs----- zsa---- zsu---- zur---- zve----'); // fill the obsolete Geographic Area Codes array - $this->obsoleteGeogAreaCodes = explode("\t", "t-ay--- e-ur-ai e-ur-aj nwbc--- e-ur-bw f-by--- pocp--- e-url-- cr----- v------ e-ur-er et----- e-ur-gs pogn--- nwga--- nwgs--- a-hk--- ei----- f-if--- awiy--- awiw--- awiu--- e-ur-kz e-ur-kg e-ur-lv e-ur-li a-mh--- cm----- e-ur-mv n-usw-- a-ok--- a-pt--- e-ur-ru pory--- nwsb--- posc--- a-sk--- posn--- e-uro-- e-ur-ta e-ur-tk e-ur-un e-ur-uz a-vn--- a-vs--- nwvr--- e-urv-- a-ys---"); + $this->obsoleteGeogAreaCodes = explode("\t", 't-ay--- e-ur-ai e-ur-aj nwbc--- e-ur-bw f-by--- pocp--- e-url-- cr----- v------ e-ur-er et----- e-ur-gs pogn--- nwga--- nwgs--- a-hk--- ei----- f-if--- awiy--- awiw--- awiu--- e-ur-kz e-ur-kg e-ur-lv e-ur-li a-mh--- cm----- e-ur-mv n-usw-- a-ok--- a-pt--- e-ur-ru pory--- nwsb--- posc--- a-sk--- posn--- e-uro-- e-ur-ta e-ur-tk e-ur-un e-ur-uz a-vn--- a-vs--- nwvr--- e-urv-- a-ys---'); // fill the valid Language Codes array - $this->languageCodes = explode("\t", " aar abk ace ach ada ady afa afh afr ain aka akk alb ale alg alt amh ang anp apa ara arc arg arm arn arp art arw asm ast ath aus ava ave awa aym aze bad bai bak bal bam ban baq bas bat bej bel bem ben ber bho bih bik bin bis bla bnt bos bra bre btk bua bug bul bur byn cad cai car cat cau ceb cel cha chb che chg chi chk chm chn cho chp chr chu chv chy cmc cop cor cos cpe cpf cpp cre crh crp csb cus cze dak dan dar day del den dgr din div doi dra dsb dua dum dut dyu dzo efi egy eka elx eng enm epo est ewe ewo fan fao fat fij fil fin fiu fon fre frm fro frr frs fry ful fur gaa gay gba gem geo ger gez gil gla gle glg glv gmh goh gon gor got grb grc gre grn gsw guj gwi hai hat hau haw heb her hil him hin hit hmn hmo hrv hsb hun hup iba ibo ice ido iii ijo iku ile ilo ina inc ind ine inh ipk ira iro ita jav jbo jpn jpr jrb kaa kab kac kal kam kan kar kas kau kaw kaz kbd kha khi khm kho kik kin kir kmb kok kom kon kor kos kpe krc krl kro kru kua kum kur kut lad lah lam lao lat lav lez lim lin lit lol loz ltz lua lub lug lui lun luo lus mac mad mag mah mai mak mal man mao map mar mas may mdf mdr men mga mic min mis mkh mlg mlt mnc mni mno moh mon mos mul mun mus mwl mwr myn myv nah nai nap nau nav nbl nde ndo nds nep new nia nic niu nno nob nog non nor nqo nso nub nwc nya nym nyn nyo nzi oci oji ori orm osa oss ota oto paa pag pal pam pan pap pau peo per phi phn pli pol pon por pra pro pus que raj rap rar roa roh rom rum run rup rus sad sag sah sai sal sam san sas sat scn sco sel sem sga sgn shn sid sin sio sit sla slo slv sma sme smi smj smn smo sms sna snd snk sog som son sot spa srd srn srp srr ssa ssw suk sun sus sux swa swe syc syr tah tai tam tat tel tem ter tet tgk tgl tha tib tig tir tiv tkl tlh tli tmh tog ton tpi tsi tsn tso tuk tum tup tur tut tvl twi tyv udm uga uig ukr umb und urd uzb vai ven vie vol vot wak wal war was wel wen wln wol xal xho yao yap yid yor ypk zap zbl zen zha znd zul zun zxx zza"); + $this->languageCodes = explode("\t", ' aar abk ace ach ada ady afa afh afr ain aka akk alb ale alg alt amh ang anp apa ara arc arg arm arn arp art arw asm ast ath aus ava ave awa aym aze bad bai bak bal bam ban baq bas bat bej bel bem ben ber bho bih bik bin bis bla bnt bos bra bre btk bua bug bul bur byn cad cai car cat cau ceb cel cha chb che chg chi chk chm chn cho chp chr chu chv chy cmc cop cor cos cpe cpf cpp cre crh crp csb cus cze dak dan dar day del den dgr din div doi dra dsb dua dum dut dyu dzo efi egy eka elx eng enm epo est ewe ewo fan fao fat fij fil fin fiu fon fre frm fro frr frs fry ful fur gaa gay gba gem geo ger gez gil gla gle glg glv gmh goh gon gor got grb grc gre grn gsw guj gwi hai hat hau haw heb her hil him hin hit hmn hmo hrv hsb hun hup iba ibo ice ido iii ijo iku ile ilo ina inc ind ine inh ipk ira iro ita jav jbo jpn jpr jrb kaa kab kac kal kam kan kar kas kau kaw kaz kbd kha khi khm kho kik kin kir kmb kok kom kon kor kos kpe krc krl kro kru kua kum kur kut lad lah lam lao lat lav lez lim lin lit lol loz ltz lua lub lug lui lun luo lus mac mad mag mah mai mak mal man mao map mar mas may mdf mdr men mga mic min mis mkh mlg mlt mnc mni mno moh mon mos mul mun mus mwl mwr myn myv nah nai nap nau nav nbl nde ndo nds nep new nia nic niu nno nob nog non nor nqo nso nub nwc nya nym nyn nyo nzi oci oji ori orm osa oss ota oto paa pag pal pam pan pap pau peo per phi phn pli pol pon por pra pro pus que raj rap rar roa roh rom rum run rup rus sad sag sah sai sal sam san sas sat scn sco sel sem sga sgn shn sid sin sio sit sla slo slv sma sme smi smj smn smo sms sna snd snk sog som son sot spa srd srn srp srr ssa ssw suk sun sus sux swa swe syc syr tah tai tam tat tel tem ter tet tgk tgl tha tib tig tir tiv tkl tlh tli tmh tog ton tpi tsi tsn tso tuk tum tup tur tut tvl twi tyv udm uga uig ukr umb und urd uzb vai ven vie vol vot wak wal war was wel wen wln wol xal xho yao yap yid yor ypk zap zbl zen zha znd zul zun zxx zza'); // fill the obsolete Language Codes array - $this->obsoleteLanguageCodes = explode("\t", "ajm esk esp eth far fri gag gua int iri cam kus mla max mol lan gal lap sao gae scc scr sho snh sso swz tag taj tar tru tsw"); + $this->obsoleteLanguageCodes = explode("\t", 'ajm esk esp eth far fri gag gua int iri cam kus mla max mol lan gal lap sao gae scc scr sho snh sso swz tag taj tar tru tsw'); // fill the valid Country Codes array - $this->countryCodes = explode("\t", "aa abc aca ae af ag ai aj aku alu am an ao aq aru as at au aw ay azu ba bb bcc bd be bf bg bh bi bl bm bn bo bp br bs bt bu bv bw bx ca cau cb cc cd ce cf cg ch ci cj ck cl cm co cou cq cr ctu cu cv cw cx cy dcu deu dk dm dq dr ea ec eg em enk er es et fa fg fi fj fk flu fm fp fr fs ft gau gb gd gh gi gl gm go gp gr gs gt gu gv gw gy gz hiu hm ho ht hu iau ic idu ie ii ilu inu io iq ir is it iv iy ja ji jm jo ke kg kn ko ksu ku kv kyu kz lau lb le lh li lo ls lu lv ly mau mbc mc mdu meu mf mg miu mj mk ml mm mnu mo mou mp mq mr msu mtu mu mv mw mx my mz na nbu ncu ndu ne nfc ng nhu nik nju nkc nl nmu nn no np nq nr nsc ntc nu nuc nvu nw nx nyu nz ohu oku onc oru ot pau pc pe pf pg ph pic pk pl pn po pp pr pw py qa qea quc rb re rh riu rm ru rw sa sc scu sd sdu se sf sg sh si sj sl sm sn snc so sp sq sr ss st stk su sw sx sy sz ta tc tg th ti tk tl tma tnu to tr ts tu tv txu tz ua uc ug uik un up utu uv uy uz vau vb vc ve vi vm vp vra vtu wau wea wf wiu wj wk wlk ws wvu wyu xa xb xc xd xe xf xga xh xj xk xl xm xn xna xo xoa xp xr xra xs xv xx xxc xxk xxu ye ykc za "); + $this->countryCodes = explode("\t", 'aa abc aca ae af ag ai aj aku alu am an ao aq aru as at au aw ay azu ba bb bcc bd be bf bg bh bi bl bm bn bo bp br bs bt bu bv bw bx ca cau cb cc cd ce cf cg ch ci cj ck cl cm co cou cq cr ctu cu cv cw cx cy dcu deu dk dm dq dr ea ec eg em enk er es et fa fg fi fj fk flu fm fp fr fs ft gau gb gd gh gi gl gm go gp gr gs gt gu gv gw gy gz hiu hm ho ht hu iau ic idu ie ii ilu inu io iq ir is it iv iy ja ji jm jo ke kg kn ko ksu ku kv kyu kz lau lb le lh li lo ls lu lv ly mau mbc mc mdu meu mf mg miu mj mk ml mm mnu mo mou mp mq mr msu mtu mu mv mw mx my mz na nbu ncu ndu ne nfc ng nhu nik nju nkc nl nmu nn no np nq nr nsc ntc nu nuc nvu nw nx nyu nz ohu oku onc oru ot pau pc pe pf pg ph pic pk pl pn po pp pr pw py qa qea quc rb re rh riu rm ru rw sa sc scu sd sdu se sf sg sh si sj sl sm sn snc so sp sq sr ss st stk su sw sx sy sz ta tc tg th ti tk tl tma tnu to tr ts tu tv txu tz ua uc ug uik un up utu uv uy uz vau vb vc ve vi vm vp vra vtu wau wea wf wiu wj wk wlk ws wvu wyu xa xb xc xd xe xf xga xh xj xk xl xm xn xna xo xoa xp xr xra xs xv xx xxc xxk xxu ye ykc za '); // fill the obsolete Country Codes array - $this->obsoleteCountryCodes = explode("\t", "ai air ac ajr bwr cn cz cp ln cs err gsr ge gn hk iw iu jn kzr kgr lvr lir mh mvr nm pt rur ry xi sk xxr sb sv tar tt tkr unr uk ui us uzr vn vs wb ys yu "); + $this->obsoleteCountryCodes = explode("\t", 'ai air ac ajr bwr cn cz cp ln cs err gsr ge gn hk iw iu jn kzr kgr lvr lir mh mvr nm pt rur ry xi sk xxr sb sv tar tt tkr unr uk ui us uzr vn vs wb ys yu '); // the codes cash, lcsh, lcshac, mesh, nal, and rvm are covered by 2nd // indicators in 600-655 // they are only used when indicators are not available - $this->sources600_651 = explode("\t", "aass aat abne aedoml afo afset agrifors agrovoc agrovocf agrovocs aiatsisl aiatsisp aiatsiss aktp albt allars apaist armac ascl asft ashlnl asrcrfcd asrcseo asrctoa asth ated atg atla aucsh ausext bare barn bhb bella bet bhammf bhashe bib1814 bibalex bibbi biccbmc bicssc bidex bisacsh bisacmt bisacrt bjornson blcpss blmlsh blnpn bokbas bt btr cabt cash cbk cck cckthema ccsa cct ccte cctf ccucaut cdcng ceeus cerlt chirosh cht ciesiniv cilla ckhw collett conorsi csahssa csalsct csapa csh csht cstud czenas czmesh dacs dbcsh dbn dcs ddcri ddcrit ddcut dicgenam dicgenes dicgentop dissao dit dltlt dltt drama dtict dugfr ebfem eclas eet eflch eks embiaecid embne embucm emnmus ept erfemn ericd est eum eurovocen eurovoces eurovocfr eurovocsl fast fautor fes finaf finmesh fire fmesh fnhl francis fssh galestne gbd gccst gcipmedia gcipplatform gem gemet georeft gnd gnis gst gtt habibe habich habifr habiit hamsun hapi hkcan helecon henn hlasstg hoidokki homoit hrvmesh hrvmr huc humord iaat ibsen ica iconauth icpsr idas idsbb idszbz idszbzes idszbzna idszbzzg idszbzzh idszbzzk iescs iest ilot ilpt inist inspect ipat ipsp iptcnc isis itglit itoamc itrt jhpb jhpk jlabsh juho jupo jurivoc kaa kaba kao kassu kauno kaunokki kdm khib kito kitu kkts koko kssbar kta kto ktpt ktta kubikat kula kulo kupu labloc lacnaf lapponica larpcal lcac lcdgt lcmpt lcsh lcshac lcstt lctgm lemac lemb liito liv lnmmbr local ltcsh lua maaq maotao mar masa mech mero mesh mipfesd mmm mpirdes msc msh mtirdes mts musa muso muzeukc muzeukn muzvukci naf nal nalnaf nasat nbdbt nbiemnfag ncjt ndlsh netc ndllsh nicem nimacsc nlgaf nlgkk nlgsh nlksh nlmnaf nmaict no-ubo-mr noraf noram norbok normesh noubomn noubojur nsbncf nskps nta ntcpsc ntcsd ntids ntissc nzggn nznb odlt ogst onet opms ordnok pascal pepp peri periodo pha pkk pleiades pmbok pmcsg pmont pmt poliscit popinte pplt ppluk precis prnpdi prvt psychit puho quiding qlsp qrma qrmak qtglit raam ram rasuqam renib reo rero rerovoc rma root rpe rswk rswkaf rugeo rurkp rvm rvmfast rvmgd samisk sanb sao sbiao sbt scbi scgdst scisshl scot sears sfit sgc sgce shbe she shsples sigle sipri sk skbb skon slem smda snt socio solstad sosa spines ssg stcv sthus stw sucnsaf swd swemesh taika tasmas taxhs tbit tbjvp tekord tept tero tesa tesbhaecid test tgn tha thema thesoz thia tho thub tips tisa tlka tlsh toit trfarn trfbmb trfdh trfgr trfoba trfzb trt trtsa tshd tsht tsr ttka ttll tucua udc ukslc ulan umitrist unbisn unbist unescot unicefirc usaidt valo vcaadu vffyl vmj waqaf watrest wgst wot wpicsh ysa yso"); - $this->obsoleteSources600_651 = explode("\t", "bibsent cash lcsh lcshac mesh nal nobomn noubojor reroa rvm"); - $this->sources655 = explode("\t", "aat aatnor afset aiatsisl aiatsisp aiatsiss aktp alett amg asrcrfcd asrcseo asrctoa asth aucsh barn barngf bib1814 bibalex biccbmc bidex bgtchm bisacsh bisacmt bisacrt bjornson bt cash cgndb chirosh cck cct cdcng cjh collett conorsi csht czenas dacs dcs dct ddcut eet eflch embne emnmus ept erfemn ericd estc eurovocen eurovocsl fast fbg fgtpcm finmesh fire ftamc galestne gatbeg gem gmd gmgpc gnd gpn gtmm gsafd gst gtlm gttg hamsun hapi hkcan hoidokki ica ilot isbdcontent isbdmedia itglit itrt jhpb jhpk kkts lacnaf lcgft lcmpt lcsh lcshac lcstt lctgm lemac lobt local maaq mar marccategory marcform marcgt marcsmd mech mesh migfg mim msh muzeukc muzeukn muzeukv muzvukci nal nalnaf nbdbgf nbiemnfag ncrbs ncrcarrier ncrcontent ncrcpc ncrfs ncrft ncrmat ncrmedia ncrpm ncrpo ncrrm ncrtr ncrvf ndlgft ndlsh netc ngl nimafc nlgaf nlgkk nlgsh nlmnaf nmc no-ubo-mr noraf noram nsbncf ntids nzcoh nzggn nznb olacvggt onet opms ordnok peakbag pkk pmcsg pmt proysen quiding qlsp qrmak qtglit raam radfg rasuqam rbbin rbgenr rbmscv rbpap rbpri rbprov rbpub rbtyp rdabf rdabs rdacarrier rdacc rdaco rdacontent rdacpc rdact rdafnm rdafs rdaft rdagen rdagrp rdagw rdalay rdamat rdamedia rdamt rdapf rdapm rdapo rdarm rdarr rdaspc rdatc rdatr rdavf reo rerovoc reveal rma rswk rswkaf rugeo rvm rvmgf sao saogf scbi sears sgc sgce sgp sipri skon snt socio spines ssg stw swd swemesh tbit thema tesa tgfbne thesoz tho thub toit tsht tsaij tucua ukslc ulan vgmsgg vgmsng vmj waqaf"); - $this->obsoleteSources655 = explode("\t", "cash ftamc lcsh lcshac marccarrier marccontent marcmedia mesh nal reroa rvm"); + $this->sources600_651 = explode("\t", 'aass aat abne aedoml afo afset agrifors agrovoc agrovocf agrovocs aiatsisl aiatsisp aiatsiss aktp albt allars apaist armac ascl asft ashlnl asrcrfcd asrcseo asrctoa asth ated atg atla aucsh ausext bare barn bhb bella bet bhammf bhashe bib1814 bibalex bibbi biccbmc bicssc bidex bisacsh bisacmt bisacrt bjornson blcpss blmlsh blnpn bokbas bt btr cabt cash cbk cck cckthema ccsa cct ccte cctf ccucaut cdcng ceeus cerlt chirosh cht ciesiniv cilla ckhw collett conorsi csahssa csalsct csapa csh csht cstud czenas czmesh dacs dbcsh dbn dcs ddcri ddcrit ddcut dicgenam dicgenes dicgentop dissao dit dltlt dltt drama dtict dugfr ebfem eclas eet eflch eks embiaecid embne embucm emnmus ept erfemn ericd est eum eurovocen eurovoces eurovocfr eurovocsl fast fautor fes finaf finmesh fire fmesh fnhl francis fssh galestne gbd gccst gcipmedia gcipplatform gem gemet georeft gnd gnis gst gtt habibe habich habifr habiit hamsun hapi hkcan helecon henn hlasstg hoidokki homoit hrvmesh hrvmr huc humord iaat ibsen ica iconauth icpsr idas idsbb idszbz idszbzes idszbzna idszbzzg idszbzzh idszbzzk iescs iest ilot ilpt inist inspect ipat ipsp iptcnc isis itglit itoamc itrt jhpb jhpk jlabsh juho jupo jurivoc kaa kaba kao kassu kauno kaunokki kdm khib kito kitu kkts koko kssbar kta kto ktpt ktta kubikat kula kulo kupu labloc lacnaf lapponica larpcal lcac lcdgt lcmpt lcsh lcshac lcstt lctgm lemac lemb liito liv lnmmbr local ltcsh lua maaq maotao mar masa mech mero mesh mipfesd mmm mpirdes msc msh mtirdes mts musa muso muzeukc muzeukn muzvukci naf nal nalnaf nasat nbdbt nbiemnfag ncjt ndlsh netc ndllsh nicem nimacsc nlgaf nlgkk nlgsh nlksh nlmnaf nmaict no-ubo-mr noraf noram norbok normesh noubomn noubojur nsbncf nskps nta ntcpsc ntcsd ntids ntissc nzggn nznb odlt ogst onet opms ordnok pascal pepp peri periodo pha pkk pleiades pmbok pmcsg pmont pmt poliscit popinte pplt ppluk precis prnpdi prvt psychit puho quiding qlsp qrma qrmak qtglit raam ram rasuqam renib reo rero rerovoc rma root rpe rswk rswkaf rugeo rurkp rvm rvmfast rvmgd samisk sanb sao sbiao sbt scbi scgdst scisshl scot sears sfit sgc sgce shbe she shsples sigle sipri sk skbb skon slem smda snt socio solstad sosa spines ssg stcv sthus stw sucnsaf swd swemesh taika tasmas taxhs tbit tbjvp tekord tept tero tesa tesbhaecid test tgn tha thema thesoz thia tho thub tips tisa tlka tlsh toit trfarn trfbmb trfdh trfgr trfoba trfzb trt trtsa tshd tsht tsr ttka ttll tucua udc ukslc ulan umitrist unbisn unbist unescot unicefirc usaidt valo vcaadu vffyl vmj waqaf watrest wgst wot wpicsh ysa yso'); + $this->obsoleteSources600_651 = explode("\t", 'bibsent cash lcsh lcshac mesh nal nobomn noubojor reroa rvm'); + $this->sources655 = explode("\t", 'aat aatnor afset aiatsisl aiatsisp aiatsiss aktp alett amg asrcrfcd asrcseo asrctoa asth aucsh barn barngf bib1814 bibalex biccbmc bidex bgtchm bisacsh bisacmt bisacrt bjornson bt cash cgndb chirosh cck cct cdcng cjh collett conorsi csht czenas dacs dcs dct ddcut eet eflch embne emnmus ept erfemn ericd estc eurovocen eurovocsl fast fbg fgtpcm finmesh fire ftamc galestne gatbeg gem gmd gmgpc gnd gpn gtmm gsafd gst gtlm gttg hamsun hapi hkcan hoidokki ica ilot isbdcontent isbdmedia itglit itrt jhpb jhpk kkts lacnaf lcgft lcmpt lcsh lcshac lcstt lctgm lemac lobt local maaq mar marccategory marcform marcgt marcsmd mech mesh migfg mim msh muzeukc muzeukn muzeukv muzvukci nal nalnaf nbdbgf nbiemnfag ncrbs ncrcarrier ncrcontent ncrcpc ncrfs ncrft ncrmat ncrmedia ncrpm ncrpo ncrrm ncrtr ncrvf ndlgft ndlsh netc ngl nimafc nlgaf nlgkk nlgsh nlmnaf nmc no-ubo-mr noraf noram nsbncf ntids nzcoh nzggn nznb olacvggt onet opms ordnok peakbag pkk pmcsg pmt proysen quiding qlsp qrmak qtglit raam radfg rasuqam rbbin rbgenr rbmscv rbpap rbpri rbprov rbpub rbtyp rdabf rdabs rdacarrier rdacc rdaco rdacontent rdacpc rdact rdafnm rdafs rdaft rdagen rdagrp rdagw rdalay rdamat rdamedia rdamt rdapf rdapm rdapo rdarm rdarr rdaspc rdatc rdatr rdavf reo rerovoc reveal rma rswk rswkaf rugeo rvm rvmgf sao saogf scbi sears sgc sgce sgp sipri skon snt socio spines ssg stw swd swemesh tbit thema tesa tgfbne thesoz tho thub toit tsht tsaij tucua ukslc ulan vgmsgg vgmsng vmj waqaf'); + $this->obsoleteSources655 = explode("\t", 'cash ftamc lcsh lcshac marccarrier marccontent marcmedia mesh nal reroa rvm'); // @codingStandardsIgnoreEnd } } diff --git a/src/MarcLint.php b/src/MarcLint.php index 8865fa4..93ca37c 100644 --- a/src/MarcLint.php +++ b/src/MarcLint.php @@ -37,6 +37,11 @@ use VuFindCode\ISBN; +use function count; +use function in_array; +use function intval; +use function strlen; + /** * Class for testing validity of MARC records against MARC21 standard. * @@ -178,7 +183,7 @@ protected function standardFieldChecks(MarcReader $marc): void = isset($fieldsSeen['880.' . $tagNo]) ? $fieldsSeen['880.' . $tagNo] + 1 : 1; } else { - $this->warn("880: No subfield 6."); + $this->warn('880: No subfield 6.'); $tagrules = null; } } else { @@ -305,7 +310,7 @@ protected function check020(array $field, MarcReader $marc): void if ($current['code'] === 'a') { if ((substr($data, 0, strlen($isbn)) != $isbn)) { - $this->warn("020: Subfield a may have invalid characters."); + $this->warn('020: Subfield a may have invalid characters.'); } // report error if no space precedes a qualifier in subfield a @@ -347,7 +352,7 @@ protected function check020(array $field, MarcReader $marc): void if (strlen($isbn) == 10) { $isbnObj = new ISBN($isbn); if ($isbnObj->isValid()) { - $this->warn("020: Subfield z is numerically valid."); + $this->warn('020: Subfield z is numerically valid.'); } } } @@ -393,7 +398,7 @@ protected function check041(array $field, MarcReader $marc): void } else { $this->warn( "041: Subfield _$code, $data ($chk)," - . " is not valid." + . ' is not valid.' ); } } @@ -463,7 +468,7 @@ protected function check043(array $field, MarcReader $marc): void protected function check245(array $field, MarcReader $marc): void { if (!$marc->getSubfields($field, 'a')) { - $this->warn("245: Must have a subfield _a."); + $this->warn('245: Must have a subfield _a.'); } // Convert subfields to array and set flags indicating which subfields are @@ -481,11 +486,11 @@ protected function check245(array $field, MarcReader $marc): void // (LCRI 1.0C, Nov. 2003) $lastChar = substr($subfields[count($subfields) - 1]['data'], -1); if (!in_array($lastChar, ['.', '?', '!'])) { - $this->warn("245: Must end with . (period)."); + $this->warn('245: Must end with . (period).'); } elseif ($lastChar != '.') { $this->warn( - "245: MARC21 allows ? or ! as final punctuation but LCRI 1.0C, Nov." - . " 2003 (LCPS 1.7.1 for RDA records), requires period." + '245: MARC21 allows ? or ! as final punctuation but LCRI 1.0C, Nov.' + . ' 2003 (LCPS 1.7.1 for RDA records), requires period.' ); } @@ -494,7 +499,7 @@ protected function check245(array $field, MarcReader $marc): void if (isset($hasSubfields['6'])) { // make sure there are at least 2 subfields if (count($subfields) < 2) { - $this->warn("245: May have too few subfields."); + $this->warn('245: May have too few subfields.'); } else { $first = $subfields[0]['code']; $second = $subfields[1]['code']; @@ -502,7 +507,7 @@ protected function check245(array $field, MarcReader $marc): void $this->warn("245: First subfield must be _6, but it is $first"); } elseif ($second != 'a') { $this->warn( - "245: First subfield after subfield _6 must be _a, but it " + '245: First subfield after subfield _6 must be _a, but it ' . "is _$second" ); } @@ -526,12 +531,12 @@ protected function check245(array $field, MarcReader $marc): void $i > 0 && !preg_match('/\s\/$/', $subfields[$i - 1]['data']) ) { - $this->warn("245: Subfield _c must be preceded by /"); + $this->warn('245: Subfield _c must be preceded by /'); } // 245 subfield c initials should not have space if (preg_match('/\b\w\. \b\w\./', $current['data'])) { $this->warn( - "245: Subfield _c initials should not have a space." + '245: Subfield _c initials should not have a space.' ); } break; @@ -550,8 +555,8 @@ protected function check245(array $field, MarcReader $marc): void && !preg_match('/ [:;=]$/', $subfields[$i - 1]['data']) ) { $this->warn( - "245: Subfield _b should be preceded by space-colon, " - . "space-semicolon, or space-equals sign." + '245: Subfield _b should be preceded by space-colon, ' + . 'space-semicolon, or space-equals sign.' ); } } @@ -567,7 +572,7 @@ protected function check245(array $field, MarcReader $marc): void $prev = $subfields[$i - 1]['data']; if ($i > 0 && !preg_match('/(\S$)|(\-\- $)/', $prev)) { $this->warn( - "245: Subfield _h should not be preceded by space." + '245: Subfield _h should not be preceded by space.' ); } // report error if subfield 'h' does not start with open square @@ -576,7 +581,7 @@ protected function check245(array $field, MarcReader $marc): void $data = $current['data']; if (!preg_match('/^\[\w*\s*\w*\]/', $data)) { $this->warn( - "245: Subfield _h must have matching square brackets," + '245: Subfield _h must have matching square brackets,' . " $data." ); } @@ -594,7 +599,7 @@ protected function check245(array $field, MarcReader $marc): void $prev = $subfields[$i - 1]['data']; if (!preg_match('/(\S\.$)|(\-\- \.$)/', $prev)) { $this->warn( - "245: Subfield _n must be preceded by . (period)." + '245: Subfield _n must be preceded by . (period).' ); } } @@ -616,16 +621,16 @@ protected function check245(array $field, MarcReader $marc): void && !preg_match('/(\S,$)|(\-\- ,$)/', $prev['data']) ) { $this->warn( - "245: Subfield _p must be preceded by , (comma) " - . "when it follows subfield _n." + '245: Subfield _p must be preceded by , (comma) ' + . 'when it follows subfield _n.' ); } elseif ( $prev['code'] != 'n' && !preg_match('/(\S\.$)|(\-\- \.$)/', $prev['data']) ) { $this->warn( - "245: Subfield _p must be preceded by . (period)" - . " when it follows a subfield other than _n." + '245: Subfield _p must be preceded by . (period)' + . ' when it follows a subfield other than _n.' ); } } @@ -744,7 +749,7 @@ protected function checkArticle(array $field, MarcReader $marc): void } if (!is_numeric($ind)) { - $this->warn($tagNo . ": Non-filing indicator is non-numeric"); + $this->warn($tagNo . ': Non-filing indicator is non-numeric'); return; } @@ -754,7 +759,7 @@ protected function checkArticle(array $field, MarcReader $marc): void // warn about out-of-range skip indicators (note: this feature is an // addition to the PHP code; it is not ported directly from MARC::Lint). if ($ind > strlen($title)) { - $this->warn($tagNo . ": Non-filing indicator is out of range"); + $this->warn($tagNo . ': Non-filing indicator is out of range'); return; } @@ -837,7 +842,7 @@ protected function parseRules() $currentGroup = []; } } else { - $currentGroup[] = preg_replace("/\s+/", " ", $currentLine); + $currentGroup[] = preg_replace("/\s+/", ' ', $currentLine); } } diff --git a/src/MarcReader.php b/src/MarcReader.php index f7af643..56daac5 100644 --- a/src/MarcReader.php +++ b/src/MarcReader.php @@ -29,6 +29,11 @@ namespace VuFind\Marc; +use function in_array; +use function intval; +use function is_array; +use function is_string; + /** * MARC record reader class. * diff --git a/src/Serialization/AbstractSerializationFile.php b/src/Serialization/AbstractSerializationFile.php index 9269291..2024594 100644 --- a/src/Serialization/AbstractSerializationFile.php +++ b/src/Serialization/AbstractSerializationFile.php @@ -29,6 +29,8 @@ namespace VuFind\Marc\Serialization; +use function call_user_func; + /** * Abstract base class for serialization format support classes. * diff --git a/src/Serialization/Iso2709.php b/src/Serialization/Iso2709.php index 80e32d4..f3e2ea8 100644 --- a/src/Serialization/Iso2709.php +++ b/src/Serialization/Iso2709.php @@ -29,6 +29,10 @@ namespace VuFind\Marc\Serialization; +use function array_slice; +use function is_array; +use function strlen; + /** * ISO2709 exchange format support class. * diff --git a/src/Serialization/MarcInJson.php b/src/Serialization/MarcInJson.php index fa2408c..6264f89 100644 --- a/src/Serialization/MarcInJson.php +++ b/src/Serialization/MarcInJson.php @@ -31,6 +31,9 @@ use pcrov\JsonReader\JsonReader; +use function is_array; +use function strlen; + /** * MARC-in-JSON format support class. * diff --git a/src/Serialization/MarcXml.php b/src/Serialization/MarcXml.php index 2302715..17120ff 100644 --- a/src/Serialization/MarcXml.php +++ b/src/Serialization/MarcXml.php @@ -29,6 +29,11 @@ namespace VuFind\Marc\Serialization; +use function array_slice; +use function count; +use function is_string; +use function strlen; + /** * MARCXML format support class. * @@ -179,7 +184,7 @@ public static function toString(array $record): string $xml->openMemory(); $xml->setIndent(true); $xml->startDocument('1.0', 'UTF-8'); - $xml->startElementNs(null, 'collection', "http://www.loc.gov/MARC21/slim"); + $xml->startElementNs(null, 'collection', 'http://www.loc.gov/MARC21/slim'); $xml->writeAttribute( 'xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance' @@ -255,7 +260,7 @@ protected static function loadXML(string $xml): \SimpleXMLElement $saveUseErrors = libxml_use_internal_errors(true); try { libxml_clear_errors(); - $doc = \simplexml_load_string( + $doc = simplexml_load_string( $xml, \SimpleXMLElement::class, LIBXML_COMPACT diff --git a/tests/MarcReaderTest.php b/tests/MarcReaderTest.php index 4fab1f5..b41a380 100644 --- a/tests/MarcReaderTest.php +++ b/tests/MarcReaderTest.php @@ -251,7 +251,7 @@ public function testEmptyFieldInMarcXmlSerialization() */ public function testEmptySubfieldInMarcXmlSerialization() { -// $marc = "00047 00037 245000900000\x1e \x1faFoo\x1f\x1e\x1d"; + // $marc = "00047 00037 245000900000\x1e \x1faFoo\x1f\x1e\x1d"; $input = << @@ -547,7 +547,7 @@ public function testFieldFiltering() */ public function testInvalidDataArray() { - $this->expectExceptionMessage("Invalid data array format provided"); + $this->expectExceptionMessage('Invalid data array format provided'); new MarcReader([]); } diff --git a/tests/vufind.php-cs-fixer.php b/tests/vufind.php-cs-fixer.php index ad9f3ff..25898bc 100644 --- a/tests/vufind.php-cs-fixer.php +++ b/tests/vufind.php-cs-fixer.php @@ -5,7 +5,7 @@ ->in(__DIR__ . '/../src'); $rules = [ - '@PHP74Migration' => true, + '@PHP80Migration' => true, '@PHPUnit84Migration:risky' => true, '@PSR12' => true, 'align_multiline_comment' => true, @@ -17,12 +17,22 @@ 'class_attributes_separation' => ['elements' => ['method' => 'one', 'property' => 'one']], 'concat_space' => ['spacing' => 'one'], 'ereg_to_preg' => true, - 'function_typehint_space' => true, + 'get_class_to_class_keyword' => true, + 'global_namespace_import' => [ + 'import_functions' => true, + 'import_classes' => null, + ], 'is_null' => true, 'linebreak_after_opening_tag' => true, 'lowercase_cast' => true, 'magic_constant_casing' => true, + 'modernize_strpos' => true, 'native_function_casing' => true, + 'native_function_invocation' => [ + 'strict' => true, + 'scope' => 'namespaced', + ], + 'no_alias_functions' => true, 'no_blank_lines_after_class_opening' => true, 'no_empty_comment' => true, 'no_empty_phpdoc' => true, @@ -31,21 +41,29 @@ 'no_leading_import_slash' => true, 'no_leading_namespace_whitespace' => true, 'no_mixed_echo_print' => true, + 'no_php4_constructor' => true, 'no_singleline_whitespace_before_semicolons' => true, 'no_spaces_around_offset' => true, 'no_unneeded_control_parentheses' => true, 'no_unneeded_curly_braces' => true, + 'no_unneeded_final_method' => true, + 'no_unreachable_default_argument_value' => true, 'no_unused_imports' => true, 'no_useless_return' => true, 'no_whitespace_in_blank_line' => true, 'non_printable_character' => true, - 'ordered_imports' => true, + 'ordered_imports' => [ + 'imports_order' => ['class', 'function', 'const'], + 'sort_algorithm' => 'alpha', + ], 'phpdoc_no_access' => true, 'php_unit_method_casing' => true, 'pow_to_exponentiation' => true, 'single_line_after_imports' => true, + 'single_quote' => true, 'standardize_not_equals' => true, 'ternary_operator_spaces' => true, + 'type_declaration_spaces' => true, ]; $cacheDir = __DIR__ . '/../.php_cs_cache';