When I use command to exec phpcs, erros displays like this:
root@7be0c6dcae4e:/var/www# ./vendor/bin/phpcs
Fatal error: Uncaught Error: Class 'PHP_CodeSniffer\Runner' not found in /var/www/vendor/bin/phpcs on line 17
Error: Class 'PHP_CodeSniffer\Runner' not found in /var/www/vendor/bin/phpcs on line 17
Call Stack:
0.0002 391536 1. {main}() /var/www/vendor/bin/phpcs:0
Could you correct the differences between the diagram and the code?
I am new to docker, after running docker-compose up --build, project is successfully built, however I am not able to find the created project files in order to be able to open the project in my IDE and run the tests.
I am using PHPstorm. Can anyone please explain the build process?
I've run and built the docker file, setup interpreter in PHPStorm, however PHPUnit library is highlighting red. Undefined class 'TestCase'
.
Is there anything that I may have forgotten to setup in the IDE?
PHP Info output from PHP Storm:
PHP version: 8.0.13
PHP CLI: /usr/local/bin/php PHP CGI: /usr/local/bin/php-cgi
Loaded Configuration File: Not Found
Additional .ini files parsed: /usr/local/etc/php/conf.d/docker-php-ext-sodium.ini
Debugger extension: Not Found
Loaded extensions: Core, ctype, curl, date, dom, fileinfo, filter, ftp, hash, iconv, json, libxml, mbstring, mysqlnd, openssl, pcre, PDO, pdo_sqlite, Phar, posix, readline, Reflection, session, SimpleXML, sodium, SPL, sqlite3, standard, tokenizer, xml, xmlreader, xmlwriter, zlib
Configuration options:
allow_url_fopen
1
allow_url_include
0
arg_separator.input
&
arg_separator.output
&
assert.active
1
assert.bail
0
assert.callback
assert.exception
1
assert.warning
1
auto_append_file
auto_detect_line_endings
0
auto_globals_jit
1
auto_prepend_file
browscap
cli.pager
cli.prompt
\b >
curl.cainfo
date.default_latitude
31.7667
date.default_longitude
35.2333
date.sunrise_zenith
90.833333
date.sunset_zenith
90.833333
date.timezone
default_charset
UTF-8
default_mimetype
text/html
default_socket_timeout
60
disable_classes
disable_functions
display_errors
1
display_startup_errors
1
doc_root
docref_ext
docref_root
enable_dl
1
enable_post_data_reading
1
error_append_string
error_log
error_prepend_string
error_reporting
0
expose_php
1
extension_dir
/usr/local/lib/php/extensions/no-debug-non-zts-20200930
file_uploads
1
filter.default
unsafe_raw
filter.default_flags
from
hard_timeout
2
highlight.comment
#FF8000
highlight.default
#0000BB
highlight.html
#000000
highlight.keyword
#007700
highlight.string
#DD0000
html_errors
0
iconv.input_encoding
iconv.internal_encoding
iconv.output_encoding
ignore_repeated_errors
0
ignore_repeated_source
0
ignore_user_abort
0
implicit_flush
1
include_path
.:/usr/local/lib/php
input_encoding
internal_encoding
log_errors
0
log_errors_max_len
1024
mail.add_x_header
0
mail.force_extra_parameters
mail.log
max_execution_time
0
max_file_uploads
20
max_input_nesting_level
64
max_input_time
-1
max_input_vars
1000
mbstring.detect_order
mbstring.encoding_translation
0
mbstring.http_input
mbstring.http_output
mbstring.http_output_conv_mimetypes
^(text/|application/xhtml+xml)
mbstring.internal_encoding
mbstring.language
neutral
mbstring.regex_retry_limit
1000000
mbstring.regex_stack_limit
100000
mbstring.strict_detection
0
mbstring.substitute_character
memory_limit
128M
mysqlnd.collect_memory_statistics
0
mysqlnd.collect_statistics
1
mysqlnd.debug
mysqlnd.fetch_data_copy
0
mysqlnd.log_mask
0
mysqlnd.mempool_default_size
16000
mysqlnd.net_cmd_buffer_size
4096
mysqlnd.net_read_buffer_size
32768
mysqlnd.net_read_timeout
86400
mysqlnd.sha256_server_public_key
mysqlnd.trace_alloc
open_basedir
openssl.cafile
openssl.capath
output_buffering
0
output_encoding
output_handler
pcre.backtrack_limit
1000000
pcre.jit
1
pcre.recursion_limit
100000
phar.cache_list
phar.readonly
1
phar.require_hash
1
post_max_size
8M
precision
14
realpath_cache_size
4096K
realpath_cache_ttl
120
register_argc_argv
1
report_memleaks
1
report_zend_debug
0
request_order
sendmail_from
sendmail_path
/usr/sbin/sendmail -t -i
serialize_precision
-1
session.auto_start
0
session.cache_expire
180
session.cache_limiter
nocache
session.cookie_domain
session.cookie_httponly
0
session.cookie_lifetime
0
session.cookie_path
/
session.cookie_samesite
session.cookie_secure
0
session.gc_divisor
100
session.gc_maxlifetime
1440
session.gc_probability
1
session.lazy_write
1
session.name
PHPSESSID
session.referer_check
session.save_handler
files
session.save_path
session.serialize_handler
php
session.sid_bits_per_character
4
session.sid_length
32
session.trans_sid_hosts
session.trans_sid_tags
a=href,area=href,frame=src,form=
session.upload_progress.cleanup
1
session.upload_progress.enabled
1
session.upload_progress.freq
1%
session.upload_progress.min_freq
1
session.upload_progress.name
PHP_SESSION_UPLOAD_PROGRESS
session.upload_progress.prefix
upload_progress_
session.use_cookies
1
session.use_only_cookies
1
session.use_strict_mode
0
session.use_trans_sid
0
short_open_tag
1
SMTP
localhost
smtp_port
25
sqlite3.defensive
1
sqlite3.extension_dir
sys_temp_dir
syslog.facility
LOG_USER
syslog.filter
no-ctrl
syslog.ident
php
unserialize_callback_func
unserialize_max_depth
4096
upload_max_filesize
2M
upload_tmp_dir
url_rewriter.hosts
url_rewriter.tags
form=
user_agent
user_dir
user_ini.cache_ttl
300
user_ini.filename
.user.ini
variables_order
EGPCS
xmlrpc_error_number
0
xmlrpc_errors
0
zend.assertions
1
zend.detect_unicode
1
zend.enable_gc
1
zend.exception_ignore_args
0
zend.exception_string_param_max_len
15
zend.multibyte
0
zend.script_encoding
zend.signal_check
0
zlib.output_compression
0
zlib.output_compression_level
-1
zlib.output_handler
It seems like the translations are not working well in the spanish version, ie https://designpatternsphp.readthedocs.io/es/latest/Creational/AbstractFactory/README.html
I am Googling strategy pattern php
and don't see my favourite resource on design patterns (your website).
I suggest looking at adding some important keywords to pages , perhaps some breadcrumbs can help (link juice with important keywords), and maybe adding spaces to DesignPatternsPHP
to ensure those keywords are picked up.
As I studied the guide I noticed that some parts of it were not fully translated into Brazilian Portuguese.
I did a review and found the following pages that need improvement:
https://designpatternsphp.readthedocs.io/pt_BR/latest/Structural/DependencyInjection/README.html#
https://designpatternsphp.readthedocs.io/pt_BR/latest/Structural/Facade/README.html
https://designpatternsphp.readthedocs.io/pt_BR/latest/Behavioral/Interpreter/README.html#
https://github.com/DesignPatternsPHP/DesignPatternsPHP/blob/main/Behavioral/Observer/User.php
I think it would be clearer indication of intent if the User class stored the changed email before calling notify()
at present, the changed Email in the example is discarded, so whilst the notify method is called, the actual observer doesn't see the change so to speak.
Hello, can I try to translate the pages of the Structural section into Spanish?
Right now, the FLYERALARM coding style is being used, instead the standard coding style from Code Sniffer should be used. With that, the dep on flyeralarm/php-code-validator
can be removed.
$ git clone https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
$ cd DesignPatternsPHP
$ composer install
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
Your lock file does not contain a compatible set of packages. Please run composer update.
Problem 1
- ocramius/package-versions is locked to version 1.7.0 and an update of this package was not requested.
- ocramius/package-versions 1.7.0 requires composer-plugin-api ^1.1.0 -> found composer-plugin-api[2.0.0] but it does not match the constraint.
Problem 2
- ocramius/package-versions 1.7.0 requires composer-plugin-api ^1.1.0 -> found composer-plugin-api[2.0.0] but it does not match the constraint.
- vimeo/psalm 3.10.1 requires ocramius/package-versions ^1.2 -> satisfiable by ocramius/package-versions[1.7.0].
- vimeo/psalm is locked to version 3.10.1 and an update of this package was not requested.
ocramius/package-versions only provides support for Composer 2 in 1.8+, which requires PHP 7.4.
If you can not upgrade PHP you can require composer/package-versions-deprecated to resolve this with PHP 7.0+.
You are using Composer 2, which some of your plugins seem to be incompatible with. Make sure you update your plugins or report a plugin-issue to ask them to support Composer 2.
In the AbstractFactory example, I'm curious where the concrete class of WriterFactory.php is located. i.e. where is the code that determines if the factory should return the Windows WriterFactory or the Unix WriterFactory. Apologies if this is obvious, I just couldn't find it. Thank you.
Do you think it is valid for me to implement the CircuitBreaker pattern?
Hello there
Excellent documentation!
I'd like to translate it into Bulgarian. What's the best approach?
Is it enough to only create *.po files under locale/bg/LC_MESSAGES ?
Thank you!
To better show which translations exist, there should be a list in the README for that.
To have the docs built in a certain language, a Docker argument should be used when building.